- if (my $table = eval { Data($inc) }) {
- printf '<img src="/%s" />', $_ for $table->{image} || ();
- $inc = $table->{title};
+ my $table = $idx{$inc};
+ my $title = $table && $table->{title} || $inc;
+
+ unless (@sample) {
+ if ($table and my $img = $table->{image}) {
+ EscapeHTML $name = $table->{imagealt} // $img =~ m{.*/([^/.]*)};
+ print qq{<img src="/$img" alt="$name" />};
+ }
+ printf '<figcaption>%s</figcaption>', $title;
+ say '</a></figure>';
+ }
+ else {
+ print $title;
+ print '</a>';
+ my $keys = Shiar_Sheet::Keyboard->new($table);
+ print join(' ', map { $keys->{key}{$_} =~ s/\s.*//r } grep {$_} keys %{$_})
+ for $keys->{mode} || ();
+ say '<dd><table class="keys big"><tr>';
+ $keys->print_key('', $_, $keys->{def}{''}{$_} // 'ni') for @sample;
+ print '</tr></table>';
+ say '</dd>';