font: aggregate coverage data from hash entries
[sheet.git] / tools / mkwordlist
index 78859b4a09cb2a0cb48dd39c5f7a1edddd90a5ca..81c363009acef20554311a922f009a8913e2e62e 100755 (executable)
@@ -4,7 +4,7 @@ use warnings;
 
 BEGIN { push @INC, '.' }
 use Shiar_Sheet::DB;
-use open ':std' => ':utf8';
+use open ':std' => ':encoding(utf-8)';
 my $db = Shiar_Sheet::DB->connect;
 
 say 'use utf8;';
@@ -13,8 +13,13 @@ use Data::Dump 'pp';
 my %rows;
 if (my $lang = shift @ARGV) {
        my %filter = (lang => $lang);
-       my $cols = "ref, id, prio, array_to_string(form || alt, '/')";
-       %rows = $db->select(_word_ref => $cols, \%filter)->map_arrays;
+       my $cols = "ref, array_to_string(form || alt, '/'), prio, id, sub";
+       %rows = $db->select(_word => $cols, \%filter)->map_arrays;
+       defined $_->[-1] or pop @$_ for values %rows;
+       $rows{''} = [
+               (undef) x 3,
+               [$db->select(word => 'id', {cat => undef, ref => undef})->flat]
+       ];
        say pp \%rows
                =~ s/\\x\{([0-9A-F]+)\}/chr hex $1/ger;
        exit;