common html initialisation function
authorMischa POSLAWSKY <perl@shiar.org>
Fri, 18 Dec 2009 00:22:40 +0000 (00:22 +0000)
committerMischa POSLAWSKY <perl@shiar.org>
Fri, 18 Dec 2009 00:53:02 +0000 (00:53 +0000)
14 files changed:
charset.plp
common.inc.plp
countries.plp
digraphs.plp
index.plp
mplayer.plp
mutt.plp
nethack.plp
readline.plp
source.plp
termcol.plp
unicode.plp
vi.plp
vimperator.plp

index 440cabe56cf0b0a384a391517487542bdab8c682..e2b2e277725fa1bd6204c87d962880f7a88ffde9 100644 (file)
@@ -1,20 +1,20 @@
 <(common.inc.plp)><:
-       our $VERSION = 'v1.0';
-
-:><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-<html lang="en">
-
-<head>
-<meta http-equiv="content-type" content="<:= $header{content_type} :>">
-<title>charset cheat sheet</title>
-<meta name="description" content="Reference sheet with all glyphs in common character encoding tables, and an overview of Unicode ranges and UTF-8 bytes.">
-<meta name="keywords" content="charset, codepage, unicode, ascii, utf8, latin, glyph, character, encoding, reference, common, overview, table">
-<:= stylesheet(qw'light') :>
-<link rel="icon" type="image/png" href="/clip.png">
-</head>
-
-<body id="charset">
+
+Html({
+       title => 'charset cheat sheet',
+       version => 'v1.0',
+       description => [
+               "Reference sheet with all glyphs in common character encoding tables,",
+               "and an overview of Unicode ranges and UTF-8 bytes.",
+       ],
+       keywords => [qw'
+               charset codepage unicode ascii utf8 latin glyph character encoding
+               reference common overview table
+       '],
+       stylesheet => [qw'light'],
+});
+
+:>
 <h1>Character encoding</h1>
 
 <:
@@ -191,14 +191,3 @@ for my $row (@request) {
        </table>
 </div>
 
-<p class="footer">
-       <a href="/" rel="home">sheet.shiar.nl</a>/charset.<a href="/source/charset.plp"
-        rel="code" title="Written in Perl">plp</a>
-       <a href="http://git.shiar.nl/sheet.git/history/HEAD:/charset.plp"
-        rel="vcs-git" title="Git repository"><:= $VERSION :></a>
-       created by <a href="http://shiar.nl/" rel="author">Shiar</a> •
-       <a href="http://www.fsf.org/licensing/licenses/agpl-3.0.html" rel="copyright"
-        title="Licensed under the GNU Affero General Public License, version 3">AGPLv3</a>
-</p>
-
-</html>
index 28a14cedc450b8debf5c59b04f1a04cb1afff2b5..fb1d54ac32d00c0b4fa76ef80c5f4961b9a6d320 100644 (file)
@@ -6,7 +6,11 @@ no  warnings 'qw';  # you know what you doing
 no  warnings 'uninitialized';  # save some useless checks for more legible code
 use open IO => ':utf8';
 
+use Shiar_Sheet::KeySigns qw(%sign);  # dependant on $get{ascii}
+
 our $style;
+our $showkeys = !exists $get{keys} ? undef :
+       ($get{keys} ne '0' && ($get{keys} || 'always'));
 
 $header{content_type} = 'text/html; charset=utf-8';
 
@@ -32,3 +36,65 @@ sub stylesheet {
        ) } @_;
 }
 
