-
Changes
+gruntmaster-genallpages
gruntmaster-genpage
+lib/Gruntmaster/Page/Common.pm
+lib/Gruntmaster/Page/Ct/Entry.pm
+lib/Gruntmaster/Page/Ct.pm
lib/Gruntmaster/Page/Index.pm
lib/Gruntmaster/Page/Log/Entry.pm
lib/Gruntmaster/Page/Log.pm
use strict;
use warnings;
use parent qw/Exporter/;
-our @EXPORT_OK = qw/generate header footer/;
+our @EXPORT_OK = qw/generate/;
use File::Basename qw/fileparse/;
use File::Slurp qw/write_file/;
txt => 'text/plain; charset=UTF-8',
};
-my %header_templates = (
- en => <<'HTML',
-<!DOCTYPE html>
-<title>TITLE_GOES_HERE</title>
-<link rel="stylesheet" href="/gm.css">
-<script src="/jquery-2.0.3.min.js"></script>
-<script src="/view.js"></script>
-<meta charset="utf-8">
-
-<span id="admin"></span>
-<div id="title"><span class="i">i</span><span class="Eval">Eval</span></div>
-<div id="subtitle">TITLE_GOES_HERE</div>
-
-<nav><ul><li><a href="/">Home</a><li><a href="/log/">View job log</a><li><a href="/submit.var">Submit job</a><li><a href="/pb/">Problem list</a><li><a href="/ct/">Contests</a></ul></nav>
-
-HTML
-);
-
-my %footer_templates = (
- en => <<'HTML',
-
-<footer>
-Dilmom: Why don't you call your product the Gruntmaster 6000?
-Dilbert: What kind of product do you see when you imagine a Gruntmaster 6000?
-Dilmom: Well, it's a stripped-down version of the Gruntmaster 9000, of course. But it's software-upgradeable.
-</footer>
-HTML
-);
-
-sub header{
- my ($language, $title) = @_;
- $header_templates{$language} =~ s/TITLE_GOES_HERE/$title/ger;
-}
-
-sub footer{
- $footer_templates{$_[0]};
-}
-
sub declaregen{
my ($generator, $regex) = @_;
$generator = "Gruntmaster::Page::$generator";
--- /dev/null
+package Gruntmaster::Page::Common;
+
+use 5.014000;
+use strict;
+use warnings;
+use parent qw/Exporter/;
+our @EXPORT_OK = qw/header footer/;
+
+my %header_templates = (
+ en => <<'HTML',
+<!DOCTYPE html>
+<title>TITLE_GOES_HERE</title>
+<link rel="stylesheet" href="/gm.css">
+<script src="/jquery-2.0.3.min.js"></script>
+<script src="/view.js"></script>
+<meta charset="utf-8">
+
+<span id="admin"></span>
+<div id="title"><span class="i">i</span><span class="Eval">Eval</span></div>
+<div id="subtitle">TITLE_GOES_HERE</div>
+
+<nav><ul><li><a href="/">Home</a><li><a href="/log/">View job log</a><li><a href="/submit.var">Submit job</a><li><a href="/pb/">Problem list</a><li><a href="/ct/">Contests</a></ul></nav>
+
+HTML
+);
+
+my %footer_templates = (
+ en => <<'HTML',
+
+<footer>
+Dilmom: Why don't you call your product the Gruntmaster 6000?
+Dilbert: What kind of product do you see when you imagine a Gruntmaster 6000?
+Dilmom: Well, it's a stripped-down version of the Gruntmaster 9000, of course. But it's software-upgradeable.
+</footer>
+HTML
+);
+
+sub header{
+ my ($language, $title) = @_;
+ $header_templates{$language} =~ s/TITLE_GOES_HERE/$title/ger;
+}
+
+sub footer{
+ $footer_templates{$_[0]};
+}
+
+1;
use IO::File;
use POSIX qw/strftime/;
use YAML::Any qw/LoadFile/;
-use Gruntmaster::Page qw/header footer/;
+use Gruntmaster::Page::Common qw/header footer/;
my %templates = (
en => <<'HTML',
use YAML::Any qw/LoadFile/;
use File::Basename qw/fileparse/;
use File::Slurp qw/slurp/;
-use Gruntmaster::Page qw/header footer/;
+use Gruntmaster::Page::Common qw/header footer/;
use constant TITLE => '<tmpl_var name>';
use Fcntl qw/:flock/;
use HTML::Template::Compiled;
use IO::File;
-use Gruntmaster::Page qw/header footer/;
+use Gruntmaster::Page::Common qw/header footer/;
my %templates = (
en => <<'HTML',
use IO::File;
use POSIX qw/strftime/;
use YAML::Any qw/LoadFile/;
-use Gruntmaster::Page qw/header footer/;
+use Gruntmaster::Page::Common qw/header footer/;
my %templates = (
en => <<'HTML',
use IO::File;
use POSIX qw/strftime/;
use YAML::Any qw/LoadFile/;
-use Gruntmaster::Page qw/header footer/;
+use Gruntmaster::Page::Common qw/header footer/;
my %templates = (
en => <<'HTML',
use IO::File;
use POSIX qw/strftime/;
use YAML::Any qw/LoadFile/;
-use Gruntmaster::Page qw/header footer/;
+use Gruntmaster::Page::Common qw/header footer/;
my %templates = (
en => <<'HTML',
use YAML::Any qw/LoadFile/;
use File::Basename qw/fileparse/;
use File::Slurp qw/slurp/;
-use Gruntmaster::Page qw/header footer/;
+use Gruntmaster::Page::Common qw/header footer/;
use constant FORMATS => [qw/CPP/];
use constant TITLE => '<tmpl_var name>';
use HTML::Template::Compiled;
use IO::File;
use YAML::Any qw/LoadFile/;
-use Gruntmaster::Page qw/header footer/;
+use Gruntmaster::Page::Common qw/header footer/;
my %templates = (
en => <<'HTML',