unicode-emoji 2.0.0 β 2.1.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 +5 -5
- data/CHANGELOG.md +5 -0
- data/Gemfile +4 -3
- data/README.md +9 -1
- data/data/emoji.marshal.gz +0 -0
- data/lib/unicode/emoji.rb +15 -2
- data/lib/unicode/emoji/constants.rb +4 -4
- data/spec/unicode_emoji_spec.rb +16 -2
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8d675646d8ef27dbc768ba3d6369e73517a02304fab8e3d347f19fd9547530fd
|
4
|
+
data.tar.gz: d51a73ac0f15a6157b54d10fc4f8abca20f77857ba713a646bf9830c286b7449
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49c0162a4784b3f67307e558fa40d64024f79c2a67c365e5dda05895249b2c3148a78d0021ecfcf29387583a3c738584dad5634ca1317eb48521cb6511755ae8
|
7
|
+
data.tar.gz: 5dddd9292e205b09330cd2adfc69e838b86cb96ee72b205b4aab2db860667b8e31ce7ea2e55d12dbf8f5b5f08097fa1ee2a51ffff3d5fcaa00f4aafa5f1729aa
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
## CHANGELOG
|
2
2
|
|
3
|
+
### 2.1.0
|
4
|
+
|
5
|
+
- Add `REGEX_PICTO` which matches codepoints with the **Extended_Pictographic** property
|
6
|
+
- Add `REGEX_PICTO_NO_EMOJI` which matches codepoints with the **Extended_Pictographic** property, but no **Emoji** property
|
7
|
+
|
3
8
|
### 2.0.0
|
4
9
|
|
5
10
|
- Emoji 12.0 data (including valid subdivisions)
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -89,6 +89,14 @@ Regex | Description | Example Matches | Example Non-Matc
|
|
89
89
|
`Unicode::Emoji::REGEX_VALID_INCLUDE_TEXT` | `REGEX_VALID` + `REGEX_TEXT` | `π΄`, `βΆοΈ`, `ππ½`, `π΅πΉ`, `2οΈβ£`, `π΄σ §σ ’σ ³σ £σ ΄σ Ώ`, `π΄σ §σ ’σ ‘σ §σ ’σ Ώ`, `π€Ύπ½ββοΈ`, `π€ βπ€’`, `π΄οΈ`, `βΆ` | `π»`, `π΅π΅`
|
90
90
|
`Unicode::Emoji::REGEX_WELL_FORMED_INCLUDE_TEXT` | `REGEX_WELL_FORMED` + `REGEX_TEXT` | `π΄`, `βΆοΈ`, `ππ½`, `π΅πΉ`, `2οΈβ£`, `π΄σ §σ ’σ ³σ £σ ΄σ Ώ`, `π΄σ §σ ’σ ‘σ §σ ’σ Ώ`, `π€Ύπ½ββοΈ`, `π€ βπ€’`, `π΅π΅`, `π΄οΈ`, `βΆ` | `π»`
|
91
91
|
|
92
|
+
#### Extended Pictographic Regex
|
93
|
+
|
94
|
+
`Unicode::Emoji::REGEX_PICTO` matches single codepoints with the **Extended_Pictographic** property. For example, it will match `β` BLACK SAFETY SCISSORS.
|
95
|
+
|
96
|
+
`Unicode::Emoji::REGEX_PICTO_NO_EMOJI` matches single codepoints with the **Extended_Pictographic** property, but excludes Emoji characters.
|
97
|
+
|
98
|
+
See [character.construction/picto](https://character.construction/picto) for a list of all non-Emoji pictographic characters.
|
99
|
+
|
92
100
|
#### Partial Regexes
|
93
101
|
|
94
102
|
Matches potential Emoji parts (often, this is not what you want):
|
@@ -115,7 +123,7 @@ Unicode::Emoji.list("Food & Drink", "food-asian")
|
|
115
123
|
|
116
124
|
Please note that categories might change with future versions of the Emoji standard. This gem will issue warnings when attemting to retrieve old categories using the `#list` method.
|
117
125
|
|
118
|
-
A
|
126
|
+
A list of all Emoji can be found at [character.construction](https://character.construction).
|
119
127
|
|
120
128
|
### Properties
|
121
129
|
|
data/data/emoji.marshal.gz
CHANGED
Binary file
|
data/lib/unicode/emoji.rb
CHANGED
@@ -29,8 +29,9 @@ module Unicode
|
|
29
29
|
EMOJI_COMPONENT = INDEX[:PROPERTIES].select{ |ord, props| props.include?(:C) }.keys.freeze
|
30
30
|
EMOJI_MODIFIER_BASES = INDEX[:PROPERTIES].select{ |ord, props| props.include?(:B) }.keys.freeze
|
31
31
|
EMOJI_MODIFIERS = INDEX[:PROPERTIES].select{ |ord, props| props.include?(:M) }.keys.freeze
|
32
|
-
|
33
|
-
|
32
|
+
|
33
|
+
EXTENDED_PICTOGRAPHIC = INDEX[:PROPERTIES].select{ |ord, props| props.include?(:X) }.keys.freeze
|
34
|
+
EXTENDED_PICTOGRAPHIC_NO_EMOJI= INDEX[:PROPERTIES].select{ |ord, props| props.include?(:X) && !props.include?(:E) }.keys.freeze
|
34
35
|
EMOJI_KEYCAPS = INDEX[:KEYCAPS].freeze
|
35
36
|
VALID_REGION_FLAGS = INDEX[:FLAGS].freeze
|
36
37
|
VALID_SUBDIVISIONS = INDEX[:SD].freeze
|
@@ -53,12 +54,16 @@ module Unicode
|
|
53
54
|
emoji_modifier_base = "\\p{Emoji Modifier Base}"
|
54
55
|
emoji_component = "\\p{Emoji Component}"
|
55
56
|
emoji_presentation = "\\p{Emoji Presentation}"
|
57
|
+
picto = "\\p{Extended Pictographic}"
|
58
|
+
picto_no_emoji = "\\p{Extended Pictographic}(?<!\\p{Emoji})"
|
56
59
|
else
|
57
60
|
emoji_character = pack_and_join[EMOJI_CHAR]
|
58
61
|
emoji_modifier = pack_and_join[EMOJI_MODIFIERS]
|
59
62
|
emoji_modifier_base = pack_and_join[EMOJI_MODIFIER_BASES]
|
60
63
|
emoji_component = pack_and_join[EMOJI_COMPONENT]
|
61
64
|
emoji_presentation = pack_and_join[EMOJI_PRESENTATION]
|
65
|
+
picto = pack_and_join[EXTENDED_PICTOGRAPHIC]
|
66
|
+
picto_no_emoji = pack_and_join[EXTENDED_PICTOGRAPHIC_NO_EMOJI]
|
62
67
|
end
|
63
68
|
|
64
69
|
emoji_presentation_sequence = \
|
@@ -196,6 +201,14 @@ module Unicode
|
|
196
201
|
REGEX_VALID_INCLUDE_TEXT = Regexp.union(REGEX_VALID, REGEX_TEXT)
|
197
202
|
REGEX_WELL_FORMED_INCLUDE_TEXT = Regexp.union(REGEX_WELL_FORMED, REGEX_TEXT)
|
198
203
|
|
204
|
+
REGEX_PICTO = Regexp.compile(
|
205
|
+
picto
|
206
|
+
)
|
207
|
+
|
208
|
+
REGEX_PICTO_NO_EMOJI = Regexp.compile(
|
209
|
+
picto_no_emoji
|
210
|
+
)
|
211
|
+
|
199
212
|
def self.properties(char)
|
200
213
|
ord = get_codepoint_value(char)
|
201
214
|
props = INDEX[:PROPERTIES][ord]
|
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
module Unicode
|
4
4
|
module Emoji
|
5
|
-
VERSION = "2.
|
6
|
-
EMOJI_VERSION = "12.0"
|
7
|
-
DATA_DIRECTORY = File.expand_path(File.dirname(__FILE__) +
|
8
|
-
INDEX_FILENAME = (DATA_DIRECTORY +
|
5
|
+
VERSION = "2.1.0"
|
6
|
+
EMOJI_VERSION = "12.0"
|
7
|
+
DATA_DIRECTORY = File.expand_path(File.dirname(__FILE__) + "/../../../data/").freeze
|
8
|
+
INDEX_FILENAME = (DATA_DIRECTORY + "/emoji.marshal.gz").freeze
|
9
9
|
|
10
10
|
ENABLE_NATIVE_EMOJI_UNICODE_PROPERTIES = false # As of Ruby 2.6.1, Emoji version 11 is included
|
11
11
|
end
|
data/spec/unicode_emoji_spec.rb
CHANGED
@@ -4,8 +4,8 @@ require "minitest/autorun"
|
|
4
4
|
describe Unicode::Emoji do
|
5
5
|
describe ".properties" do
|
6
6
|
it "returns an Array for Emoji properties if has codepoints" do
|
7
|
-
assert_equal ["Emoji", "Emoji_Presentation"], Unicode::Emoji.properties("π΄")
|
8
|
-
assert_equal ["Emoji"], Unicode::Emoji.properties("β ")
|
7
|
+
assert_equal ["Emoji", "Emoji_Presentation", "Extended_Pictographic"], Unicode::Emoji.properties("π΄")
|
8
|
+
assert_equal ["Emoji", "Extended_Pictographic"], Unicode::Emoji.properties("β ")
|
9
9
|
end
|
10
10
|
|
11
11
|
it "returns nil for Emoji properties if has no codepoints" do
|
@@ -380,6 +380,20 @@ describe Unicode::Emoji do
|
|
380
380
|
end
|
381
381
|
end
|
382
382
|
|
383
|
+
describe "REGEX_PICTO" do
|
384
|
+
it "matches codepoints with Extended_Pictograph property (almost all emoji are, but also others)" do
|
385
|
+
matches = "U+1F32D π HOT DOG, U+203C βΌ DOUBLE EXCLAMATION MARK, U+26E8 β¨ BLACK CROSS ON SHIELD".scan(Unicode::Emoji::REGEX_PICTO)
|
386
|
+
assert_equal ["π", "βΌ", "β¨"], matches
|
387
|
+
end
|
388
|
+
end
|
389
|
+
|
390
|
+
describe "REGEX_PICTO" do
|
391
|
+
it "matches codepoints with Extended_Pictograph property, but no Emoji property" do
|
392
|
+
matches = "U+1F32D π HOT DOG, U+203C βΌ DOUBLE EXCLAMATION MARK, U+26E8 β¨ BLACK CROSS ON SHIELD".scan(Unicode::Emoji::REGEX_PICTO_NO_EMOJI)
|
393
|
+
assert_equal ["β¨"], matches
|
394
|
+
end
|
395
|
+
end
|
396
|
+
|
383
397
|
describe ".list" do
|
384
398
|
it "returns a grouped list of emoji" do
|
385
399
|
assert_includes Unicode::Emoji.list.keys, "Smileys & Emotion"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unicode-emoji
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Lelis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: "[Emoji 12.0] Retrieve emoji data about Unicode codepoints. Also contains
|
14
14
|
a regex to match emoji."
|
@@ -52,8 +52,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '0'
|
54
54
|
requirements: []
|
55
|
-
|
56
|
-
rubygems_version: 2.5.1
|
55
|
+
rubygems_version: 3.0.3
|
57
56
|
signing_key:
|
58
57
|
specification_version: 4
|
59
58
|
summary: Retrieve Emoji data about Unicode codepoints.
|