gemoji-parser 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/Rakefile +1 -4
- data/gemoji-parser.gemspec +1 -1
- data/lib/gemoji-parser.rb +14 -34
- data/lib/gemoji-parser/version.rb +1 -1
- data/output/emoticons.txt +15 -0
- data/output/rx_emoticon.rb +4 -0
- data/output/rx_macro.rb +4 -0
- data/output/rx_token.rb +4 -0
- data/output/rx_unicode.rb +4 -0
- data/spec/emoji_parser_spec.rb +10 -0
- data/tasks/output_emoticons.rake +43 -0
- data/tasks/output_regex.rake +59 -0
- data/tasks/rspec.rake +2 -0
- data/tasks/sweep.rake +6 -0
- metadata +13 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b31351832b35122fe01a2d1a6b7be51c56e814b
|
4
|
+
data.tar.gz: cbde8b194c73115323406088828f7374732d7589
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c471b015e61d6a5e63b80159b2931e7193ff558c3bcc49211e7762ceb2c31f069dc64155960cdfc899a118d253a964d6621743d5d17d0b24849a457daa3b1801
|
7
|
+
data.tar.gz: c4d9969216f08a5b2a20938a9f7485ba6f9973ca0ef9a7e3f1a03afd08720a643f51d2dfd1d075aabb8d6440bbfa431a60f201adde0abd747f5594ee6afb6cb3
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# gemoji-parser
|
2
2
|
|
3
|
-
The missing helper methods for [GitHub's gemoji](https://github.com/github/gemoji) gem. This utility provides a parsing API for the `Emoji` corelib (provided by *gemoji*).
|
3
|
+
The missing helper methods for [GitHub's gemoji](https://github.com/github/gemoji) gem. This utility provides a parsing API for the `Emoji` corelib (provided by *gemoji*). Parser performs the transformation of emoji symbols between unicode characters (😃), token strings (`:smile:`), and emoticons (`:-D`); and may perform arbitrary replacement of emoji symbols into custom display formats (such as image tags). Internally, highly-optimized regular expressions are generated and cached for efficient parsing.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -70,6 +70,8 @@ end
|
|
70
70
|
# 'Test <img src="unicode/1f609.png" alt=":wink:">'
|
71
71
|
```
|
72
72
|
|
73
|
+
*See [emoticons output](https://github.com/gmac/gemoji-parser/blob/master/output/emoticons.txt) for the default emoticon set.*
|
74
|
+
|
73
75
|
**All symbol types**
|
74
76
|
|
75
77
|
Use the `parse` method to target all symbol types with a single parsing pass. Specific symbol types may be excluded using options:
|
data/Rakefile
CHANGED
data/gemoji-parser.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.authors = ["Greg MacWilliam"]
|
10
10
|
s.email = ["greg.macwilliam@voxmedia.com"]
|
11
11
|
s.summary = %q{The missing helper methods for GitHub's Gemoji gem.}
|
12
|
-
s.description = %q{Expands GitHub Gemoji to parse unicode
|
12
|
+
s.description = %q{Expands GitHub Gemoji to parse emoji unicode characters, token strings, and emoticons.}
|
13
13
|
s.homepage = "https://github.com/gmac/gemoji-parser"
|
14
14
|
s.license = "MIT"
|
15
15
|
|
data/lib/gemoji-parser.rb
CHANGED
@@ -78,6 +78,8 @@ module EmojiParser
|
|
78
78
|
emoticon_regex(rehash: true)
|
79
79
|
end
|
80
80
|
|
81
|
+
U_FE0F = '\\u{fe0f}'
|
82
|
+
|
81
83
|
# Creates an optimized regular expression for matching unicode symbols.
|
82
84
|
# - Options: rehash:boolean
|
83
85
|
def unicode_regex(opts={})
|
@@ -93,7 +95,7 @@ module EmojiParser
|
|
93
95
|
pattern << unicode_matcher(u) if u.any?
|
94
96
|
end
|
95
97
|
|
96
|
-
@unicode_pattern = pattern.join('|')
|
98
|
+
@unicode_pattern = "(?:#{ pattern.join('|') })#{ U_FE0F }?"
|
97
99
|
@unicode_regex = Regexp.new("(#{@unicode_pattern})")
|
98
100
|
end
|
99
101
|
|
@@ -140,6 +142,7 @@ module EmojiParser
|
|
140
142
|
# EU: (emoticon/unicode-$1)
|
141
143
|
# - Options: unicode:boolean, tokens:boolean, emoticons:boolean
|
142
144
|
def macro_regex(opts={})
|
145
|
+
opts = { unicode: true, tokens: true, emoticons: true }.merge(opts)
|
143
146
|
unicode_regex if opts[:unicode]
|
144
147
|
token_regex if opts[:tokens]
|
145
148
|
emoticon_regex if opts[:emoticons]
|
@@ -245,47 +248,24 @@ module EmojiParser
|
|
245
248
|
|
246
249
|
private
|
247
250
|
|
251
|
+
U_FE0F_SUFFIX = Regexp.new(Regexp.escape(U_FE0F)+'$')
|
252
|
+
|
248
253
|
# Compiles an optimized unicode pattern for fast matching.
|
249
|
-
# Matchers use as small a base as possible, with added options. Ex:
|
250
|
-
# 1-char base \w option: \u{1f6a9}\u{fe0f}?
|
251
|
-
# 2-char base \w option: \u{1f1ef}\u{1f1f5}\u{fe0f}?
|
252
|
-
# 1-char base \w options: \u{0031}(?:\u{fe0f}\u{20e3}|\u{20e3}\u{fe0f})?
|
253
254
|
def unicode_matcher(patterns)
|
255
|
+
# Strip off all trailing U_FE0F characters:
|
256
|
+
patterns.map! { |p| p.gsub(U_FE0F_SUFFIX, '') }.uniq!
|
257
|
+
|
258
|
+
# Return a single pattern directly:
|
254
259
|
return patterns.first if patterns.length == 1
|
255
260
|
|
256
261
|
# Sort patterns, longest to shortest:
|
257
262
|
patterns.sort! { |a, b| b.length - a.length }
|
258
263
|
|
259
|
-
#
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
if patterns.all? { |p| p.start_with?(base) }
|
264
|
-
base = patterns.pop
|
264
|
+
# Use the longest pattern with U_FE0F optionalized, if possible:
|
265
|
+
if patterns.all? { |p| p.gsub(U_FE0F, '') == patterns.last }
|
266
|
+
patterns.first.gsub(U_FE0F, U_FE0F+'?')
|
265
267
|
else
|
266
|
-
|
267
|
-
base = nil unless patterns.all? { |p| p.start_with?(base) }
|
268
|
-
end
|
269
|
-
|
270
|
-
# Collect base options and/or alternate patterns:
|
271
|
-
opts = []
|
272
|
-
alts = []
|
273
|
-
patterns.each do |pattern|
|
274
|
-
if base && pattern.start_with?(base)
|
275
|
-
opts << pattern.sub(base, '')
|
276
|
-
else
|
277
|
-
alts << pattern
|
278
|
-
end
|
268
|
+
patterns.join('|')
|
279
269
|
end
|
280
|
-
|
281
|
-
# Format base options:
|
282
|
-
if opts.length == 1
|
283
|
-
base += "#{ opts.first }?"
|
284
|
-
elsif opts.length > 1
|
285
|
-
base += "(?:#{ opts.join('|') })?"
|
286
|
-
end
|
287
|
-
|
288
|
-
alts << base if base
|
289
|
-
alts.join('|')
|
290
270
|
end
|
291
271
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
EMOJI_NAME EMOTICONS
|
2
|
+
angry >:-( >:(
|
3
|
+
blush :-) :)
|
4
|
+
cry :'(
|
5
|
+
confused :-\ :\ :-/ :/
|
6
|
+
disappointed :-( :(
|
7
|
+
kiss :-* :*
|
8
|
+
neutral_face :-| :|
|
9
|
+
monkey_face :o)
|
10
|
+
open_mouth :-o :o
|
11
|
+
smiley =-) =)
|
12
|
+
smile :-D :D
|
13
|
+
stuck_out_tongue :-p :p :-P :P :-b :b
|
14
|
+
stuck_out_tongue_winking_eye ;-p ;p ;-P ;P ;-b ;b
|
15
|
+
wink ;-) ;)
|
data/output/rx_macro.rb
ADDED
@@ -0,0 +1,4 @@
|
|
1
|
+
# RegExp for matching emoji unicode, tokens, and emoticons
|
2
|
+
# generated by gemoji-parser
|
3
|
+
|
4
|
+
/(?::([\w+-]+):)|((?:(?<=^|\s)(?:>:\-?\(|:\-?\)|:'\(|:\-?\\|:\-?\/|:\-?\(|:\-?\*|:\-?\||:o\)|:\-?o|=\-?\)|:\-?D|:\-?p|:\-?P|:\-?b|;\-?p|;\-?P|;\-?b|;\-?\))(?=\s|$))|(?:\u{1f604}|\u{1f603}|\u{1f600}|\u{1f60a}|\u{263a}|\u{1f609}|\u{1f60d}|\u{1f618}|\u{1f61a}|\u{1f617}|\u{1f619}|\u{1f61c}|\u{1f61d}|\u{1f61b}|\u{1f633}|\u{1f601}|\u{1f614}|\u{1f60c}|\u{1f612}|\u{1f61e}|\u{1f623}|\u{1f622}|\u{1f602}|\u{1f62d}|\u{1f62a}|\u{1f625}|\u{1f630}|\u{1f605}|\u{1f613}|\u{1f629}|\u{1f62b}|\u{1f628}|\u{1f631}|\u{1f620}|\u{1f621}|\u{1f624}|\u{1f616}|\u{1f606}|\u{1f60b}|\u{1f637}|\u{1f60e}|\u{1f634}|\u{1f635}|\u{1f632}|\u{1f61f}|\u{1f626}|\u{1f627}|\u{1f608}|\u{1f47f}|\u{1f62e}|\u{1f62c}|\u{1f610}|\u{1f615}|\u{1f62f}|\u{1f636}|\u{1f607}|\u{1f60f}|\u{1f611}|\u{1f472}|\u{1f473}|\u{1f46e}|\u{1f477}|\u{1f482}|\u{1f476}|\u{1f466}|\u{1f467}|\u{1f468}|\u{1f469}|\u{1f474}|\u{1f475}|\u{1f471}|\u{1f47c}|\u{1f478}|\u{1f63a}|\u{1f638}|\u{1f63b}|\u{1f63d}|\u{1f63c}|\u{1f640}|\u{1f63f}|\u{1f639}|\u{1f63e}|\u{1f479}|\u{1f47a}|\u{1f648}|\u{1f649}|\u{1f64a}|\u{1f480}|\u{1f47d}|\u{1f4a9}|\u{1f525}|\u{2728}|\u{1f31f}|\u{1f4ab}|\u{1f4a5}|\u{1f4a2}|\u{1f4a6}|\u{1f4a7}|\u{1f4a4}|\u{1f4a8}|\u{1f442}|\u{1f440}|\u{1f443}|\u{1f445}|\u{1f444}|\u{1f44d}|\u{1f44e}|\u{1f44c}|\u{1f44a}|\u{270a}|\u{270c}|\u{1f44b}|\u{270b}|\u{1f450}|\u{1f446}|\u{1f447}|\u{1f449}|\u{1f448}|\u{1f64c}|\u{1f64f}|\u{261d}|\u{1f44f}|\u{1f4aa}|\u{1f6b6}|\u{1f3c3}|\u{1f483}|\u{1f46b}|\u{1f46a}|\u{1f46c}|\u{1f46d}|\u{1f48f}|\u{1f491}|\u{1f46f}|\u{1f646}|\u{1f645}|\u{1f481}|\u{1f64b}|\u{1f486}|\u{1f487}|\u{1f485}|\u{1f470}|\u{1f64e}|\u{1f64d}|\u{1f647}|\u{1f3a9}|\u{1f451}|\u{1f452}|\u{1f45f}|\u{1f45e}|\u{1f461}|\u{1f460}|\u{1f462}|\u{1f455}|\u{1f454}|\u{1f45a}|\u{1f457}|\u{1f3bd}|\u{1f456}|\u{1f458}|\u{1f459}|\u{1f4bc}|\u{1f45c}|\u{1f45d}|\u{1f45b}|\u{1f453}|\u{1f380}|\u{1f302}|\u{1f484}|\u{1f49b}|\u{1f499}|\u{1f49c}|\u{1f49a}|\u{2764}|\u{1f494}|\u{1f497}|\u{1f493}|\u{1f495}|\u{1f496}|\u{1f49e}|\u{1f498}|\u{1f48c}|\u{1f48b}|\u{1f48d}|\u{1f48e}|\u{1f464}|\u{1f465}|\u{1f4ac}|\u{1f463}|\u{1f4ad}|\u{1f436}|\u{1f43a}|\u{1f431}|\u{1f42d}|\u{1f439}|\u{1f430}|\u{1f438}|\u{1f42f}|\u{1f428}|\u{1f43b}|\u{1f437}|\u{1f43d}|\u{1f42e}|\u{1f417}|\u{1f435}|\u{1f412}|\u{1f434}|\u{1f411}|\u{1f418}|\u{1f43c}|\u{1f427}|\u{1f426}|\u{1f424}|\u{1f425}|\u{1f423}|\u{1f414}|\u{1f40d}|\u{1f422}|\u{1f41b}|\u{1f41d}|\u{1f41c}|\u{1f41e}|\u{1f40c}|\u{1f419}|\u{1f41a}|\u{1f420}|\u{1f41f}|\u{1f42c}|\u{1f433}|\u{1f40b}|\u{1f404}|\u{1f40f}|\u{1f400}|\u{1f403}|\u{1f405}|\u{1f407}|\u{1f409}|\u{1f40e}|\u{1f410}|\u{1f413}|\u{1f415}|\u{1f416}|\u{1f401}|\u{1f402}|\u{1f432}|\u{1f421}|\u{1f40a}|\u{1f42b}|\u{1f42a}|\u{1f406}|\u{1f408}|\u{1f429}|\u{1f43e}|\u{1f490}|\u{1f338}|\u{1f337}|\u{1f340}|\u{1f339}|\u{1f33b}|\u{1f33a}|\u{1f341}|\u{1f343}|\u{1f342}|\u{1f33f}|\u{1f33e}|\u{1f344}|\u{1f335}|\u{1f334}|\u{1f332}|\u{1f333}|\u{1f330}|\u{1f331}|\u{1f33c}|\u{1f310}|\u{1f31e}|\u{1f31d}|\u{1f31a}|\u{1f311}|\u{1f312}|\u{1f313}|\u{1f314}|\u{1f315}|\u{1f316}|\u{1f317}|\u{1f318}|\u{1f31c}|\u{1f31b}|\u{1f319}|\u{1f30d}|\u{1f30e}|\u{1f30f}|\u{1f30b}|\u{1f30c}|\u{1f320}|\u{2b50}|\u{2600}|\u{26c5}|\u{2601}|\u{26a1}|\u{2614}|\u{2744}|\u{26c4}|\u{1f300}|\u{1f301}|\u{1f308}|\u{1f30a}|\u{1f38d}|\u{1f49d}|\u{1f38e}|\u{1f392}|\u{1f393}|\u{1f38f}|\u{1f386}|\u{1f387}|\u{1f390}|\u{1f391}|\u{1f383}|\u{1f47b}|\u{1f385}|\u{1f384}|\u{1f381}|\u{1f38b}|\u{1f389}|\u{1f38a}|\u{1f388}|\u{1f38c}|\u{1f52e}|\u{1f3a5}|\u{1f4f7}|\u{1f4f9}|\u{1f4fc}|\u{1f4bf}|\u{1f4c0}|\u{1f4bd}|\u{1f4be}|\u{1f4bb}|\u{1f4f1}|\u{260e}|\u{1f4de}|\u{1f4df}|\u{1f4e0}|\u{1f4e1}|\u{1f4fa}|\u{1f4fb}|\u{1f50a}|\u{1f509}|\u{1f508}|\u{1f507}|\u{1f514}|\u{1f515}|\u{1f4e2}|\u{1f4e3}|\u{23f3}|\u{231b}|\u{23f0}|\u{231a}|\u{1f513}|\u{1f512}|\u{1f50f}|\u{1f510}|\u{1f511}|\u{1f50e}|\u{1f4a1}|\u{1f526}|\u{1f506}|\u{1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f3bf}|\u{1f3c2}|\u{1f3ca}|\u{1f3c4}|\u{1f3a3}|\u{2615}|\u{1f375}|\u{1f376}|\u{1f37c}|\u{1f37a}|\u{1f37b}|\u{1f378}|\u{1f379}|\u{1f377}|\u{1f374}|\u{1f355}|\u{1f354}|\u{1f35f}|\u{1f357}|\u{1f356}|\u{1f35d}|\u{1f35b}|\u{1f364}|\u{1f371}|\u{1f363}|\u{1f365}|\u{1f359}|\u{1f358}|\u{1f35a}|\u{1f35c}|\u{1f372}|\u{1f362}|\u{1f361}|\u{1f373}|\u{1f35e}|\u{1f369}|\u{1f36e}|\u{1f366}|\u{1f368}|\u{1f367}|\u{1f382}|\u{1f370}|\u{1f36a}|\u{1f36b}|\u{1f36c}|\u{1f36d}|\u{1f36f}|\u{1f34e}|\u{1f34f}|\u{1f34a}|\u{1f34b}|\u{1f352}|\u{1f347}|\u{1f349}|\u{1f353}|\u{1f351}|\u{1f348}|\u{1f34c}|\u{1f350}|\u{1f34d}|\u{1f360}|\u{1f346}|\u{1f345}|\u{1f33d}|\u{1f3e0}|\u{1f3e1}|\u{1f3eb}|\u{1f3e2}|\u{1f3e3}|\u{1f3e5}|\u{1f3e6}|\u{1f3ea}|\u{1f3e9}|\u{1f3e8}|\u{1f492}|\u{26ea}|\u{1f3ec}|\u{1f3e4}|\u{1f307}|\u{1f306}|\u{1f3ef}|\u{1f3f0}|\u{26fa}|\u{1f3ed}|\u{1f5fc}|\u{1f5fe}|\u{1f5fb}|\u{1f304}|\u{1f305}|\u{1f303}|\u{1f5fd}|\u{1f309}|\u{1f3a0}|\u{1f3a1}|\u{26f2}|\u{1f3a2}|\u{1f6a2}|\u{26f5}|\u{1f6a4}|\u{1f6a3}|\u{2693}|\u{1f680}|\u{2708}|\u{1f4ba}|\u{1f681}|\u{1f682}|\u{1f68a}|\u{1f689}|\u{1f69e}|\u{1f686}|\u{1f684}|\u{1f685}|\u{1f688}|\u{1f687}|\u{1f69d}|\u{1f68b}|\u{1f683}|\u{1f68e}|\u{1f68c}|\u{1f68d}|\u{1f699}|\u{1f698}|\u{1f697}|\u{1f695}|\u{1f696}|\u{1f69b}|\u{1f69a}|\u{1f6a8}|\u{1f693}|\u{1f694}|\u{1f692}|\u{1f691}|\u{1f690}|\u{1f6b2}|\u{1f6a1}|\u{1f69f}|\u{1f6a0}|\u{1f69c}|\u{1f488}|\u{1f68f}|\u{1f3ab}|\u{1f6a6}|\u{1f6a5}|\u{26a0}|\u{1f6a7}|\u{1f530}|\u{26fd}|\u{1f3ee}|\u{1f3b0}|\u{2668}|\u{1f5ff}|\u{1f3aa}|\u{1f3ad}|\u{1f4cd}|\u{1f6a9}|\u{1f1ef}\u{1f1f5}|\u{1f1f0}\u{1f1f7}|\u{1f1e9}\u{1f1ea}|\u{1f1e8}\u{1f1f3}|\u{1f1fa}\u{1f1f8}|\u{1f1eb}\u{1f1f7}|\u{1f1ea}\u{1f1f8}|\u{1f1ee}\u{1f1f9}|\u{1f1f7}\u{1f1fa}|\u{1f1ec}\u{1f1e7}|\u{0031}\u{fe0f}?\u{20e3}|\u{0032}\u{fe0f}?\u{20e3}|\u{0033}\u{fe0f}?\u{20e3}|\u{0034}\u{fe0f}?\u{20e3}|\u{0035}\u{fe0f}?\u{20e3}|\u{0036}\u{fe0f}?\u{20e3}|\u{0037}\u{fe0f}?\u{20e3}|\u{0038}\u{fe0f}?\u{20e3}|\u{0039}\u{fe0f}?\u{20e3}|\u{0030}\u{fe0f}?\u{20e3}|\u{1f51f}|\u{1f522}|\u{0023}\u{fe0f}?\u{20e3}|\u{1f523}|\u{2b06}|\u{2b07}|\u{2b05}|\u{27a1}|\u{1f520}|\u{1f521}|\u{1f524}|\u{2197}|\u{2196}|\u{2198}|\u{2199}|\u{2194}|\u{2195}|\u{1f504}|\u{25c0}|\u{25b6}|\u{1f53c}|\u{1f53d}|\u{21a9}|\u{21aa}|\u{2139}|\u{23ea}|\u{23e9}|\u{23eb}|\u{23ec}|\u{2935}|\u{2934}|\u{1f197}|\u{1f500}|\u{1f501}|\u{1f502}|\u{1f195}|\u{1f199}|\u{1f192}|\u{1f193}|\u{1f196}|\u{1f4f6}|\u{1f3a6}|\u{1f201}|\u{1f22f}|\u{1f233}|\u{1f235}|\u{1f234}|\u{1f232}|\u{1f250}|\u{1f239}|\u{1f23a}|\u{1f236}|\u{1f21a}|\u{1f6bb}|\u{1f6b9}|\u{1f6ba}|\u{1f6bc}|\u{1f6be}|\u{1f6b0}|\u{1f6ae}|\u{1f17f}|\u{267f}|\u{1f6ad}|\u{1f237}|\u{1f238}|\u{1f202}|\u{24c2}|\u{1f6c2}|\u{1f6c4}|\u{1f6c5}|\u{1f6c3}|\u{1f251}|\u{3299}|\u{3297}|\u{1f191}|\u{1f198}|\u{1f194}|\u{1f6ab}|\u{1f51e}|\u{1f4f5}|\u{1f6af}|\u{1f6b1}|\u{1f6b3}|\u{1f6b7}|\u{1f6b8}|\u{26d4}|\u{2733}|\u{2747}|\u{274e}|\u{2705}|\u{2734}|\u{1f49f}|\u{1f19a}|\u{1f4f3}|\u{1f4f4}|\u{1f170}|\u{1f171}|\u{1f18e}|\u{1f17e}|\u{1f4a0}|\u{27bf}|\u{267b}|\u{2648}|\u{2649}|\u{264a}|\u{264b}|\u{264c}|\u{264d}|\u{264e}|\u{264f}|\u{2650}|\u{2651}|\u{2652}|\u{2653}|\u{26ce}|\u{1f52f}|\u{1f3e7}|\u{1f4b9}|\u{1f4b2}|\u{1f4b1}|\u{00a9}|\u{00ae}|\u{2122}|\u{274c}|\u{203c}|\u{2049}|\u{2757}|\u{2753}|\u{2755}|\u{2754}|\u{2b55}|\u{1f51d}|\u{1f51a}|\u{1f519}|\u{1f51b}|\u{1f51c}|\u{1f503}|\u{1f55b}|\u{1f567}|\u{1f550}|\u{1f55c}|\u{1f551}|\u{1f55d}|\u{1f552}|\u{1f55e}|\u{1f553}|\u{1f55f}|\u{1f554}|\u{1f560}|\u{1f555}|\u{1f556}|\u{1f557}|\u{1f558}|\u{1f559}|\u{1f55a}|\u{1f561}|\u{1f562}|\u{1f563}|\u{1f564}|\u{1f565}|\u{1f566}|\u{2716}|\u{2795}|\u{2796}|\u{2797}|\u{2660}|\u{2665}|\u{2663}|\u{2666}|\u{1f4ae}|\u{1f4af}|\u{2714}|\u{2611}|\u{1f518}|\u{1f517}|\u{27b0}|\u{3030}|\u{303d}|\u{1f531}|\u{25fc}|\u{25fb}|\u{25fe}|\u{25fd}|\u{25aa}|\u{25ab}|\u{1f53a}|\u{1f532}|\u{1f533}|\u{26ab}|\u{26aa}|\u{1f534}|\u{1f535}|\u{1f53b}|\u{2b1c}|\u{2b1b}|\u{1f536}|\u{1f537}|\u{1f538}|\u{1f539})\u{fe0f}?)/
|
data/output/rx_token.rb
ADDED
@@ -0,0 +1,4 @@
|
|
1
|
+
# RegExp for matching emoji unicode
|
2
|
+
# generated by gemoji-parser
|
3
|
+
|
4
|
+
/((?:\u{1f604}|\u{1f603}|\u{1f600}|\u{1f60a}|\u{263a}|\u{1f609}|\u{1f60d}|\u{1f618}|\u{1f61a}|\u{1f617}|\u{1f619}|\u{1f61c}|\u{1f61d}|\u{1f61b}|\u{1f633}|\u{1f601}|\u{1f614}|\u{1f60c}|\u{1f612}|\u{1f61e}|\u{1f623}|\u{1f622}|\u{1f602}|\u{1f62d}|\u{1f62a}|\u{1f625}|\u{1f630}|\u{1f605}|\u{1f613}|\u{1f629}|\u{1f62b}|\u{1f628}|\u{1f631}|\u{1f620}|\u{1f621}|\u{1f624}|\u{1f616}|\u{1f606}|\u{1f60b}|\u{1f637}|\u{1f60e}|\u{1f634}|\u{1f635}|\u{1f632}|\u{1f61f}|\u{1f626}|\u{1f627}|\u{1f608}|\u{1f47f}|\u{1f62e}|\u{1f62c}|\u{1f610}|\u{1f615}|\u{1f62f}|\u{1f636}|\u{1f607}|\u{1f60f}|\u{1f611}|\u{1f472}|\u{1f473}|\u{1f46e}|\u{1f477}|\u{1f482}|\u{1f476}|\u{1f466}|\u{1f467}|\u{1f468}|\u{1f469}|\u{1f474}|\u{1f475}|\u{1f471}|\u{1f47c}|\u{1f478}|\u{1f63a}|\u{1f638}|\u{1f63b}|\u{1f63d}|\u{1f63c}|\u{1f640}|\u{1f63f}|\u{1f639}|\u{1f63e}|\u{1f479}|\u{1f47a}|\u{1f648}|\u{1f649}|\u{1f64a}|\u{1f480}|\u{1f47d}|\u{1f4a9}|\u{1f525}|\u{2728}|\u{1f31f}|\u{1f4ab}|\u{1f4a5}|\u{1f4a2}|\u{1f4a6}|\u{1f4a7}|\u{1f4a4}|\u{1f4a8}|\u{1f442}|\u{1f440}|\u{1f443}|\u{1f445}|\u{1f444}|\u{1f44d}|\u{1f44e}|\u{1f44c}|\u{1f44a}|\u{270a}|\u{270c}|\u{1f44b}|\u{270b}|\u{1f450}|\u{1f446}|\u{1f447}|\u{1f449}|\u{1f448}|\u{1f64c}|\u{1f64f}|\u{261d}|\u{1f44f}|\u{1f4aa}|\u{1f6b6}|\u{1f3c3}|\u{1f483}|\u{1f46b}|\u{1f46a}|\u{1f46c}|\u{1f46d}|\u{1f48f}|\u{1f491}|\u{1f46f}|\u{1f646}|\u{1f645}|\u{1f481}|\u{1f64b}|\u{1f486}|\u{1f487}|\u{1f485}|\u{1f470}|\u{1f64e}|\u{1f64d}|\u{1f647}|\u{1f3a9}|\u{1f451}|\u{1f452}|\u{1f45f}|\u{1f45e}|\u{1f461}|\u{1f460}|\u{1f462}|\u{1f455}|\u{1f454}|\u{1f45a}|\u{1f457}|\u{1f3bd}|\u{1f456}|\u{1f458}|\u{1f459}|\u{1f4bc}|\u{1f45c}|\u{1f45d}|\u{1f45b}|\u{1f453}|\u{1f380}|\u{1f302}|\u{1f484}|\u{1f49b}|\u{1f499}|\u{1f49c}|\u{1f49a}|\u{2764}|\u{1f494}|\u{1f497}|\u{1f493}|\u{1f495}|\u{1f496}|\u{1f49e}|\u{1f498}|\u{1f48c}|\u{1f48b}|\u{1f48d}|\u{1f48e}|\u{1f464}|\u{1f465}|\u{1f4ac}|\u{1f463}|\u{1f4ad}|\u{1f436}|\u{1f43a}|\u{1f431}|\u{1f42d}|\u{1f439}|\u{1f430}|\u{1f438}|\u{1f42f}|\u{1f428}|\u{1f43b}|\u{1f437}|\u{1f43d}|\u{1f42e}|\u{1f417}|\u{1f435}|\u{1f412}|\u{1f434}|\u{1f411}|\u{1f418}|\u{1f43c}|\u{1f427}|\u{1f426}|\u{1f424}|\u{1f425}|\u{1f423}|\u{1f414}|\u{1f40d}|\u{1f422}|\u{1f41b}|\u{1f41d}|\u{1f41c}|\u{1f41e}|\u{1f40c}|\u{1f419}|\u{1f41a}|\u{1f420}|\u{1f41f}|\u{1f42c}|\u{1f433}|\u{1f40b}|\u{1f404}|\u{1f40f}|\u{1f400}|\u{1f403}|\u{1f405}|\u{1f407}|\u{1f409}|\u{1f40e}|\u{1f410}|\u{1f413}|\u{1f415}|\u{1f416}|\u{1f401}|\u{1f402}|\u{1f432}|\u{1f421}|\u{1f40a}|\u{1f42b}|\u{1f42a}|\u{1f406}|\u{1f408}|\u{1f429}|\u{1f43e}|\u{1f490}|\u{1f338}|\u{1f337}|\u{1f340}|\u{1f339}|\u{1f33b}|\u{1f33a}|\u{1f341}|\u{1f343}|\u{1f342}|\u{1f33f}|\u{1f33e}|\u{1f344}|\u{1f335}|\u{1f334}|\u{1f332}|\u{1f333}|\u{1f330}|\u{1f331}|\u{1f33c}|\u{1f310}|\u{1f31e}|\u{1f31d}|\u{1f31a}|\u{1f311}|\u{1f312}|\u{1f313}|\u{1f314}|\u{1f315}|\u{1f316}|\u{1f317}|\u{1f318}|\u{1f31c}|\u{1f31b}|\u{1f319}|\u{1f30d}|\u{1f30e}|\u{1f30f}|\u{1f30b}|\u{1f30c}|\u{1f320}|\u{2b50}|\u{2600}|\u{26c5}|\u{2601}|\u{26a1}|\u{2614}|\u{2744}|\u{26c4}|\u{1f300}|\u{1f301}|\u{1f308}|\u{1f30a}|\u{1f38d}|\u{1f49d}|\u{1f38e}|\u{1f392}|\u{1f393}|\u{1f38f}|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}|\u{1f4d0}|\u{1f4d5}|\u{1f4d7}|\u{1f4d8}|\u{1f4d9}|\u{1f4d3}|\u{1f4d4}|\u{1f4d2}|\u{1f4da}|\u{1f4d6}|\u{1f516}|\u{1f4db}|\u{1f52c}|\u{1f52d}|\u{1f4f0}|\u{1f3a8}|\u{1f3ac}|\u{1f3a4}|\u{1f3a7}|\u{1f3bc}|\u{1f3b5}|\u{1f3b6}|\u{1f3b9}|\u{1f3bb}|\u{1f3ba}|\u{1f3b7}|\u{1f3b8}|\u{1f47e}|\u{1f3ae}|\u{1f0cf}|\u{1f3b4}|\u{1f004}|\u{1f3b2}|\u{1f3af}|\u{1f3c8}|\u{1f3c0}|\u{26bd}|\u{26be}|\u{1f3be}|\u{1f3b1}|\u{1f3c9}|\u{1f3b3}|\u{26f3}|\u{1f6b5}|\u{1f6b4}|\u{1f3c1}|\u{1f3c7}|\u{1f3c6}|\u{1f3bf}|\u{1f3c2}|\u{1f3ca}|\u{1f3c4}|\u{1f3a3}|\u{2615}|\u{1f375}|\u{1f376}|\u{1f37c}|\u{1f37a}|\u{1f37b}|\u{1f378}|\u{1f379}|\u{1f377}|\u{1f374}|\u{1f355}|\u{1f354}|\u{1f35f}|\u{1f357}|\u{1f356}|\u{1f35d}|\u{1f35b}|\u{1f364}|\u{1f371}|\u{1f363}|\u{1f365}|\u{1f359}|\u{1f358}|\u{1f35a}|\u{1f35c}|\u{1f372}|\u{1f362}|\u{1f361}|\u{1f373}|\u{1f35e}|\u{1f369}|\u{1f36e}|\u{1f366}|\u{1f368}|\u{1f367}|\u{1f382}|\u{1f370}|\u{1f36a}|\u{1f36b}|\u{1f36c}|\u{1f36d}|\u{1f36f}|\u{1f34e}|\u{1f34f}|\u{1f34a}|\u{1f34b}|\u{1f352}|\u{1f347}|\u{1f349}|\u{1f353}|\u{1f351}|\u{1f348}|\u{1f34c}|\u{1f350}|\u{1f34d}|\u{1f360}|\u{1f346}|\u{1f345}|\u{1f33d}|\u{1f3e0}|\u{1f3e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fe0f}?\u{20e3}|\u{0033}\u{fe0f}?\u{20e3}|\u{0034}\u{fe0f}?\u{20e3}|\u{0035}\u{fe0f}?\u{20e3}|\u{0036}\u{fe0f}?\u{20e3}|\u{0037}\u{fe0f}?\u{20e3}|\u{0038}\u{fe0f}?\u{20e3}|\u{0039}\u{fe0f}?\u{20e3}|\u{0030}\u{fe0f}?\u{20e3}|\u{1f51f}|\u{1f522}|\u{0023}\u{fe0f}?\u{20e3}|\u{1f523}|\u{2b06}|\u{2b07}|\u{2b05}|\u{27a1}|\u{1f520}|\u{1f521}|\u{1f524}|\u{2197}|\u{2196}|\u{2198}|\u{2199}|\u{2194}|\u{2195}|\u{1f504}|\u{25c0}|\u{25b6}|\u{1f53c}|\u{1f53d}|\u{21a9}|\u{21aa}|\u{2139}|\u{23ea}|\u{23e9}|\u{23eb}|\u{23ec}|\u{2935}|\u{2934}|\u{1f197}|\u{1f500}|\u{1f501}|\u{1f502}|\u{1f195}|\u{1f199}|\u{1f192}|\u{1f193}|\u{1f196}|\u{1f4f6}|\u{1f3a6}|\u{1f201}|\u{1f22f}|\u{1f233}|\u{1f235}|\u{1f234}|\u{1f232}|\u{1f250}|\u{1f239}|\u{1f23a}|\u{1f236}|\u{1f21a}|\u{1f6bb}|\u{1f6b9}|\u{1f6ba}|\u{1f6bc}|\u{1f6be}|\u{1f6b0}|\u{1f6ae}|\u{1f17f}|\u{267f}|\u{1f6ad}|\u{1f237}|\u{1f238}|\u{1f202}|\u{24c2}|\u{1f6c2}|\u{1f6c4}|\u{1f6c5}|\u{1f6c3}|\u{1f251}|\u{3299}|\u{3297}|\u{1f191}|\u{1f198}|\u{1f194}|\u{1f6ab}|\u{1f51e}|\u{1f4f5}|\u{1f6af}|\u{1f6b1}|\u{1f6b3}|\u{1f6b7}|\u{1f6b8}|\u{26d4}|\u{2733}|\u{2747}|\u{274e}|\u{2705}|\u{2734}|\u{1f49f}|\u{1f19a}|\u{1f4f3}|\u{1f4f4}|\u{1f170}|\u{1f171}|\u{1f18e}|\u{1f17e}|\u{1f4a0}|\u{27bf}|\u{267b}|\u{2648}|\u{2649}|\u{264a}|\u{264b}|\u{264c}|\u{264d}|\u{264e}|\u{264f}|\u{2650}|\u{2651}|\u{2652}|\u{2653}|\u{26ce}|\u{1f52f}|\u{1f3e7}|\u{1f4b9}|\u{1f4b2}|\u{1f4b1}|\u{00a9}|\u{00ae}|\u{2122}|\u{274c}|\u{203c}|\u{2049}|\u{2757}|\u{2753}|\u{2755}|\u{2754}|\u{2b55}|\u{1f51d}|\u{1f51a}|\u{1f519}|\u{1f51b}|\u{1f51c}|\u{1f503}|\u{1f55b}|\u{1f567}|\u{1f550}|\u{1f55c}|\u{1f551}|\u{1f55d}|\u{1f552}|\u{1f55e}|\u{1f553}|\u{1f55f}|\u{1f554}|\u{1f560}|\u{1f555}|\u{1f556}|\u{1f557}|\u{1f558}|\u{1f559}|\u{1f55a}|\u{1f561}|\u{1f562}|\u{1f563}|\u{1f564}|\u{1f565}|\u{1f566}|\u{2716}|\u{2795}|\u{2796}|\u{2797}|\u{2660}|\u{2665}|\u{2663}|\u{2666}|\u{1f4ae}|\u{1f4af}|\u{2714}|\u{2611}|\u{1f518}|\u{1f517}|\u{27b0}|\u{3030}|\u{303d}|\u{1f531}|\u{25fc}|\u{25fb}|\u{25fe}|\u{25fd}|\u{25aa}|\u{25ab}|\u{1f53a}|\u{1f532}|\u{1f533}|\u{26ab}|\u{26aa}|\u{1f534}|\u{1f535}|\u{1f53b}|\u{2b1c}|\u{2b1b}|\u{1f536}|\u{1f537}|\u{1f538}|\u{1f539})\u{fe0f}?)/
|
data/spec/emoji_parser_spec.rb
CHANGED
@@ -50,6 +50,16 @@ describe EmojiParser do
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
+
describe '#rehash!' do
|
54
|
+
it 'regenerates all cached regular expressions.' do
|
55
|
+
urx = EmojiParser.unicode_regex
|
56
|
+
erx = EmojiParser.emoticon_regex
|
57
|
+
EmojiParser.rehash!
|
58
|
+
expect(EmojiParser.unicode_regex).not_to be urx
|
59
|
+
expect(EmojiParser.emoticon_regex).not_to be erx
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
53
63
|
describe '#parse_unicode' do
|
54
64
|
it 'successfully parses full Gemoji unicode set.' do
|
55
65
|
Emoji.all.each do |emoji|
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'gemoji-parser'
|
2
|
+
|
3
|
+
def display_row(label, value, label_width)
|
4
|
+
label = Array.new(label_width - label.length, ' ').join('') + label
|
5
|
+
"#{ label } #{ value }\n"
|
6
|
+
end
|
7
|
+
|
8
|
+
namespace :output do
|
9
|
+
|
10
|
+
desc 'Outputs default emoticon set'
|
11
|
+
task :emoticons do
|
12
|
+
|
13
|
+
HEADER_NAME = 'emoji_name'.upcase
|
14
|
+
HEADER_ICONS = 'emoticons'.upcase
|
15
|
+
label_width = HEADER_NAME.length
|
16
|
+
|
17
|
+
# Compile table of emoticon symbols:
|
18
|
+
icons = {}
|
19
|
+
EmojiParser.emoticons.each_pair do |icon, name|
|
20
|
+
name = name.to_s
|
21
|
+
icons[name] ||= []
|
22
|
+
icons[name] << icon
|
23
|
+
label_width = name.length if name.length > label_width
|
24
|
+
end
|
25
|
+
|
26
|
+
# Compile symbol display table:
|
27
|
+
display = display_row(HEADER_NAME, HEADER_ICONS, label_width)
|
28
|
+
icons.each_pair do |name, icons|
|
29
|
+
display += display_row(name, icons.join(' '), label_width)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Write display to output:
|
33
|
+
fp = 'output/emoticons.txt'
|
34
|
+
f = File.open(fp, 'w')
|
35
|
+
f.puts display
|
36
|
+
f.close
|
37
|
+
|
38
|
+
# Print display:
|
39
|
+
puts "output emoticons: #{fp}"
|
40
|
+
puts display
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'gemoji-parser'
|
2
|
+
|
3
|
+
def rx(regex, desc)
|
4
|
+
"# RegExp for matching #{desc}\n# generated by gemoji-parser\n\n/#{regex.to_s[7..-2]}/"
|
5
|
+
end
|
6
|
+
|
7
|
+
def w(fp)
|
8
|
+
"output regex: #{fp}"
|
9
|
+
end
|
10
|
+
|
11
|
+
namespace :output do
|
12
|
+
namespace :regex do
|
13
|
+
|
14
|
+
desc 'Outputs generated unicode regex'
|
15
|
+
task :unicode do
|
16
|
+
fp = 'output/rx_unicode.rb'
|
17
|
+
f = File.open(fp, 'w')
|
18
|
+
f.puts rx EmojiParser.unicode_regex, 'emoji unicode'
|
19
|
+
f.close
|
20
|
+
puts w(fp)
|
21
|
+
end
|
22
|
+
|
23
|
+
desc 'Outputs generated tokens regex'
|
24
|
+
task :token do
|
25
|
+
fp = 'output/rx_token.rb'
|
26
|
+
f = File.open(fp, 'w')
|
27
|
+
f.puts rx EmojiParser.token_regex, 'emoji token strings'
|
28
|
+
f.close
|
29
|
+
puts w(fp)
|
30
|
+
end
|
31
|
+
|
32
|
+
desc 'Outputs generated emoticons regex'
|
33
|
+
task :emoticon do
|
34
|
+
fp = 'output/rx_emoticon.rb'
|
35
|
+
f = File.open(fp, 'w')
|
36
|
+
f.puts rx EmojiParser.emoticon_regex, 'basic emoticons'
|
37
|
+
f.close
|
38
|
+
puts w(fp)
|
39
|
+
end
|
40
|
+
|
41
|
+
desc 'Outputs generated macro regex for multiple symbol types'
|
42
|
+
task :macro do
|
43
|
+
fp = 'output/rx_macro.rb'
|
44
|
+
f = File.open(fp, 'w')
|
45
|
+
f.puts rx EmojiParser.macro_regex, 'emoji unicode, tokens, and emoticons'
|
46
|
+
f.close
|
47
|
+
puts w(fp)
|
48
|
+
end
|
49
|
+
|
50
|
+
desc 'Outputs all generated regexs'
|
51
|
+
task :all do
|
52
|
+
Rake::Task["output:regex:unicode"].invoke
|
53
|
+
Rake::Task["output:regex:token"].invoke
|
54
|
+
Rake::Task["output:regex:emoticon"].invoke
|
55
|
+
Rake::Task["output:regex:macro"].invoke
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
data/tasks/rspec.rake
ADDED
data/tasks/sweep.rake
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gemoji-parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg MacWilliam
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gemoji
|
@@ -66,8 +66,8 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
description: Expands GitHub Gemoji to parse unicode
|
70
|
-
|
69
|
+
description: Expands GitHub Gemoji to parse emoji unicode characters, token strings,
|
70
|
+
and emoticons.
|
71
71
|
email:
|
72
72
|
- greg.macwilliam@voxmedia.com
|
73
73
|
executables: []
|
@@ -82,7 +82,16 @@ files:
|
|
82
82
|
- gemoji-parser.gemspec
|
83
83
|
- lib/gemoji-parser.rb
|
84
84
|
- lib/gemoji-parser/version.rb
|
85
|
+
- output/emoticons.txt
|
86
|
+
- output/rx_emoticon.rb
|
87
|
+
- output/rx_macro.rb
|
88
|
+
- output/rx_token.rb
|
89
|
+
- output/rx_unicode.rb
|
85
90
|
- spec/emoji_parser_spec.rb
|
91
|
+
- tasks/output_emoticons.rake
|
92
|
+
- tasks/output_regex.rake
|
93
|
+
- tasks/rspec.rake
|
94
|
+
- tasks/sweep.rake
|
86
95
|
homepage: https://github.com/gmac/gemoji-parser
|
87
96
|
licenses:
|
88
97
|
- MIT
|