8 $header{content_type} = "text/html; charset=utf-8";
10 :><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
11 "http://www.w3.org/TR/html4/loose.dtd">
15 <meta http-equiv="content-type" content="<:= $header{content_type} :>">
16 <title>sheet page source code</title>
17 <link rel="stylesheet" type="text/css" media="all" href="/base.css"><:
18 my %styles = map {$_ => $_} qw(dark mono red);
19 our $style = exists $get{style} && $styles{$get{style}} || 'light';
20 printf(qq{\n<link rel="%s" type="text/css" media="all" href="%s" title="%s">},
21 $_ eq $style ? 'stylesheet' : 'alternate stylesheet', "/$_.css", $_
29 my $source = $ENV{PATH_INFO};
33 print "<h1>Source files</h1>";
35 print "<p>Project code distributed under the AGPL. Please contribute back.</p>";
39 printf '<li><a href="/source/%s">%1$s</a></li>'."\n", Entity($_);
44 print "<h1>Source of $source</h1>\n";
46 if ($source =~ m{(?:/|^)\.}) {
47 die "File request not permitted\n";
49 elsif ($source =~ s{::}{/}g or !-e $source) {
52 -e ($_ = "$INC[$_]/$source") or next;
57 -r $source or die "Requested file not found\n";
59 require Text::VimColor;
60 delete $Text::VimColor::SYNTAX_TYPE{Underlined};
62 Statement => 'strong',
67 my $hl = Text::VimColor->new(
69 vim_options => [@Text::VimColor::VIM_OPTIONS, '+:set enc=utf-8'],
71 my $parsed = $hl->marked;
74 my $tag = $_->[0] && ($TYPETAG{ $_->[0] } || 'span');
76 print "<$tag$arg class=\"sy-\l$_->[0]\">" if $tag;
77 if ($_->[0] eq 'Constant'
78 and $_->[1] =~ s{^(['"])(/?[a-z0-9_.]+\.(?:plp?|css|js))(?=\1$)}{}) {
79 printf '%s<a href="%s">%s</a>', $1, "/source/$2", $2;
81 if (!$_->[0] and $_->[1] =~ s/^(\s*)([A-Z]\w+(?:::\w+)+)(?![^;\s])//) {
82 printf '%s<a href="%s">%s</a>', $1, "/source/$2", $2;
84 print Text::VimColor::_xml_escape($_->[1]);
85 print "</$tag>" if $tag;
91 <a href="/" rel="home">sheet.shiar.nl</a>/source.<a href="/source/source.plp" rel="code">plp</a>
92 <a href="http://git.shiar.nl/sheet.git" rel="vcs-git" title="Git repository"><:= $VERSION :></a>
93 created by <a href="http://shiar.nl/" rel="author">Shiar</a> •
94 <a title="Licensed under the GNU Affero General Public License, version 3" rel="copyright"
95 href="http://www.fsf.org/licensing/licenses/agpl-3.0.html">AGPLv3</a>