writing: common method to display (univer) legend
authorMischa POSLAWSKY <perl@shiar.org>
Sun, 23 Apr 2017 18:59:28 +0000 (20:59 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Thu, 25 May 2017 20:13:06 +0000 (22:13 +0200)
Shiar_Sheet/FormatChar.pm
apl.plp
writing.plp

index 0a8a50a0876560bfa954c16d1a16b5d9160005e3..6772dfceeb55455d252ab3d98dbcca1d9efda9be 100644 (file)
@@ -274,5 +274,22 @@ sub print {
        }
 }
 
        }
 }
 
+sub legend {
+       my @classes = (
+               ["X l5" => 'unicode 1.1'],
+               ["X l4" => '20th century'],
+               ["X l3" => 'in 6.0 (2010)'],
+               ["X l2" => 'recent assignments'],
+               ["X l1" => 'proposed'],
+               ["ex"   => 'irregular'],
+       );
+
+       return (
+               '<div class="legend"><table class="glyphs"><tr>',
+               (map { sprintf '<td class="%s">%s', @{$_} } @classes),
+               '</table></div>',
+       );
+}
+
 1;
 
 1;
 
diff --git a/apl.plp b/apl.plp
index ba51a112f10e2cef917e8752f7ce8082b7651dd6..9ca99701ff2ff92f9f32176dbb1b12cdfeb24aef 100644 (file)
--- a/apl.plp
+++ b/apl.plp
@@ -80,16 +80,6 @@ for my $op (@ops) {
 :></table>
 </div>
 
 :></table>
 </div>
 
-<hr>
-
-<div class="legend">
-       <table class="glyphs"><tr>
-       <td class="X l5">unicode 1.1
-       <td class="X l4">20th century
-       <td class="X l3">in 6.0 (2010)
-       <td class="X l2">recent assignments
-       <td class="X l1">proposed
-       <td class="ex">irregular
-       </table>
-</div>
+<:
+say for '<hr/>', $glyphs->legend;
 
 
index ee2d825e153f83203acaf74c49d7861a24557c28..2f08da63a3cd18d486fd7ccd97cc24eb24c85251 100644 (file)
@@ -56,18 +56,7 @@ for (
        } @table]);
 }
 
        } @table]);
 }
 
-:></div>
+say "</div>\n";
 
 
-<hr>
-
-<div class="legend">
-       <table class="glyphs"><tr>
-       <td class="X l5">unicode 1.1
-       <td class="X l4">20th century
-       <td class="X l3">in 6.0 (2010)
-       <td class="X l2">recent assignments
-       <td class="X l1">proposed
-       <td class="ex">irregular
-       </table>
-</div>
+say for '<hr/>', $glyphs->legend;