forked from github/kensanata.oddmuse
72 lines
2.2 KiB
Perl
72 lines
2.2 KiB
Perl
# Copyright (C) 2014 Alex Schroeder <alex@gnu.org>
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify it under
|
|
# the terms of the GNU General Public License as published by the Free Software
|
|
# Foundation; either version 3 of the License, or (at your option) any later
|
|
# version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License along with
|
|
# this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
use strict;
|
|
use v5.10;
|
|
|
|
AddModuleDescription('emoji.pl', 'Smilies');
|
|
|
|
our (%RuleOrder, @MyRules);
|
|
|
|
push(@MyRules, \&EmojiRule);
|
|
# this must come before tex.pl because of \o/ turning into ø/
|
|
$RuleOrder{\&EmojiRule} = 150;
|
|
|
|
# Some relevant links
|
|
# https://en.wikipedia.org/wiki/List_of_emoticons
|
|
|
|
sub EmojiRule {
|
|
if (m/\G:-?D/cg) {
|
|
# 😀 1F600 GRINNING FACE
|
|
return '😀';
|
|
} elsif (/\G:[-o]?\)/cg) {
|
|
# 😊 1F60A SMILING FACE WITH SMILING EYES
|
|
return '😊';
|
|
} elsif (/\G\s+:3/cg) {
|
|
# 😸 1F638 GRINNING CAT FACE WITH SMILING EYES
|
|
return ' 😸';
|
|
} elsif (/\G:-?\(/cg) {
|
|
# 😟 1F61F WORRIED FACE
|
|
return '😟';
|
|
} elsif (/\G;-?\)/cg) {
|
|
# 😉 1F609 WINKING FACE
|
|
return '😉';
|
|
} elsif (/\G:'\(/cg) {
|
|
# 😢 1F622 CRYING FACE
|
|
return '😢';
|
|
} elsif (/\G>:-?\(/cg) {
|
|
# 😠 1F620 ANGRY FACE
|
|
return '😠';
|
|
} elsif (/\G:-?[Ppb]\b/cg) {
|
|
# 😝 1F61D FACE WITH STUCK-OUT TONGUE AND TIGHTLY-CLOSED EYES
|
|
return '😝';
|
|
} elsif (/\G<3/cg) {
|
|
# ❤ 2764 HEAVY BLACK HEART
|
|
return '❤';
|
|
} elsif (/\G\^_*\^/cg) {
|
|
# 😄 1F604 SMILING FACE WITH OPEN MOUTH AND SMILING EYES
|
|
return '😄';
|
|
} elsif (/\G\b[Oo]_[Oo]\b/cg) {
|
|
# 😲 1F632 ASTONISHED FACE
|
|
return '😲';
|
|
} elsif (/\G\\o\//cg) {
|
|
# 🙌 1F64C PERSON RAISING BOTH HANDS IN CELEBRATION
|
|
return '🙌';
|
|
} elsif (/\G\\m\//cg) {
|
|
# ✊ 270A RAISED FIST
|
|
return '✊';
|
|
}
|
|
return;
|
|
}
|