padding-bottom: 1.1ex; /* reserve space for label */
vertical-align: bottom;
}
-.glyphs small {
+.glyphs.dilabel small {
font-size: 50%;
display: block;
margin-top: 0.2ex;
margin-bottom: -2.2ex; /* take cell padding */
}
-.glyphs small.digraph {
+.glyphs.dilabel small.digraph {
background: #000;
color: #FFF;
opacity: 0.3;
}
-.glyphs small.value {
+.glyphs.dilabel small.value {
background: #600;
color: #FFF;
opacity: 0.3;
for my $row (@request) {
my $colsize = $row->{cell} && $row->{cell}->{colsize} || 1;
+ my $coldigits = ceil(log($colsize * $cols) / log(16)); # uniform length of hexadecimal header
+ my $rowdiv = 16 ** $coldigits; # divider of row headers
+
printf '<div class="section"><table class="glyphs%s">', !$row->{cell} && ' charmap';
my $title = $row->{set};
$title .= " <aside>($_)</aside>" for $row->{setnote} // ();
printf '<caption>%s</caption>', $title;
print '<col>' x ($cols + 1);
- my $coldigits = ceil(log($colsize * $cols) / log(16)); # uniform length of hexadecimal header
for my $section (qw{thead}) {
print "<$section><tr><th>↱";
printf '<th>%0*X', $coldigits, $_ * $colsize for 0 .. $cols - 1;
}
print '<tbody>';
for my $msb (0 .. ((length($row->{table}) || 256) - 1) / $cols) {
- printf '<tr><th>%X', ($msb + int($row->{offset} / $cols)) * $cols * $colsize;
+ print '<tr><th>';
+ {
+ my $rowlabel = ($msb + int($row->{offset} / $cols)) * $cols * $colsize;
+ if (my $rowmod = $rowlabel % $rowdiv) {
+ # offset in column units
+ printf '<small>+%X</small>', $rowmod;
+ }
+ else {
+ # divided row offset
+ printf '%X', $rowlabel / $rowdiv;
+ }
+ }
for my $lsb (0 .. $cols - 1) {
my $val = ( ($msb * $cols) + $lsb ) * $colsize;
if ($row->{cell}) {