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',
$templates{$_} .= footer $_ for keys %templates;
sub generate{
- my $template = $templates{$_[1]};
+ my ($path, $lang) = @_;
+ $path =~ s,/index\.html$,,;
+ my $template = $templates{$lang};
my $htc = HTML::Template::Compiled->new(scalarref => \$template);
- IO::File->new('>pb/meta.yml')->close unless -f 'pb/meta.yml';
- flock my $metafh = IO::File->new('<pb/meta.yml'), LOCK_SH;
+ IO::File->new(">$path/meta.yml")->close unless -f "$path/meta.yml";
+ flock my $metafh = IO::File->new("<$path/meta.yml"), LOCK_SH;
my @problems = sort { $b->{name} cmp $a->{name} } map {
my $meta = LoadFile $_;
- my $id = (m,^pb/(.*)/meta.yml$,)[0];
- +{ id => $id, name => $meta->{name} } } <pb/*/meta.yml>;
+ my $id = (m,^$path/(.*)/meta.yml$,)[0];
+ +{ id => $id, name => $meta->{name} } } <$path/*/meta.yml>;
$htc->param(problems => \@problems);
$htc->output
}