X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/5722f7af04c31d8649ac6b358cc0477ccbac8992..a531724f57f9cad3fd401fa2846bd61f35aaf9f2:/rfc1345convert diff --git a/rfc1345convert b/rfc1345convert index cf2d937..3157e04 100644 --- a/rfc1345convert +++ b/rfc1345convert @@ -135,6 +135,13 @@ for (keys %di) { $info{$_}->{string} = $di{$_} < 32 ? chr($di{$_} + 0x2400) : chr(0xFFFD); } +# convert info hashes into arrays of strings to output in display order +for my $row (values %info) { + $row = [ map { $row->{$_} } qw/name category script string/ ]; + # strip off trailing missing values (especially string may be unknown) + defined $row->[-1] ? last : pop @$row for 1 .. @$row; +} + # output perl code of hash # (assume no backslashes or curlies, so we can just q{} w/o escaping) print "+{\n"; @@ -144,8 +151,7 @@ printf '(map {$_=>0} qw{%s}),'."\n", join(' ', printf "q{%s}=>[%s],\n", $_, join(',', $di{$_}, # original code point $info{$_} # optional additional arguments - ? map {"'$_'"} @{ $info{$_} }{qw/name category script/}, - $info{$_}->{string} || () + ? map {"'$_'"} @{ $info{$_} } : () ) for sort keys %di; print "}\n";