my %templates = (
en => <<'HTML',
+<tmpl_if levels>
<h2>Beginner</h2>
<ul>
<tmpl_loop beginner><li><a href="<tmpl_var id>"><tmpl_var name></a>
<ul>
<tmpl_loop hard><li><a href="<tmpl_var id>"><tmpl_var name></a>
</tmpl_loop></ul>
+
+<tmpl_else>
+<ul>
+<tmpl_loop problems><li><a href="<tmpl_var id>"><tmpl_var name></a>
+</tmpl_loop></ul>
+</tmpl_if>
HTML
);
my $id = (m,^$path/(.*)/meta.yml$,)[0];
+{ id => $id, name => $meta->{name}, level => $meta->{level} } } <$path/*/meta.yml>;
for my $d(qw/beginner easy medium advanced hard/) {
- $htc->param($d => [grep {$_->{level} eq $d} @problems]);
+ $htc->param($d => [grep {$_->{level} and $_->{level} eq $d} @problems]);
}
+ $htc->param(levels => grep { $_->{level} } @problems);
+ $htc->param(problems => \@problems);
$htc->output
}