latin: single cell for identical i/j columns
authorMischa POSLAWSKY <perl@shiar.org>
Sun, 2 Apr 2017 14:35:26 +0000 (16:35 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 24 Apr 2017 18:25:54 +0000 (20:25 +0200)
Support ">" mark to indicate colspan similar to unicode tables
(Shiar_Sheet::FormatChar->row).

latin.plp
writing-latn.inc.pl

index 4326f550f8cb6d26f2224bb7e71000579f1acbe9..671d6d7603bc206186d79a7f8846034eff472d59 100644 (file)
--- a/latin.plp
+++ b/latin.plp
@@ -67,7 +67,20 @@ else {
                my ($title, $cells) = @{$row};
                printf '<tr id="%s">', (lc $title) =~ s/<[^>]+>//gr =~ s/\s+/-/gr;
                say '<th>', $title;
-               say "\t", '<td>' x !/^<td/, $_ for @{$cells};
+               my $colspan = 1;
+               for (@{$cells}) {
+                       if ($_ eq '>') {
+                               $colspan++;
+                               next;
+                       }
+                       print "\t<td";
+                       if ($colspan > 1) {
+                               print " colspan=$colspan";
+                               $colspan = 1;
+                       }
+                       print '>' unless s/^<td//;
+                       say;
+               }
        }
        say "</table>\n";
 }
index e7a418dd753ea710b3593afc509298c496552aa5..944dd52260c2a6a8b6c559f55865989b0fba4076 100644 (file)
@@ -2,7 +2,7 @@ use utf8;
 
 sub disptap {
        return map {
-               m/\A(-?)(\d)(\d)/;
+               !m/\A(-?)(\d)(\d)/ ? $_ :
                sprintf('<td%s>%s<br>%s',
                        ' class=ex' x !!$1,
                        '·' x $2, '·' x $3,
@@ -17,7 +17,7 @@ my %C = qw(red #EC1C24  blue #3953A3  yellow #F9EC31  black #231F20);
 'Lowercase' => [qw{ a b c d e f g h i j k l m n o p q r s t u v w x y z }],
 'Sütterlin' => [qw{ a b c d e f g h i j k l m n o p q r ſ s t u v w x y z }],
 'Old Roman Cursive' => [
-       map { $_ && '<svg width="20" height="20" viewBox="5 225 28 45"><path d="'.$_.'"/></svg>' || '' }
+       map { /^\w/ ? '<svg width="20" height="20" viewBox="5 225 28 45"><path d="'.$_.'"/></svg>' : $_ }
        "m 9.7966963,233.64839 c 1.9349047,4.6581 17.4141427,19.56404 17.4141427,19.56404 M 8.8650753,258.0405 17.679641,245.75946",
        "m 8.2859683,233.93504 c 0,0 6.5438297,-3.56736 8.4562497,2.86653 1.38905,4.67312 0.39098,21.06633 6.59301,19.20572 2.86653,-0.85996 4.58644,-3.00985 4.58644,-3.00985 m -14.84083,-3.65482 c -11.2172001,9.19952 -0.12626,13.80702 1.43325,7.02298",
        "m 14.579584,240.38472 8.45625,-4.87309 m -9.17289,8.7429 c 0,0 -4.1564597,16.15085 6.01971,13.47267",
@@ -38,9 +38,9 @@ my %C = qw(red #EC1C24  blue #3953A3  yellow #F9EC31  black #231F20);
        "m 4.8655023,238.74889 c 6.0808197,-2.43234 6.4862097,-2.83773 12.9724097,0.40538 4.78633,2.39317 7.29698,6.89161 13.3778,3.24311 m -15.20204,-3.4458 -5.47274,24.93136",
        "m 34.256454,230.64113 c 0,0 -10.58398,5.28535 -17.9029,8.81482 -3.67044,7.38064 -2.15569,11.07749 -5.4069,20.37311 -1.1252097,3.21711 -9.12123,4.25657 -9.12123,4.25657",
        "m 16.823534,243.81623 c 0,0 -1.62155,18.24246 5.87812,11.55356 M 8.3103943,240.37044 27.769014,239.96505",
+       '>',
        "m 9.0086423,236.11386 c 0,0 6.6888997,11.14817 12.7697197,6.28352 6.08082,-4.86466 5.27005,-6.08082 5.27005,-6.08082",
        '',
-       '',
        "m 11.948695,268.77453 c -1.62156,-14.39127 13.58049,-39.32263 13.58049,-39.32263 M 6.8813453,243.84317 c 0.20269,1.01347 22.2963397,2.83772 22.2963397,2.83772",
        "m 4.9289653,239.8092 c 4.44908,-7.43435 11.3160897,-5.14113 12.3295597,2.96663 l 0.20269,23.71519 c 0,0 -0.10134,-9.32393 -0.12668,-23.2338 -0.0163,-8.91571 9.90666,-8.94388 13.80852,-6.05549",
        "m 12.020439,237.63036 c 9.02956,-1.71991 6.59301,5.87638 6.59301,5.87638 -1.78773,5.95591 -3.91891,10.78875 -1.86323,12.18274 2.70729,1.83586 7.30963,0.28664 7.30963,0.28664",
@@ -76,11 +76,11 @@ my %C = qw(red #EC1C24  blue #3953A3  yellow #F9EC31  black #231F20);
        -. --- .--. --.- .-. ... - ..- ...- .-- -..- -.-- --..
 }],
 'Tap code' => [disptap(qw{
-       11 12 13 14 15 21 22 23 24 -24 25 31 32
+       11 12 13 14 15 21 22 23  > 24 25 31 32
        33 34 35 41 42 43 44 45 51 52 53 54 55
 })],
 'Tap simplified' => [disptap(qw{
-       11 12 13 14 21 22 23 20 31 -31 -13 32 33
+       11 12 13 14 21 22 23 20 31 -13 32 33
        30 41 42 -13 43 40 10 51 52 53 50 -31 -40
 })],
 'Maritime flags' => [
@@ -195,7 +195,7 @@ my %C = qw(red #EC1C24  blue #3953A3  yellow #F9EC31  black #231F20);
 'Chappe semaphore' => [
        map {
                my ($r, $pr, $pl) = split //, $_;
-               !$_ ? '-' : sprintf(
+               /^\D$/ ? $_ : sprintf(
                        join('',
                                '<svg width="20" height="20" viewBox="0 0 10 15">',
                                '<path d="M5,6 v7"/>',
@@ -210,12 +210,12 @@ my %C = qw(red #EC1C24  blue #3953A3  yellow #F9EC31  black #231F20);
        # 360° rotation (0-7) and position state (0-2) of left and right bars
        qw(
          021 121 221 321 421 521 621 721
-         022 022 122 222 322 011 111 211 311
+         > 022 122 222 322 011 111 211 311
          001 101 201 301 401 501 601 701 020
        )
 ],
 'Prussian semaphore' => [
-       map { !$_ ? '-' : sprintf
+       map { /^\D+$/ ? $_ : sprintf
                join('',
                        '<svg width="20" height="20" viewBox="0 0 8 18">',
                        '<path d="M4,1 v18"/>',
@@ -229,7 +229,7 @@ my %C = qw(red #EC1C24  blue #3953A3  yellow #F9EC31  black #231F20);
        }
        # rotation state (0-3) for left and right bar of 3 rows
        qw(
-               003000 000200 203300 000030 033030 000130 000330 032330 031330 031330
+               003000 000200 203300 000030 033030 000130 000330 032330 > 031330
                022020 130120 001320 233010 030210 022310 203001 233001
                131001 231301 000202 023302 230003 032003 201003 101003
        )