word: identify rows by id number
[sheet.git] / word.plp
index 1af9c75cc9075bc496d739b688f57a444552c270..78e46a573afb3806fc59b39b6512438554345b28 100644 (file)
--- a/word.plp
+++ b/word.plp
@@ -55,19 +55,19 @@ sub showimg {
 sub printimgs {
        say '<ul>';
        for my $row (@_) {
-               my ($level, $mark, $title) = split /([a-z]*):/, $row, 2;
+               my ($id, $level, $title) = split /:/, $row, 3;
                my @type;
-               push @type, 'parent' if defined $table->{$row};
-               push @type, 'large'  if $mark;
+               push @type, 'parent' if defined $table->{$id};
+               push @type, 'large'  if $level =~ s/c$//;
                push @type, 'level'.($level || 0);
                printf '<li%s>', @type ? sprintf ' class="%s"', join ' ', @type : '';
                print showimg($title) if $level <= $limit;
-               printimgs(@{$_}) for $table->{$row} // ();
+               printimgs(@{$_}) for $table->{$id} // ();
                print '</li>';
        }
        say '</ul>';
 }
 
 say '<section class="gallery">';
-printimgs(@{$table->{''}});
+printimgs($table->{''}->[0]);
 say '</section>';