- $inc =~ s/\Q.inc.pl\E$//;
- print '<figure>';
- printf '<a href="/%s">', $inc =~ s/\.eng$//r;
- if (my $table = eval { Data($inc) }) {
- printf '<img src="/%s" />', $_ for $table->{image} || ();
- $inc = $table->{title};
+ my $table = $idx->{$inc};
+ print @sample ? '<tr><th>' : '<figure>';
+ printf '<a href="/%s">', "$dirbase/$inc";
+ my $title = $table->{title} || $inc;
+
+ unless (@sample) {
+ if (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>', "\n\t";
+ for my $mode ($table->{mode} ? sort keys %{ $table->{mode} } : '') {
+ print '<span class=graph>';
+ printf "<label>%s</label>", m/^(\S*)/
+ for $mode && $table->{mode}{$mode} || ();
+ for my $g (sort keys %{ $table->{inventory}{$mode} }) {
+ printf '<span class="%s" style="width:%.0f%%" title="%3$d %4$s"> %s</span>',
+ $g, $_/$most*100, $_,
+ join(' ', map {
+ $table->{flag}{$_}[0] || 'extra' # legend label of each class
+ } reverse split / /, $g)
+ for $table->{inventory}{$mode}{$g};
+ }
+ say '</span>';
+ }
+ print "\t<td class=ni>";
+ print join ' ', map { $caticon{$_} // () }
+ split m{/}, $table->{category} // '';
+ say '';
+ if (my $keys = eval {
+ my $keydata = Data("$dirbase/$inc.eng");
+ Shiar_Sheet::Keyboard->new($keydata)
+ }) {
+ for my $c (@sample) {
+ my $def = $keys->{def}{''}{$c} // [];
+ $def->[0] //= 'ni';
+ $def->[0] =~ s/ mode\S*//;
+ $keys->print_key('', $c, $def);
+ }
+ }
+ say '</tr>';