X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/e1497cc49fa909c193ec5b165fc7445305be09b5..d7c1207fb1cf7dcac45dd455a78d4c8c106ca4a3:/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";