aboutsummaryrefslogtreecommitdiff
path: root/emojitrans2.pl
diff options
context:
space:
mode:
authorMark Shoulson <mark@kli.org>2016-03-17 17:11:31 -0400
committerMark Shoulson <mark@kli.org>2016-03-17 17:11:31 -0400
commit7aea5d121149b799b9342859ea66a17c1ec6342e (patch)
treec52aa2d38aafc22d12cb3a82ce6a62b586f266f0 /emojitrans2.pl
parentUse standard for INVERTED INTERROBANG, some comment changes, PSILI and DASIA. (diff)
downloaddotXCompose-7aea5d121149b799b9342859ea66a17c1ec6342e.tar.gz
dotXCompose-7aea5d121149b799b9342859ea66a17c1ec6342e.tar.bz2
dotXCompose-7aea5d121149b799b9342859ea66a17c1ec6342e.zip
Add new Emoji file and support.
emojilist is a list snipped out of UnicodeData.txt emojitrans1.pl converts it to an intermediate form, sorta XCompose-like, but with shortcuts (more XCompose-like than it needs to be, sorry), which is emoji-interim. Edit that to comment out things that shouldn't happen, choose key combos, etc. Then use emojitrans2.pl to translate that to true emoji.compose, which is an XCompose file you can include.
Diffstat (limited to 'emojitrans2.pl')
-rwxr-xr-xemojitrans2.pl40
1 files changed, 40 insertions, 0 deletions
diff --git a/emojitrans2.pl b/emojitrans2.pl
new file mode 100755
index 0000000..2637c19
--- /dev/null
+++ b/emojitrans2.pl
@@ -0,0 +1,40 @@
+#!/usr/bin/perl -p
+BEGIN { binmode(STDOUT, ":utf8");
+ binmode(STDIN, ":utf8");
+
+%specials = ('%' => 'percent',
+ '-' => 'minus',
+ '>' => 'greater',
+ '<' => 'less',
+ ',' => 'comma',
+ '.' => 'period',
+ '$' => 'dollar',
+ '!' => 'exclam',
+ '?' => 'question',
+ '+' => 'plus',
+ '/' => 'slash',
+ '#' => 'numbersign',
+ '@' => 'at',
+);
+
+sub splitup {
+ my $arg=shift;
+ local $_;
+ my @out;
+ my $rv;
+ return "\{$arg\}" if length($arg) > 7;
+ @out=split //, $arg;
+ $rv="";
+ for (@out) {
+ $_ = $specials{$_} // $_;
+ $rv .= " <$_>";
+ }
+ return $rv;
+}
+
+}
+
+unless (/^#/) {
+ s/<MM>/<Multi_key> <Multi_key>/;
+ s({([][[:alnum:] _+%@><,.^\$+#()!/-]+)})(splitup($1))e;
+}