X-Git-Url: http://git.shiar.net/sheet.git/blobdiff_plain/84f0630eace132ded7af839105d7e2d096eba5ad..72d7fa29bef747722a947e079ceac1a21e12acc6:/source.plp diff --git a/source.plp b/source.plp index 418a2c1..56193fb 100644 --- a/source.plp +++ b/source.plp @@ -1,7 +1,6 @@ <(common.inc.plp)><: -my $source = $ENV{PATH_INFO}; -$source =~ s{^/}{}; +my $source = $Request; if ($source =~ s{(?<=\Q.inc.pl\E)/jsonp?$}{} and -r $source) { # convert perl include to json construct @@ -28,7 +27,7 @@ if ($source =~ s{(?<=\Q.inc.pl\E)/jsonp?$}{} and -r $source) { Html({ title => "$source source code", - version => 'v1.1', + version => '1.1', description => !$source ? 'Index of source files for this site.' : [ "Source code of the $source file at this site,", "with syntax highlighted and references linked." @@ -39,21 +38,21 @@ Html({ stylesheet => [qw'light dark mono red'], }); -print "\n"; +say ''; if (not $source) { print "
Project code distributed under the AGPL. Please contribute back.
"; - print '\n"; + say ''; } else { - print "'; foreach (@$parsed) { my ($type, $contents) = @{$_}; - $contents = Encode::decode_utf8($contents); + $contents = decode_utf8($contents); my $tag = $type && ($TYPETAG{$type} || 'span'); my $arg = ''; print "<$tag$arg class=\"sy-\l$type\">" if $tag; @@ -106,14 +104,14 @@ else { print Text::VimColor::_xml_escape($contents); print "$tag>" if $tag; } - print "\n"; + say '
\n"; - print EscapeHTML(Encode::decode_utf8(ReadFile($source))); - print "\n"; + say '
'; + print EscapeHTML(decode_utf8(ReadFile($source))); + say ''; } - print "\n"; + say ''; }