]> iEval git - gruntmaster-page.git/blobdiff - lib/Gruntmaster/Page/Pb.pm
Add contest/multispace support
[gruntmaster-page.git] / lib / Gruntmaster / Page / Pb.pm
index efe7d26a42d986dbde5dc51b9add82aca7b91c24..de9db879d98e3cea0171240c8d906e3410e68cc4 100644 (file)
@@ -28,14 +28,16 @@ $templates{$_}  = header($_, TITLE) . $templates{$_} for keys %templates;
 $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
 }
This page took 0.030438 seconds and 4 git commands to generate.