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',
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;