source: frontend to show code of any specified page
[sheet.git] / source.plp
1 <:
2 use utf8;
3 use strict;
4 use warnings;
5
6 our $VERSION = 'v1.0';
7
8 $header{content_type} = "text/html; charset=utf-8";
9
10 :><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
11  "http://www.w3.org/TR/html4/loose.dtd">
12 <html>
13
14 <head>
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 }
21         .synType,
22         .synIdentifier { color: #804 }
23         .synStatement  { font-weight: bold }
24         .synPreProc    { }
25         .synSpecial    { color: #408 }
26         .synError      { font-weight: bold; background-color: #F00; color: #FFF }
27         .synTodo       { background-color: #FF0 }
28 </style>
29 </head>
30
31 <body id="source">
32 <:
33
34 my $source = $ENV{PATH_INFO};
35 $source =~ s{^/}{};
36 $source ||= $0;
37 print "<h1>Source of $source</h1>\n";
38
39 require Text::VimColor;
40 print "<pre>\n";
41 my $hl = Text::VimColor->new(file => $source);
42 print $hl->html;
43 print "</pre>\n";
44