+sub Html {
+       my ($meta) = @_;
+
+       # default fallbacks
+       $meta->{stylesheet} ||= [qw'light dark circus mono red terse'];
+       $meta->{charset} ||= 'utf-8';
+
+       # optional amends
+       push @{ $meta->{raw} }, (
+               '<!--[if lte IE 6]><style> .help dl.legend dt {margin:0 0 1px} </style><![endif]-->',
+               '<!--[if lte IE 7]><style> .help dl.legend dd {float:none} </style><![endif]-->',
+               !$showkeys ? '<style type="text/css"> .no {visibility:hidden} </style>'
+                       : $showkeys eq 'ghost' ? '<style type="text/css"> .no, .alias {opacity:.5} </style>'
+                       : (),
+               '<script type="text/javascript" src="/keys.js"></script>',
+       ) if $meta->{keys};
+
+       # flatten arrays
+       ref $_ eq 'ARRAY' and $_ = join ' ',  @$_ for $meta->{description};
+       ref $_ eq 'ARRAY' and $_ = join ', ', @$_ for $meta->{keywords};
+       ref $_ eq 'ARRAY' and $_ = join "\n", @$_ for $meta->{rawstyle}, $meta->{raw};
+
+       # other vars
+       my $sep = $meta->{charset} eq 'utf-8' ? '•' : ' -- ';
+       my ($file) = $ENV{SCRIPT_FILENAME} =~ m{ ([^/]+) \.plp$ }x;
+
+       # leading output
+       $header{content_type} = "text/html; charset=$meta->{charset}";
+       print <<"EOT";
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+
+<head>
+<meta http-equiv="content-type" content="$header{content_type}">
+<title>$meta->{title}</title>
+<meta name="description" content="$meta->{description}">
+<meta name="keywords" content="$meta->{keywords}">
+<link rel="icon" type="image/png" href="/clip.png">
+EOT
+       print stylesheet(@$_), "\n" for $meta->{stylesheet} || ();
+       print $_, "\n" for $meta->{raw} || ();
+       print qq{</head>\n\n<body id="$file">\n};
+
+       # prepare trailing output
+       PLP_END {
+               print <<"EOT";
+<p class="footer">
+       <a href="/" rel="home">sheet.shiar.nl</a>/$file.<a href="/source/$file.plp"
+        rel="code" title="Written in Perl">plp</a>
+       <a href="http://git.shiar.nl/sheet.git/history/HEAD:/$file.plp"
+        rel="vcs-git" title="Git repository">$meta->{version}</a>
+       created by <a href="http://shiar.nl/" rel="author">Shiar</a> $sep
+       <a href="http://www.fsf.org/licensing/licenses/agpl-3.0.html" rel="copyright"
+        title="Licensed under the GNU Affero General Public License, version 3">AGPLv3</a>
+</p>
+
+</html>
+EOT
+       };
+}
+
index 6e12b1b66b14c9b3ace2b39f9255fdd316d59230..838a2886303d70ef867066a9c852ae5825819f1b 100644 (file)
@@ -1,20 +1,15 @@
 <(common.inc.plp)><:
-       our $VERSION = 'v1.0';
 
-:><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-<html lang="en">
+Html({
+       title => 'country code cheat sheet',
+       version => 'v1.0',
+       description =>
+               "Table of ISO-3166-2 country codes with the names of reserved territories.",
+       keywords => [qw'country code cc tld territory land table'],
+       stylesheet => [qw'light dark mono red'],
+});
 
-<head>
-<meta http-equiv="content-type" content="<:= $header{content_type} :>">
-<title>country code cheat sheet</title>
-<meta name="description" content="Table of ISO-3166-2 country codes with the names of reserved territories.">
-<meta name="keywords" content="country, code, cc, tld, territory, land, table">
-<:= stylesheet(qw'light dark mono red') :>
-<link rel="icon" type="image/png" href="/clip.png">
-</head>
-
-<body>
+:>
 <h1>Country codes</h1>
 
 <:
@@ -96,14 +91,3 @@ my $cc = do 'countries.inc.pl';
        </div>
 </div>
 
-<p class="footer">
-       <a href="/" rel="home">sheet.shiar.nl</a>/countries.<a href="/source/countries.plp"
-        rel="code" title="Written in Perl">plp</a>
-       <a href="http://git.shiar.nl/sheet.git/history/HEAD:/countries.plp"
-        rel="vcs-git" title="Git repository"><:= $VERSION :></a>
-       created by <a href="http://shiar.nl/" rel="author">Shiar</a> •
-       <a href="http://www.fsf.org/licensing/licenses/agpl-3.0.html" rel="copyright"
-        title="Licensed under the GNU Affero General Public License, version 3">AGPLv3</a>
-</p>
-
-</html>
index 237cc7bcfff059394c5a02e879341e83f68a99f8..8b096970725cf28f2fabbbde72a71f5be3c00a5a 100644 (file)
@@ -1,20 +1,18 @@
 <(common.inc.plp)><:
-       our $VERSION = 'v1.0';
 
