Files
oddmuse/modules/emoji.pl

72 lines
2.2 KiB
Perl
Raw Normal View History

# 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');
2014-07-04 10:33:33 +02:00
2015-04-10 13:31:28 +03:00
our (%RuleOrder, @MyRules);
push(@MyRules, \&EmojiRule);
2014-08-26 22:39:39 +02:00
# this must come before tex.pl because of \o/ turning into ø/
$RuleOrder{\&EmojiRule} = 150;
2014-08-26 22:24:08 +02:00
# Some relevant links
# https://en.wikipedia.org/wiki/List_of_emoticons
sub EmojiRule {
if (m/\G:-?D/cg) {
# 😀 1F600 GRINNING FACE
2014-07-03 15:11:12 +02:00
return '&#x1F600;';
2014-08-26 22:24:08 +02:00
} elsif (/\G:[-o]?\)/cg) {
# 😊 1F60A SMILING FACE WITH SMILING EYES
return '&#x1F60A;';
2014-08-27 08:19:03 +02:00
} elsif (/\G\s+:3/cg) {
2014-08-26 22:24:08 +02:00
# 😸 1F638 GRINNING CAT FACE WITH SMILING EYES
2014-08-27 08:19:03 +02:00
return ' &#x1f638;';
2014-08-26 22:24:08 +02:00
} elsif (/\G:-?\(/cg) {
# 😟 1F61F WORRIED FACE
return '&#x1F61F;';
2014-08-26 22:24:08 +02:00
} elsif (/\G;-?\)/cg) {
# 😉 1F609 WINKING FACE
return '&#x1F609;';
2014-08-26 22:24:08 +02:00
} elsif (/\G:'\(/cg) {
# 😢 1F622 CRYING FACE
return '&#x1F622;';
2014-08-26 22:34:30 +02:00
} elsif (/\G&gt;:-?\(/cg) {
# 😠 1F620 ANGRY FACE
return '&#x1F620;';
2014-08-26 22:24:08 +02:00
} elsif (/\G:-?[Ppb]/cg) {
# 😝 1F61D FACE WITH STUCK-OUT TONGUE AND TIGHTLY-CLOSED EYES
return '&#x1F61D;';
2014-08-26 22:24:08 +02:00
} elsif (/\G&lt;3/cg) {
# ❤ 2764 HEAVY BLACK HEART
return '&#x2764;';
2014-08-26 22:24:08 +02:00
} elsif (/\G\^_*\^/cg) {
# 😄 1F604 SMILING FACE WITH OPEN MOUTH AND SMILING EYES
return '&#x1F604;';
2014-08-26 22:24:08 +02:00
} elsif (/\G\b[Oo]_[Oo]\b/cg) {
# 😲 1F632 ASTONISHED FACE
return '&#x1F632;';
2014-08-26 22:24:08 +02:00
} elsif (/\G\\o\//cg) {
# 🙌 1F64C PERSON RAISING BOTH HANDS IN CELEBRATION
return '&#x1F64C;';
2014-08-26 22:34:30 +02:00
} elsif (/\G\\m\//cg) {
# ✊ 270A RAISED FIST
return '&#x270A;';
}
return;
}