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 <style type="text/css">
18 body { color: #000; background: #FFF }
19 .synComment { color: #888 }
20 .synConstant { color: #008 }
22 .synIdentifier { color: #804 }
25 .synSpecial { color: #408 }
26 .synError { font-weight: bold; background-color: #F00; color: #FFF }
27 .synTodo { background-color: #FF0 }
34 my $source = $ENV{PATH_INFO};
36 print "<h1>Source of $source</h1>\n";
38 if ($source =~ m{(?:/|^)\.}) {
39 die "File request not permitted\n";
41 elsif ($source =~ s{::}{/}g or !-e $source) {
44 -e ($_ = "$INC[$_]/$source") or next;
49 -r $source or die "Requested file not found\n";
51 require Text::VimColor;
52 delete $Text::VimColor::SYNTAX_TYPE{Underlined};
54 Statement => 'strong',
59 my $hl = Text::VimColor->new(
61 vim_options => [@Text::VimColor::VIM_OPTIONS, '+:set enc=utf-8'],
63 my $parsed = $hl->marked;
66 my $tag = $_->[0] && ($TYPETAG{ $_->[0] } || 'span');
68 print "<$tag$arg class=\"syn$_->[0]\">" if $tag;
69 if ($_->[0] eq 'Constant' and $_->[1] =~ s/^(')([a-z0-9_.]+\.plp?)(?=\1$)//) {
70 printf '%s<a href="%s">%s</a>', $1, "/source/$2", $2;
72 if (!$_->[0] and $_->[1] =~ s/^([A-Z]\w+(?:::\w+)+)(?![^;\s])//) {
73 printf '<a href="%s">%s</a>', "/source/$1", $1;
75 print Text::VimColor::_xml_escape($_->[1]);
76 print "</$tag>" if $tag;
81 <a href="/" rel="home">sheet.shiar.nl</a>/source
82 <a href="git://git.shiar.nl/sheet" rel="vcs-git" title="Git repository"><:= $VERSION :></a>
83 created by <a href="http://shiar.nl/" rel="author">Shiar</a> •
84 <a title="Licensed under the GNU Affero General Public License, version 3" rel="copyright"
85 href="http://www.fsf.org/licensing/licenses/agpl-3.0.html">AGPLv3</a>