-:><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-<html lang="en">
+Html({
+       title => 'digraph cheat sheet',
+       version => 'v1.0',
+       description => [
+               "Complete table of digraph characters from RFC-1345.",
+       ],
+       keywords => [qw'
+               digraph compose character char glyph table unicode vim
+       '],
+       stylesheet => [qw'light'],
+});
 
-<head>
-<meta http-equiv="content-type" content="<:= $header{content_type} :>">
-<title>digraph cheat sheet</title>
-<meta name="description" content="Complete table of digraph characters from RFC-1345.">
-<meta name="keywords" content="digraph, compose, character, char, glyph, table, unicode, vim">
-<:= stylesheet(qw'light') :>
-<link rel="icon" type="image/png" href="/clip.png">
-</head>
-
-<body id="digraphs">
+:>
 <h1>RFC-1345 Digraphs</h1>
 
 <p>i^k in <a href="/">Vim</a>.
@@ -104,14 +102,3 @@ print "</table>\n";
        </table>
 </div>
 
-<p class="footer">
-       <a href="/" rel="home">sheet.shiar.nl</a>/digraphs.<a href="/source/digraphs.plp"
-        rel="code" title="Written in Perl">plp</a>
-       <a href="http://git.shiar.nl/sheet.git/history/HEAD:/digraphs.plp"
-        rel="vcs-git" title="Git repository"><:= $VERSION :></a>
-       created by <a href="http://shiar.nl/" rel="author">Shiar</a> •
-       <a href="http://www.fsf.org/licensing/licenses/agpl-3.0.html" rel="copyright"
-        title="Licensed under the GNU Affero General Public License, version 3">AGPLv3</a>
-</p>
-
-</html>
index f91364d10c18bd31c728f64a030d7857114ead8e..839392dc35ed4d5336d5f7b8d51cbe3613474acd 100644 (file)
--- a/index.plp
+++ b/index.plp
@@ -1,21 +1,18 @@
 <(common.inc.plp)><:
-       our $VERSION = 'v1.3';
-
-:><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-<html lang="en">
-
-<head>
-<meta http-equiv="content-type" content="<:= $header{content_type} :>">
-<title>cheat sheets</title>
-<meta name="description" content="Cheat sheets summarising various software programs and standards.">
-<meta name="keywords" content="sheet, cheat, reference, software, overview, summary, help, keyboard, map, unicode">
-<:= stylesheet(qw'light dark red') :>
-<link rel="icon" type="image/png" href="/clip.png">
-</head>
-
-<body id="index">
 
+Html({
+       title => 'cheat sheets',
+       version => 'v1.3',
+       description => [
+               "Cheat sheets summarising various software programs and standards.",
+       ],
+       keywords => [qw'
+               sheet cheat reference software overview summary help keyboard map unicode
+       '],
+       stylesheet => [qw'light dark red'],
+});
+
+:>
 <h1>Shiar's cheat sheets</h1>
 
 <p>
@@ -55,12 +52,3 @@ but you're free to use, print, alter, and redistribute under the AGPL license.
 </ul>
 </div>
 
-<p class="footer">
-       <a href="http://sheet.shiar.nl/" rel="home">sheet.shiar.nl</a>/index.<a
-        href="/source/index.plp" rel="code" title="Written in Perl">plp</a>
-       <a href="http://git.shiar.nl/sheet.git" rel="vcs-git" title="Git repository"><:= $VERSION :></a>
-       created by <a href="http://shiar.nl/" rel="author">Shiar</a> •
-       <a href="http://www.fsf.org/licensing/licenses/agpl-3.0.html" rel="copyright"
-        title="Licensed under the GNU Affero General Public License, version 3">AGPLv3</a>
-</p>
-
index 1cd6cf8a7341aca19f00bf58eaba4e9b0672944c..2de974a958d3f5c274f0b921719d2c546cce1b07 100644 (file)
@@ -1,33 +1,21 @@
 <(common.inc.plp)><:
-       our $VERSION = 'v1.0';
 
-       use Shiar_Sheet::KeySigns qw(%sign);
+Html({
+       title => 'mplayer cheat sheet',
+       version => 'v1.0',
+       description => [
+               "Keyboard cheat sheet for the MPlayer media player,",
+               "overviewing the default controls."
+       ],
+       keywords => [qw'
+               mplayer video media sheet cheat reference overview control shortkey keyboard
+       '],
+       charset => $sign{charset},
+       stylesheet => [qw'light dark circus mono red terse'],
+       keys => 1,
+});
 
-       $header{content_type} = "text/html; charset=$sign{charset}";
-
-:><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-<html lang="en">
-
-<head>
-<meta http-equiv="content-type" content="<:= $header{content_type} :>">
-<title>mplayer cheat sheet</title>
-<meta name="description" content="Keyboard cheat sheet for the MPlayer media player, overviewing the default controls.">
-<meta name="keywords" content="mplayer, video, media, sheet, cheat, reference, overview, control, shortkey, keyboard">
-<:= stylesheet(qw'light dark circus mono red terse') :>
-<!--[if lte IE 6]><style> .help dl.legend dt {margin:0 0 1px} </style><![endif]-->
-<!--[if lte IE 7]><style> .help dl.legend dd {float:none} </style><![endif]--><:
-       our $showkeys = exists $get{keys} && $get{keys} ne '0';
-       print "\n".'<style type="text/css"> .no {visibility:hidden} </style>'
-               unless $showkeys;
-       print "\n".'<style type="text/css"> .no, .alias {opacity:.5} </style>'
-               if $showkeys and $get{keys} eq 'ghost';
 :>
-<link rel="icon" type="image/png" href="/clip.png">
-<script type="text/javascript" src="/keys.js"></script>
-
-<body id="mplayer">
-
 <h1>MPlayer cheat sheet</h1>
 
 <h2>index (default)</h2>
@@ -92,14 +80,3 @@ $keys->print_rows($get{rows}, [1,0]);
        </div>
 </div>
 
-<p class="footer">
-       <a href="/" rel="home">sheet.shiar.nl</a>/mplayer.<a href="/source/mplayer.plp"
-        rel="code" title="Written in Perl">plp</a>
-       <a href="http://git.shiar.nl/sheet.git/history/HEAD:/mplayer.plp"
-        rel="vcs-git" title="Git repository"><:= $VERSION :></a>
-       created by <a href="http://shiar.nl/" rel="author">Shiar</a> <:= $sign{sep} :>
-       <a href="http://www.fsf.org/licensing/licenses/agpl-3.0.html" rel="copyright"
-        title="Licensed under the GNU Affero General Public License, version 3">AGPLv3</a>
-</p>
-
-</html>
index 0dbb0d07c472e4040f8871b12af28099c917dea4..ec4d0a2320aa86b0e29724fd62a9076cdb4e5b4a 100644 (file)
--- a/mutt.plp
+++ b/mutt.plp
@@ -1,33 +1,21 @@
 <(common.inc.plp)><:
-       our $VERSION = 'v1.0';
 
-       use Shiar_Sheet::KeySigns qw(%sign);
+Html({
+       title => 'mutt cheat sheet',
+       version => 'v1.0',
+       description => [
+               "Cheat sheet for the Mutt e-mail client,",
+               "showing the default binding for each key.",
+       ],
+       keywords => [qw'
+               mutt MUA email client sheet cheat reference overview commands keyboard
+       '],
+       charset => $sign{charset},
+       stylesheet => [qw'light dark circus mono red terse'],
+       keys => 1,
+});
 
-       $header{content_type} = "text/html; charset=$sign{charset}";
-
-:><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-<html lang="en">
-
-<head>
-<meta http-equiv="content-type" content="<:= $header{content_type} :>">
-<title>mutt cheat sheet</title>
-<meta name="description" content="Cheat sheet for the Mutt e-mail client, showing the default binding for each key.">
-<meta name="keywords" content="mutt, MUA, email, client, sheet, cheat, reference, overview, commands, keyboard">
-<:= stylesheet(qw'light dark circus mono red terse') :>
-<!--[if lte IE 6]><style> .help dl.legend dt {margin:0 0 1px} </style><![endif]-->
-<!--[if lte IE 7]><style> .help dl.legend dd {float:none} </style><![endif]--><:
-       our $showkeys = exists $get{keys} && $get{keys} ne '0';
-       print "\n".'<style type="text/css"> .no {visibility:hidden} </style>'
-               unless $showkeys;
-       print "\n".'<style type="text/css"> .no, .alias {opacity:.5} </style>'
-               if $showkeys and $get{keys} eq 'ghost';
 :>
-<link rel="icon" type="image/png" href="/clip.png">
-<script type="text/javascript" src="/keys.js"></script>
-
-<body id="mutt">
-
 <h1>Mutt cheat sheet</h1>
 
 <h2>index (default)</h2>
@@ -94,14 +82,3 @@ $keys->print_rows($get{rows});
        </div>
 </div>
 
-<p class="footer">
-       <a href="/" rel="home">sheet.shiar.nl</a>/mutt.<a href="/source/mutt.plp"
-        rel="code" title="Written in Perl">plp</a>
-       <a href="http://git.shiar.nl/sheet.git/history/HEAD:/mutt.plp"
-        rel="vcs-git" title="Git repository"><:= $VERSION :></a>
-       created by <a href="http://shiar.nl/" rel="author">Shiar</a> <:= $sign{sep} :>
-       <a href="http://www.fsf.org/licensing/licenses/agpl-3.0.html" rel="copyright"
-        title="Licensed under the GNU Affero General Public License, version 3">AGPLv3</a>
-</p>
-
-</html>
index 8396edd162d29163ba2a9a8b1942c8f81441338c..eaea76c0af882c8b2de811123df90d61d24daaf5 100644 (file)
@@ -1,33 +1,21 @@
 <(common.inc.plp)><:
-       our $VERSION = 'v1.0';
 
-       use Shiar_Sheet::KeySigns qw(%sign);
+Html({
+       title => 'nethack cheat sheet',
+       version => 'v1.0',
+       description => [
+               "Keyboard overview sheet for the Nethack console RPG game,",
+               "describing the default controls.",
+       ],
+       keywords => [qw'
+               nethack rogue game control controls sheet reference overview keyboard
+       '],
+       charset => $sign{charset},
+       stylesheet => [qw'light dark circus mono red terse'],
+       keys => 1,
+});
 
-       $header{content_type} = "text/html; charset=$sign{charset}";
-
-:><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-<html lang="en">
-
-<head>
-<meta http-equiv="content-type" content="<:= $header{content_type} :>">
-<title>nethack cheat sheet</title>
-<meta name="description" content="Keyboard overview sheet for the Nethack console RPG game, describing the default controls.">
-<meta name="keywords" content="nethack, rogue, game, control, controls, sheet, reference, overview, keyboard">
-<:= stylesheet(qw'light dark circus mono red terse') :>
-<!--[if lte IE 6]><style> .help dl.legend dt {margin:0 0 1px} </style><![endif]-->
-<!--[if lte IE 7]><style> .help dl.legend dd {float:none} </style><![endif]--><:
-       our $showkeys = exists $get{keys} && $get{keys} ne '0';
-       print "\n".'<style type="text/css"> .no {visibility:hidden} </style>'
-               unless $showkeys;
-       print "\n".'<style type="text/css"> .no, .alias {opacity:.5} </style>'
-               if $showkeys and $get{keys} eq 'ghost';
 :>
-<link rel="icon" type="image/png" href="/clip.png">
-<script type="text/javascript" src="/keys.js"></script>
-
-<body id="nethack">
-
 <h1>NetHack cheat sheet</h1>
 
 <h2>normal gameplay</h2>
@@ -94,14 +82,3 @@ $keys->print_rows($get{rows} || '4321-421', [3,2,1,0]);
        </div>
 </div>
 
-<p class="footer">
-       <a href="/" rel="home">sheet.shiar.nl</a>/nethack.<a href="/source/nethack.plp"
-        rel="code" title="Written in Perl">plp</a>
-       <a href="http://git.shiar.nl/sheet.git/history/HEAD:/nethack.plp"
-        rel="vcs-git" title="Git repository"><:= $VERSION :></a>
-       created by <a href="http://shiar.nl/" rel="author">Shiar</a> <:= $sign{sep} :>
-       <a href="http://www.fsf.org/licensing/licenses/agpl-3.0.html" rel="copyright"
-        title="Licensed under the GNU Affero General Public License, version 3">AGPLv3</a>
-</p>
-
-</html>
index ded17093b70d6e9bc43a29b3e76f6dc2ae4c038d..cc70d05ff6c50227c618018f03a903c2d2d609f5 100644 (file)
@@ -1,33 +1,21 @@
 <(common.inc.plp)><:
-       our $VERSION = 'v1.0';
 
-       use Shiar_Sheet::KeySigns qw(%sign);  # dependant on $get{ascii}
+Html({
+       title => 'readline cheat sheet',
+       version => 'v1.0',
+       description => [
+               "Reference sheet of default key bindings for GNU readline,",
+               "used in line-editing in most Unix software, notably emacs and bash.",
+       ],
+       keywords => [qw'
+               readline gnu bash emacs sheet cheat reference overview keyboard editing curses
+       '],
+       charset => $sign{charset},
+       stylesheet => [qw'light dark circus mono red terse'],
+       keys => 1,
+});
 
-       $header{content_type} = "text/html; charset=$sign{charset}";
-
-:><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-<html lang="en">
-
-<head>
-<meta http-equiv="content-type" content="<:= $header{content_type} :>">
-<title>readline cheat sheet</title>
-<meta name="description" content="Reference sheet of default key bindings for GNU readline, used in line-editing in most Unix software, notably emacs and bash.">
-<meta name="keywords" content="readline, gnu, bash, emacs, sheet, cheat, reference, overview, keyboard, editing, curses">
-<:= stylesheet(qw'light dark circus mono red terse') :>
-<!--[if lte IE 6]><style> .help dl.legend dt {margin:0 0 1px} </style><![endif]-->
-<!--[if lte IE 7]><style> .help dl.legend dd {float:none} </style><![endif]--><:
-       our $showkeys = exists $get{keys} && $get{keys} ne '0';
-       print "\n".'<style type="text/css"> .no {visibility:hidden} </style>'
-               unless $showkeys;
-       print "\n".'<style type="text/css"> .no, .alias {opacity:.5} </style>'
-               if $showkeys and $get{keys} eq 'ghost';
 :>
-<link rel="icon" type="image/png" href="/clip.png">
-<script type="text/javascript" src="/keys.js"></script>
-
-<body id="readline">
-
 <h1>readline cheat sheet</h1>
 
 <h2>default emacs mode</h2>
@@ -95,14 +83,3 @@ $keys->print_rows($get{rows} || '^x=213', [4,3,2]);
        </div>
 </div>
 
-<p class="footer">
-       <a href="/" rel="home">sheet.shiar.nl</a>/readline.<a href="/source/readline.plp"
-        rel="code" title="Written in Perl">plp</a>
-       <a href="http://git.shiar.nl/sheet.git/history/HEAD:/readline.plp"
-        rel="vcs-git" title="Git repository"><:= $VERSION :></a>
-       created by <a href="http://shiar.nl/" rel="author">Shiar</a> <:= $sign{sep} :>
-       <a href="http://www.fsf.org/licensing/licenses/agpl-3.0.html" rel="copyright"
-        title="Licensed under the GNU Affero General Public License, version 3">AGPLv3</a>
-</p>
-
-</html>
index de3ad544c6d3067dffe9319ef5b0fa83c7a2a9e8..cdd40a1c72e86cfd30d7d726f749acfe0f60ebfa 100644 (file)
@@ -1,28 +1,22 @@
 <(common.inc.plp)><:
-       our $VERSION = 'v1.0';
 
-       my $source = $ENV{PATH_INFO};
-       $source =~ s{^/}{};
+my $source = $ENV{PATH_INFO};
+$source =~ s{^/}{};
 
-:><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-<html lang="en">
+Html({
+       title => "$source source code",
+       version => 'v1.0',
+       description => !$source ? 'Index of source files for this site.' : [
+               "Source code of local $source file,",
+               "with syntax highlighted and references linked."
+       ],
+       keywords => [qw'
+               sheet cheat source code perl plp html agpl
+       '],
+       stylesheet => [qw'light dark mono red'],
+});
 
-<head>
-<meta http-equiv="content-type" content="<:= $header{content_type} :>">
-<title><:= $source :> source code</title>
-<meta name="description" content="<:=
-       $source ? "Source code of local $source file"
-                 . ", with syntax highlighted and references linked."
-               : 'Index of source files for this site.'
-:>">
-<meta name="keywords" content="sheet, cheat, source, code, perl, plp, html, agpl">
-<:= stylesheet(qw'light dark mono red') :>
-<link rel="icon" type="image/png" href="/clip.png">
-</head>
-
-<body id="source">
-<:
+print "\n";
 
 if (not $source) {
        print "<h1>Source files</h1>";
@@ -84,16 +78,7 @@ else {
        else {
                print "<pre>\n", EscapeHTML(ReadFile($source)), "</pre>\n";
        }
+
+       print "\n";
 }
-:>
-<p class="footer">
-       <a href="/" rel="home">sheet.shiar.nl</a>/source.<a href="/source/source.plp"
-        rel="code" title="Written in Perl">plp</a>
-       <a href="http://git.shiar.nl/sheet.git/history/HEAD:/source.plp"
-        rel="vcs-git" title="Git repository"><:= $VERSION :></a>
-       created by <a href="http://shiar.nl/" rel="author">Shiar</a> •
-       <a href="http://www.fsf.org/licensing/licenses/agpl-3.0.html" rel="copyright"
-        title="Licensed under the GNU Affero General Public License, version 3">AGPLv3</a>
-</p>
 
-</html>
index 5a0306afc66c92727ea34ca7655a59dd0db03222..4b9103288e5643c4910815c01b334c7948c37d37 100644 (file)
@@ -1,22 +1,21 @@
 <(common.inc.plp)><:
-       our $VERSION = 'v1.0';
 
-       use List::Util 'min';
-
-:><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-<html lang="en">
+Html({
+       title => 'terminal colour cheat sheet',
+       version => 'v1.0',
+       description => [
+               "Index of all terminal/console colour codes,",
+               "with an example result of various environments.",
+       ],
+       keywords => [qw'
+               color code terminal console escape table xterm rxvt
+       '],
+       stylesheet => [qw'light dark'],
+});
 
-<head>
-<meta http-equiv="content-type" content="utf-8">
-<title>terminal colour cheat sheet</title>
-<meta name="description" content="Index of all terminal/console colour codes, with an example result of various environments.">
-<meta name="keywords" content="color, code, terminal, console, escape, table, xterm, rxvt">
-<:= stylesheet(qw'light dark') :>
-<link rel="icon" type="image/png" href="/clip.png">
-</head>
+use List::Util 'min';
 
-<body id="colour">
+:>
 <h1>Terminal colours</h1>
 
 <div class="section">
@@ -139,14 +138,3 @@ print "\n";
 <: } :>
 <hr>
 
-<p class="footer">
-       <a href="/" rel="home">sheet.shiar.nl</a>/termcol.<a href="/source/termcol.plp"
-        rel="code" title="Written in Perl">plp</a>
-       <a href="http://git.shiar.nl/sheet.git/history/HEAD:/termcol.plp"
-        rel="vcs-git" title="Git repository"><:= $VERSION :></a>
-       created by <a href="http://shiar.nl/" rel="author">Shiar</a> •
-       <a href="http://www.fsf.org/licensing/licenses/agpl-3.0.html" rel="copyright"
-        title="Licensed under the GNU Affero General Public License, version 3">AGPLv3</a>
-</p>
-
-</html>
index 51bf7c87f069931e660aaab24347c9dab9bc41f7..4a6856e817d84df1c22ba4a821726d74bebfd7be 100644 (file)
@@ -1,20 +1,19 @@
 <(common.inc.plp)><:
-       our $VERSION = 'v1.0';
 
-:><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-<html lang="en">
+Html({
+       title => 'unicode glyph cheat sheet',
+       version => 'v1.0',
+       description => [
+               "Common Unicode characters with digraph or code point, layed out for quick location.",
+               "Includes general signs, arrows, drawing characters, and IPA letters.",
+       ],
+       keywords => [qw'
+               unicode glyph char character reference common ipa sign mark table digraph
+       '],
+       stylesheet => [qw'light dark red'],
+});
 
-<head>
-<meta http-equiv="content-type" content="utf-8">
-<title>digraph cheat sheet</title>
-<meta name="description" content="Common Unicode characters with digraph or code point, layed out for quick location. Includes general signs, arrows, drawing characters, and IPA letters.">
-<meta name="keywords" content="unicode, glyph, char, character, reference, common, ipa, sign, mark, table, digraph">
-<:= stylesheet(qw'light dark red') :>
-<link rel="icon" type="image/png" href="/clip.png">
-</head>
-
-<body id="unicode">
+:>
 <h1>Common Unicode</h1>
 
 <p>i^k in <a href="/vi">Vim</a>.
@@ -277,14 +276,3 @@ $verbose ? (
        </table>
 </div>
 
-<p class="footer">
-       <a href="/" rel="home">sheet.shiar.nl</a>/unicode.<a href="/source/unicode.plp"
-        rel="code" title="Written in Perl">plp</a>
-       <a href="http://git.shiar.nl/sheet.git/history/HEAD:/unicode.plp"
-        rel="vcs-git" title="Git repository"><:= $VERSION :></a>
-       created by <a href="http://shiar.nl/" rel="author">Shiar</a> •
-       <a href="http://www.fsf.org/licensing/licenses/agpl-3.0.html" rel="copyright"
-        title="Licensed under the GNU Affero General Public License, version 3">AGPLv3</a>
-</p>
-
-</html>
diff --git a/vi.plp b/vi.plp
index fc5e194485e0e2196cba08f4d6bee375a77f9739..67326cb7fca7dd445ab5c68aec1b0fe34a3317e3 100644 (file)
--- a/vi.plp
+++ b/vi.plp
@@ -1,33 +1,21 @@
 <(common.inc.plp)><:
-       our $VERSION = 'v1.2';
 
-       use Shiar_Sheet::KeySigns qw(%sign);  # dependant on $get{ascii}
+Html({
+       title => 'vi cheat sheet',
+       version => 'v1.2',
+       description => [
+               "Interactive cheat sheet for vi text editors, notably Vim,",
+               "describing each key in various modes.",
+       ],
+       keywords => [qw'
+               vi vim nvi sheet cheat reference overview commands keyboard
+       '],
+       charset => $sign{charset},
+       stylesheet => [qw'light dark circus mono red terse'],
+       keys => 1,
+});
 
-       $header{content_type} = "text/html; charset=$sign{charset}";
-
-:><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-<html lang="en">
-
-<head>
-<meta http-equiv="content-type" content="<:= $header{content_type} :>">
-<title>vi cheat sheet</title>
-<meta name="description" content="Interactive cheat sheet for vi text editors, notably Vim, describing each key in various modes.">
-<meta name="keywords" content="vi, vim, nvi, sheet, cheat, reference, overview, commands, keyboard">
-<:= stylesheet(qw'light dark circus mono red terse') :>
-<!--[if lte IE 6]><style> .help dl.legend dt {margin:0 0 1px} </style><![endif]-->
-<!--[if lte IE 7]><style> .help dl.legend dd {float:none} </style><![endif]--><:
-       our $showkeys = exists $get{keys} && $get{keys} ne '0';
-       print "\n".'<style type="text/css"> .no {visibility:hidden} </style>'
-               unless $showkeys;
-       print "\n".'<style type="text/css"> .no, .alias {opacity:.5} </style>'
-               if $showkeys and $get{keys} eq 'ghost';
 :>
-<link rel="icon" type="image/png" href="/clip.png">
-<script type="text/javascript" src="/keys.js"></script>
-
-<body id="vi">
-
 <h1>vi/vim cheat sheet</h1>
 
 <h2>normal mode (default)</h2>
@@ -93,21 +81,10 @@ $keys->print_rows($get{rows});
                                $sign{-ascii} ? 'on' : 'off' :></em>
                <li><strong>keys</strong> are
                        <em><:= $showkeys ? 'always shown' : 'hidden if unassigned' :></em><:=
-                               !exists $get{keys} && ' by default' :>
+                               !defined $showkeys && ' by default' :>
                <li>default <strong>style</strong> is
                        <:= defined $get{style} && 'set to ' :><em><:= $style :></em>
                </ul>
        </div>
 </div>
 
-<p class="footer">
-       <a href="/" rel="home">sheet.shiar.nl</a>/vi.<a href="/source/vi.plp"
-        rel="code" title="Written in Perl">plp</a>
-       <a href="http://git.shiar.nl/sheet.git/history/HEAD:/vi.plp"
-        rel="vcs-git" title="Git repository"><:= $VERSION :></a>
-       created by <a href="http://shiar.nl/" rel="author">Shiar</a> <:= $sign{sep} :>
-       <a href="http://www.fsf.org/licensing/licenses/agpl-3.0.html" rel="copyright"
-        title="Licensed under the GNU Affero General Public License, version 3">AGPLv3</a>
-</p>
-
-</html>
index 7b02c535fabd45efa8b407be4b4d638df5a5b9cc..88f5e9518a05240efc7185705bba16a4564a02ac 100644 (file)
@@ -1,33 +1,22 @@
 <(common.inc.plp)><:
-       our $VERSION = 'v1.0';
 
-       use Shiar_Sheet::KeySigns qw(%sign);
+Html({
+       title => 'vimperator cheat sheet',
+       version => 'v1.0',
+       description => [
+               "Interactive cheat sheet for the Vimperator Firefox extension,",
+               "describing the function of each key.",
+       ],
+       keywords => [qw'
+               vimperator firefox vim iceweasel sheet cheat reference overview
+               commands keyboard browser
+       '],
+       charset => $sign{charset},
+       stylesheet => [qw'light dark circus mono red terse'],
+       keys => 1,
+});
 
-       $header{content_type} = "text/html; charset=$sign{charset}";
-
-:><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-<html lang="en">
-
-<head>
-<meta http-equiv="content-type" content="<:= $header{content_type} :>">
-<title>vimperator cheat sheet</title>
-<meta name="description" content="Interactive cheat sheet for the Vimperator Firefox extension, describing the function of each key.">
-<meta name="keywords" content="vimperator, firefox, vim, iceweasel, sheet, cheat, reference, overview, commands, keyboard, browser">
-<:= stylesheet(qw'light dark circus mono red terse') :>
-<!--[if lte IE 6]><style> .help dl.legend dt {margin:0 0 1px} </style><![endif]-->
-<!--[if lte IE 7]><style> .help dl.legend dd {float:none} </style><![endif]--><:
-       our $showkeys = exists $get{keys} && $get{keys} ne '0';
-       print "\n".'<style type="text/css"> .no {visibility:hidden} </style>'
-               unless $showkeys;
-       print "\n".'<style type="text/css"> .no, .alias {opacity:.5} </style>'
-               if $showkeys and $get{keys} eq 'ghost';
 :>
-<link rel="icon" type="image/png" href="/clip.png">
-<script type="text/javascript" src="/keys.js"></script>
-
-<body id="vimperator">
-
 <h1>Vimperator cheat sheet</h1>
 
 <h2>normal mode (default)</h2>
@@ -98,14 +87,3 @@ $keys->print_rows($get{rows});
        </div>
 </div>
 
-<p class="footer">
-       <a href="/" rel="home">sheet.shiar.nl</a>/vimperator.<a href="/source/vimperator.plp"
-        rel="code" title="Written in Perl">plp</a>
-       <a href="http://git.shiar.nl/sheet.git/history/HEAD:/vimperator.plp"
-        rel="vcs-git" title="Git repository"><:= $VERSION :></a>
-       created by <a href="http://shiar.nl/" rel="author">Shiar</a> <:= $sign{sep} :>
-       <a href="http://www.fsf.org/licensing/licenses/agpl-3.0.html" rel="copyright"
-        title="Licensed under the GNU Affero General Public License, version 3">AGPLv3</a>
-</p>
-
-</html>