source: frontend to show code of any specified page
authorMischa POSLAWSKY <perl@shiar.org>
Sat, 3 Oct 2009 18:57:05 +0000 (18:57 +0000)
committerMischa POSLAWSKY <perl@shiar.org>
Sat, 3 Oct 2009 18:57:05 +0000 (18:57 +0000)
source.plp [new file with mode: 0644]

diff --git a/source.plp b/source.plp
new file mode 100644 (file)
index 0000000..8193de5
--- /dev/null
@@ -0,0 +1,44 @@
+<:
+use utf8;
+use strict;
+use warnings;
+
+our $VERSION = 'v1.0';
+
+$header{content_type} = "text/html; charset=utf-8";
+
+:><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+
+<head>
+<meta http-equiv="content-type" content="<:= $header{content_type} :>">
+<title>sheet page source code</title>
+<style type="text/css">
+       body           { color: #000; background: #FFF }
+       .synComment    { color: #888 }
+       .synConstant   { color: #008 }
+       .synType,
+       .synIdentifier { color: #804 }
+       .synStatement  { font-weight: bold }
+       .synPreProc    { }
+       .synSpecial    { color: #408 }
+       .synError      { font-weight: bold; background-color: #F00; color: #FFF }
+       .synTodo       { background-color: #FF0 }
+</style>
+</head>
+
+<body id="source">
+<:
+
+my $source = $ENV{PATH_INFO};
+$source =~ s{^/}{};
+$source ||= $0;
+print "<h1>Source of $source</h1>\n";
+
+require Text::VimColor;
+print "<pre>\n";
+my $hl = Text::VimColor->new(file => $source);
+print $hl->html;
+print "</pre>\n";
+