4 :><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
5 "http://www.w3.org/TR/html4/loose.dtd">
9 <meta http-equiv="content-type" content="<:= $header{content_type} :>">
10 <title>sheet page source code</title>
11 <:= stylesheet(qw'light dark mono red') :>
17 my $source = $ENV{PATH_INFO};
21 print "<h1>Source files</h1>";
23 print "<p>Project code distributed under the AGPL. Please contribute back.</p>";
27 printf '<li><a href="/source/%s">%1$s</a></li>'."\n", Entity($_);
32 print "<h1>Source of $source</h1>\n";
34 if ($source =~ m{(?:/|^)\.}) {
35 die "File request not permitted\n";
37 elsif ($source =~ s{::}{/}g or !-e $source) {
40 -e ($_ = "$INC[$_]/$source") or next;
45 -r $source or die "Requested file not found\n";
47 require Text::VimColor;
48 delete $Text::VimColor::SYNTAX_TYPE{Underlined};
50 Statement => 'strong',
55 my $hl = Text::VimColor->new(
57 vim_options => [@Text::VimColor::VIM_OPTIONS, '+:set enc=utf-8'],
59 my $parsed = $hl->marked;
62 my $tag = $_->[0] && ($TYPETAG{ $_->[0] } || 'span');
64 print "<$tag$arg class=\"sy-\l$_->[0]\">" if $tag;
65 if ($_->[0] eq 'Constant'
66 and $_->[1] =~ s{^(['"])(/?[a-z0-9_.]+\.(?:plp?|css|js))(?=\1$)}{}) {
67 printf '%s<a href="%s">%s</a>', $1, "/source/$2", $2;
69 if (!$_->[0] and $_->[1] =~ s/^(\s*)([A-Z]\w+(?:::\w+)+)(?![^;\s])//) {
70 printf '%s<a href="%s">%s</a>', $1, "/source/$2", $2;
72 print Text::VimColor::_xml_escape($_->[1]);
73 print "</$tag>" if $tag;
79 <a href="/" rel="home">sheet.shiar.nl</a>/source.<a href="/source/source.plp"
80 rel="code" title="Written in Perl">plp</a>
81 <a href="http://git.shiar.nl/sheet.git/history/HEAD:/source.plp"
82 rel="vcs-git" title="Git repository"><:= $VERSION :></a>
83 created by <a href="http://shiar.nl/" rel="author">Shiar</a> •
84 <a href="http://www.fsf.org/licensing/licenses/agpl-3.0.html" rel="copyright"
85 title="Licensed under the GNU Affero General Public License, version 3">AGPLv3</a>