aboutsummaryrefslogtreecommitdiff
path: root/emojitrans2.pl
diff options
context:
space:
mode:
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;
+}