/data
/word/put.js
-# derived contents
+# derived or compiled contents
/sitemap.xml
/light.css
/UPDATE
/plan.plp
/word/*.min.js
+# optional cache files
+/source/*.html
+
# site owner tag for google webmaster tools
/google????????????????.html
-r $source or Abort("Requested file not found", '404 source not found');
my $size = (stat $source)->[7];
+ my $cachefile = "source/$source.html";
+ if (-e $cachefile and (stat $cachefile)->[9] >= (stat $source)->[9]) {
+ say '<pre>';
+ print ReadFile($cachefile);
+ say '</pre>';
+ exit;
+ }
+ 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;
$line = qq(<$tag class="sy-\l$type">$line</$tag>) if $tag;
print $line;
+ print {$cache} $line if $cache;
}
say '</pre>';
}