git.shiar.nl
/
sheet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cache unicode character details in digraph include
[sheet.git]
/
rfc1345convert
diff --git
a/rfc1345convert
b/rfc1345convert
index c1b3861aa65dc77137bba89a191723dd28a15279..8b29b8048b821846b23a9886f22beb3a49754a66 100644
(file)
--- a/
rfc1345convert
+++ b/
rfc1345convert
@@
-46,9
+46,20
@@
for (@t) {
$di{$mnem} = hex $char;
}
$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";
# 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";
print "}\n";