git.shiar.nl
/
sheet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
2337f25
)
charset: divide and append row offset label
author
Mischa POSLAWSKY
<perl@shiar.org>
Wed, 5 Apr 2017 23:48:37 +0000
(
01:48
+0200)
committer
Mischa POSLAWSKY
<perl@shiar.org>
Mon, 24 Apr 2017 23:51:42 +0000
(
01:51
+0200)
base.css
patch
|
blob
|
history
charset.plp
patch
|
blob
|
history
diff --git
a/base.css
b/base.css
index d014b6197f56bacdadc3989a454b75b1790eb994..f3c0355b16763d30465d405a275ef40c7925f2c7 100644
(file)
--- a/
base.css
+++ b/
base.css
@@
-354,18
+354,18
@@
table.dimap {
padding-bottom: 1.1ex; /* reserve space for label */
vertical-align: bottom;
}
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 */
}
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;
}
background: #000;
color: #FFF;
opacity: 0.3;
}
-.glyphs small.value {
+.glyphs
.dilabel
small.value {
background: #600;
color: #FFF;
opacity: 0.3;
background: #600;
color: #FFF;
opacity: 0.3;
diff --git
a/charset.plp
b/charset.plp
index 118658569014cd082cc4f2e532678d6052f78867..73b37407b2ff71ecce5fd84f1d526c8aa823caaa 100644
(file)
--- a/
charset.plp
+++ b/
charset.plp
@@
-158,12
+158,14
@@
sub range_cell {
for my $row (@request) {
my $colsize = $row->{cell} && $row->{cell}->{colsize} || 1;
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);
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;
for my $section (qw{thead}) {
print "<$section><tr><th>↱";
printf '<th>%0*X', $coldigits, $_ * $colsize for 0 .. $cols - 1;
@@
-171,7
+173,18
@@
for my $row (@request) {
}
print '<tbody>';
for my $msb (0 .. ((length($row->{table}) || 256) - 1) / $cols) {
}
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}) {
for my $lsb (0 .. $cols - 1) {
my $val = ( ($msb * $cols) + $lsb ) * $colsize;
if ($row->{cell}) {