]> iEval git - gruntmaster-page.git/blobdiff - lib/Gruntmaster/Page/St.pm
Centralize template cooking and introduce reloadable templates
[gruntmaster-page.git] / lib / Gruntmaster / Page / St.pm
index e5b418d26a7844767e06c053b8d5ac05175720dd..e3873ba51b418de037516ca24a52b7470f898757 100644 (file)
@@ -7,15 +7,13 @@ use parent qw/Exporter/;
 our @EXPORT_OK = qw/generate/;
 our $VERSION = '0.001';
 
-use constant TITLE => 'Standings';
-
 use HTML::Template::Compiled;
 use List::Util qw/sum/;
 use POSIX qw/strftime/;
-use Gruntmaster::Page::Common qw/header footer/;
+use Gruntmaster::Page::Common qw/cook_templates reload_templates/;
 use Gruntmaster::Data qw/problems jobcard job_result_text job_result job_problem job_user/;
 
-my %templates = (
+my %orig_templates = (
        en => <<'HTML',
 <table border>
 <thead>
@@ -29,10 +27,10 @@ my %templates = (
 HTML
 );
 
-$templates{$_}  = header($_, TITLE) . $templates{$_} for keys %templates;
-$templates{$_} .= footer $_ for keys %templates;
+my %templates = cook_templates %orig_templates, st => 'Standings';
 
 sub generate{
+       %templates = cook_templates %orig_templates, st => 'Standings' if reload_templates;
        local $Gruntmaster::Data::contest = ($_[0] =~ m,^ct/([^/]+)/,)[0];
        my $htc = HTML::Template::Compiled->new(scalarref => \$templates{$_[1]});
 
This page took 0.023245 seconds and 4 git commands to generate.