X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FGruntmaster%2FPage%2FCommon.pm;h=65cf53c334777f90fea6f96659d80fa75621a1e8;hb=6d78fc24dc7d6e7cdc9edfec73fa6f269f91b5eb;hp=258f7e753bcf9537d5825dd8a2704fc852275995;hpb=e5a94ee5c11e9e9045a70ae2d33aa039b2259f35;p=plack-app-gruntmaster.git diff --git a/lib/Gruntmaster/Page/Common.pm b/lib/Gruntmaster/Page/Common.pm index 258f7e7..65cf53c 100644 --- a/lib/Gruntmaster/Page/Common.pm +++ b/lib/Gruntmaster/Page/Common.pm @@ -4,7 +4,9 @@ use 5.014000; use strict; use warnings; use parent qw/Exporter/; -our @EXPORT_OK = qw/header footer/; +our @EXPORT_OK = qw/header footer patch_templates/; + +use File::Slurp qw/read_file/; my %header_templates = ( en => <<'HTML', @@ -35,6 +37,18 @@ Dilmom: Well, it's a stripped-down version of the Gruntmaster 9000, of course. B HTML ); +sub patch_templates (\%$){ + my $root = $ENV{GRUNTMASTER_TEMPLATE_ROOT} or return; + my ($templates, $name) = @_; + for (<$root/$name*>) { + m/\.(.+)$/; + $templates->{$1} = read_file $_ + } +} + +patch_templates %header_templates, 'header'; +patch_templates %footer_templates, 'footer'; + sub header{ my ($language, $title) = @_; $header_templates{$language} =~ s/TITLE_GOES_HERE/$title/ger;