X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FGruntmaster%2FPage%2FPb.pm;h=18b47bf894710cb8449ba68910592c7a1a266004;hb=4aa8ba862bf3a79362df73c3d1e8707e8135af23;hp=170f03f42d2b020235fe1924c62a2f6f0a9db3d0;hpb=cd9af27e94244e6454c3db787a8ca6811f44fc16;p=plack-app-gruntmaster.git diff --git a/lib/Gruntmaster/Page/Pb.pm b/lib/Gruntmaster/Page/Pb.pm index 170f03f..18b47bf 100644 --- a/lib/Gruntmaster/Page/Pb.pm +++ b/lib/Gruntmaster/Page/Pb.pm @@ -7,50 +7,48 @@ use parent qw/Exporter/; our @EXPORT_OK = qw/generate/; our $VERSION = '0.001'; -use constant TITLE => 'Problems'; - use Fcntl qw/:flock/; use HTML::Template::Compiled; use IO::File; use POSIX qw/strftime/; -use Gruntmaster::Page::Common qw/header footer/; +use Gruntmaster::Page::Common qw/cook_templates reload_templates/; use Gruntmaster::Data qw/problem_name problem_level problems/; -my %templates = ( +my %orig_templates = ( en => <<'HTML',

Beginner

Easy

Medium

Hard

HTML ); -$templates{$_} = header($_, TITLE) . $templates{$_} for keys %templates; -$templates{$_} .= footer $_ for keys %templates; +my %templates = cook_templates %orig_templates, pb => 'Problems'; sub generate{ + %templates = cook_templates %orig_templates, pb => 'Problems' if reload_templates; $_[0] =~ m,^(?:ct/([^/]+)/)?pb/index.html$,; local $Gruntmaster::Data::contest = $1;