X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/95a62b8397c02f6103132a3c248df2c50e6c8829..04d963b223ec1e49784c96a1b6b36cddf6cd29f0:/rfc1345convert diff --git a/rfc1345convert b/rfc1345convert index c1b3861..8b29b80 100644 --- a/rfc1345convert +++ b/rfc1345convert @@ -46,9 +46,20 @@ for (@t) { $di{$mnem} = hex $char; } +# optionally get unicode character information +my %charinfo = eval { + require Unicode::UCD; + map { $_ => Unicode::UCD::charinfo($di{$_}) } keys %di; +}; + # output perl code of hash # (assume no backslashes or curlies, so we can just q{} w/o escaping) print "{\n"; -print "q{$_}=>$di{$_},\n" for sort keys %di; +printf "q{%s}=>[%s],\n", $_, join(',', + $di{$_}, # glyph code point + $charinfo{$_} # optional additional arguments + ? map {"'$_'"} @{ $charinfo{$_} }{qw/name category script/} + : () +) for sort keys %di; print "}\n";