aboutsummaryrefslogtreecommitdiff
path: root/emojitrans2.pl
diff options
context:
space:
mode:
Diffstat (limited to 'emojitrans2.pl')
-rwxr-xr-xemojitrans2.pl25
1 files changed, 23 insertions, 2 deletions
diff --git a/emojitrans2.pl b/emojitrans2.pl
index 27ee545..4f70288 100755
--- a/emojitrans2.pl
+++ b/emojitrans2.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -p
+#!/usr/bin/env -S perl -p
use feature 'unicode_strings';
use utf8;
BEGIN { binmode(STDOUT, ":utf8");
@@ -36,9 +36,30 @@ BEGIN { binmode(STDOUT, ":utf8");
'=' => 'equal',
' ' => 'space',
'*' => 'asterisk',
+ '&' => 'ampersand',
'♫' => 'Multi_key',
+ '←' => 'Left',
+ '→' => 'Right',
+ '↑' => 'Up',
+ '↓' => 'Down',
+ '⇐' => 'BackSpace',
+ '⇤' => 'Home',
+ '⇥' => 'End',
+ '⇑' => 'Prior', # PageUp
+ '⇓' => 'Next', # PageDown
+ '↵' => 'Return',
+ '∇' => 'Delete', # Del, get it?
+ '˅' => 'Insert', # it'll do.
+ '˃' => 'Control_R',
+ '˂' => 'Control_L',
+ # Function-keys? ¹ ²..ˣ ᵉ ᵗ?
);
+ $specials = join "", keys %specials;
+ # Because of reasons
+ $specials =~ s/[]\\-]/\\$&/g;
+ $RE = qr{([[:alnum:]$specials]+)};
+
sub splitup {
my $arg=shift;
local $_;
@@ -60,7 +81,7 @@ unless (/^#/) {
my $hold=$_;
s/<M_>/<Multi_key>/;
s/<MM>/<Multi_key> <Multi_key>/;
- s({([][[:alnum:] _+:;%@>=`<,.^\$+#()?!/|'"\\~*{}♫-]+)})(splitup($1))e;
+ s({($RE)})(splitup($1))e;
if (length($1) > 7) {
$_=$hold;
s/^<M([M_])>/### <M$1>/;