X-Git-Url: http://git.shiar.net/sheet.git/blobdiff_plain/effd000ff281f2187bf653b6e1c6aa0fc796c5f9..6311c65d7397e07947d6cf38df772545a3fa296d:/source.plp diff --git a/source.plp b/source.plp index e645cd2..d7d7cb5 100644 --- a/source.plp +++ b/source.plp @@ -29,7 +29,7 @@ if ($source =~ s{(?<=\Q.inc.pl\E)/jsonp?$}{} and -r $source) { Html({ title => "$source source code", - version => '1.2', + version => '1.3', description => !$source ? 'Index of source files for this site.' : [ "Source code of the $source file at this site,", "with syntax highlighted and references linked." @@ -43,13 +43,18 @@ Html({ say ''; -if (not $source) { - print "
Project code distributed under the AGPL. Please contribute back.
"; say ''; + print ReadFile($cachefile); + say ''; + exit; + } + -e or mkdir for $cachefile =~ s{[^/]+\z}{}r; # dirname + open my $cache, '>', $cachefile + or Alert("Could not save cache", "Opening $cachefile failed: $!");; + if (my $hl = eval { $size < 32_768 or die 'large files take too long to parse'; require Text::VimColor; @@ -89,6 +105,7 @@ else { Statement => 'strong', Error => 'em', Todo => 'em', + PreProc => 'strong', ); say '
'; @@ -110,6 +127,7 @@ else { $line = qq(<$tag class="sy-\l$type">$line$tag>) if $tag; print $line; + print {$cache} $line if $cache; } say ''; }