gemojione 4.1.0 β 4.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +66 -60
- data/README.md +16 -0
- data/config/index.json +18847 -89
- data/gemojione.gemspec +4 -4
- data/lib/gemojione.rb +48 -4
- data/lib/gemojione/categories.rb +217 -0
- data/lib/gemojione/index.rb +9 -1
- data/lib/gemojione/index_importer.rb +94 -0
- data/lib/gemojione/version.rb +1 -1
- data/test/gemojione_test.rb +30 -5
- data/test/string_ext_test.rb +1 -1
- metadata +12 -9
data/lib/gemojione/version.rb
CHANGED
data/test/gemojione_test.rb
CHANGED
@@ -95,6 +95,12 @@ describe Gemojione do
|
|
95
95
|
assert_equal "I <img alt=\"β€\" class=\"emoji\" src=\"http://localhost:3000/2764.png\"> Emoji", replaced_string
|
96
96
|
end
|
97
97
|
|
98
|
+
it 'should replace diversity unicode moji properly' do
|
99
|
+
base_string = "Woman elf tone5 π§πΏββοΈ"
|
100
|
+
replaced_string = Gemojione.replace_unicode_moji_with_images(base_string)
|
101
|
+
assert_equal "Woman elf tone5 <img alt=\"π§πΏββοΈ\" class=\"emoji\" src=\"http://localhost:3000/1f9dd-1f3ff-2640.png\">", replaced_string
|
102
|
+
end
|
103
|
+
|
98
104
|
it 'should replace unicode moji with span tag for spritesheet' do
|
99
105
|
with_emoji_config(:use_sprite, true) do
|
100
106
|
base_string = "I β€ Emoji"
|
@@ -177,19 +183,19 @@ describe Gemojione do
|
|
177
183
|
|
178
184
|
it 'should escape html in non html_safe aware strings' do
|
179
185
|
replaced_string = Gemojione.replace_named_moji_with_images(':heart:<script>')
|
180
|
-
assert_equal "<img alt=\"
|
186
|
+
assert_equal "<img alt=\"heart\" class=\"emoji\" src=\"http://localhost:3000/2764.png\"><script>", replaced_string
|
181
187
|
end
|
182
188
|
|
183
189
|
it 'should replace coded moji with img tag' do
|
184
190
|
base_string = "I :heart: Emoji"
|
185
191
|
replaced_string = Gemojione.replace_named_moji_with_images(base_string)
|
186
|
-
assert_equal "I <img alt=\"
|
192
|
+
assert_equal "I <img alt=\"heart\" class=\"emoji\" src=\"http://localhost:3000/2764.png\"> Emoji", replaced_string
|
187
193
|
end
|
188
194
|
|
189
195
|
it 'should replace aliased moji with img tag' do
|
190
196
|
base_string = "Good one :+1:"
|
191
197
|
replaced_string = Gemojione.replace_named_moji_with_images(base_string)
|
192
|
-
assert_equal "Good one <img alt=\"
|
198
|
+
assert_equal "Good one <img alt=\"thumbsup\" class=\"emoji\" src=\"http://localhost:3000/1f44d.png\">", replaced_string
|
193
199
|
end
|
194
200
|
|
195
201
|
it 'should handle nil string' do
|
@@ -204,7 +210,7 @@ describe Gemojione do
|
|
204
210
|
Gemojione.replace_named_moji_with_images(string)
|
205
211
|
end
|
206
212
|
|
207
|
-
assert_equal "<img alt=\"
|
213
|
+
assert_equal "<img alt=\"heart\" class=\"emoji\" src=\"http://localhost:3000/2764.png\"><script>", replaced_string
|
208
214
|
end
|
209
215
|
|
210
216
|
it 'should escape non html_safe? strings in all strings' do
|
@@ -224,7 +230,7 @@ describe Gemojione do
|
|
224
230
|
Gemojione.replace_named_moji_with_images(string)
|
225
231
|
end
|
226
232
|
|
227
|
-
assert_equal "<img alt=\"
|
233
|
+
assert_equal "<img alt=\"heart\" class=\"emoji\" src=\"http://localhost:3000/2764.png\"><a href=\"harmless\">", replaced_string
|
228
234
|
end
|
229
235
|
|
230
236
|
it 'should always return an html_safe string for emoji' do
|
@@ -257,6 +263,13 @@ describe Gemojione do
|
|
257
263
|
end
|
258
264
|
end
|
259
265
|
|
266
|
+
describe 'replace_named_moji_with_unicode_moji' do
|
267
|
+
it 'should replace emoji name with unicode moji' do
|
268
|
+
replaced_string = Gemojione.replace_named_moji_with_unicode_moji("Going for a walk! :woman_walking:")
|
269
|
+
assert_equal "Going for a walk! πΆββοΈ", replaced_string
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
260
273
|
describe "replace_ascii_moji_with_images" do
|
261
274
|
it 'should replace ascii moji with img tag' do
|
262
275
|
replaced_string = Gemojione.replace_ascii_moji_with_images("Emoji is :-)")
|
@@ -271,6 +284,18 @@ describe Gemojione do
|
|
271
284
|
end
|
272
285
|
end
|
273
286
|
|
287
|
+
describe "replace_unicode_moji_with_names" do
|
288
|
+
it 'should replace unicode mojis with their shortnames' do
|
289
|
+
replaced_string = Gemojione.replace_unicode_moji_with_names("Emoji is π")
|
290
|
+
assert_equal "Emoji is :smile:", replaced_string
|
291
|
+
end
|
292
|
+
|
293
|
+
it 'replaces diversity mojis with their shortnames properly' do
|
294
|
+
replaced_string = Gemojione.replace_unicode_moji_with_names("Emoji is π§πΏββοΈ")
|
295
|
+
assert_equal "Emoji is :woman_elf_tone5:", replaced_string
|
296
|
+
end
|
297
|
+
end
|
298
|
+
|
274
299
|
describe "images_path" do
|
275
300
|
it "should always return a valid default path" do
|
276
301
|
path = Gemojione.images_path
|
data/test/string_ext_test.rb
CHANGED
@@ -15,7 +15,7 @@ describe String, 'with Emoji extensions' do
|
|
15
15
|
it 'should replace named moji with an img tag' do
|
16
16
|
base_string = "I :heart: Emoji"
|
17
17
|
replaced_string = base_string.with_emoji_names
|
18
|
-
assert_equal "I <img alt=\"
|
18
|
+
assert_equal "I <img alt=\"heart\" class=\"emoji\" src=\"http://localhost:3000/2764.png\"> Emoji", replaced_string
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
metadata
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gemojione
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Klabnik
|
8
8
|
- Winfield Peterson
|
9
9
|
- Jonathan Wiesel
|
10
|
+
- Allan McLelland
|
10
11
|
autorequire:
|
11
12
|
bindir: bin
|
12
13
|
cert_chain: []
|
13
|
-
date:
|
14
|
+
date: 2020-06-09 00:00:00.000000000 Z
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: json
|
@@ -30,16 +31,16 @@ dependencies:
|
|
30
31
|
name: bundler
|
31
32
|
requirement: !ruby/object:Gem::Requirement
|
32
33
|
requirements:
|
33
|
-
- - "
|
34
|
+
- - ">="
|
34
35
|
- !ruby/object:Gem::Version
|
35
|
-
version: '
|
36
|
+
version: '0'
|
36
37
|
type: :development
|
37
38
|
prerelease: false
|
38
39
|
version_requirements: !ruby/object:Gem::Requirement
|
39
40
|
requirements:
|
40
|
-
- - "
|
41
|
+
- - ">="
|
41
42
|
- !ruby/object:Gem::Version
|
42
|
-
version: '
|
43
|
+
version: '0'
|
43
44
|
- !ruby/object:Gem::Dependency
|
44
45
|
name: rake
|
45
46
|
requirement: !ruby/object:Gem::Requirement
|
@@ -129,6 +130,7 @@ email:
|
|
129
130
|
- steve@steveklabnik.com
|
130
131
|
- winfield.peterson@gmail.com
|
131
132
|
- jonathanwiesel@gmail.com
|
133
|
+
- allan@bonus.ly
|
132
134
|
executables: []
|
133
135
|
extensions: []
|
134
136
|
extra_rdoc_files: []
|
@@ -4767,7 +4769,9 @@ files:
|
|
4767
4769
|
- config/index.json
|
4768
4770
|
- gemojione.gemspec
|
4769
4771
|
- lib/gemojione.rb
|
4772
|
+
- lib/gemojione/categories.rb
|
4770
4773
|
- lib/gemojione/index.rb
|
4774
|
+
- lib/gemojione/index_importer.rb
|
4771
4775
|
- lib/gemojione/railtie.rb
|
4772
4776
|
- lib/gemojione/string_ext.rb
|
4773
4777
|
- lib/gemojione/tasks/install.rake
|
@@ -4776,7 +4780,7 @@ files:
|
|
4776
4780
|
- test/index_test.rb
|
4777
4781
|
- test/string_ext_test.rb
|
4778
4782
|
- test/test_helper.rb
|
4779
|
-
homepage:
|
4783
|
+
homepage: https://github.com/bonusly/gemojione
|
4780
4784
|
licenses:
|
4781
4785
|
- MIT
|
4782
4786
|
metadata: {}
|
@@ -4795,8 +4799,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
4795
4799
|
- !ruby/object:Gem::Version
|
4796
4800
|
version: '0'
|
4797
4801
|
requirements: []
|
4798
|
-
|
4799
|
-
rubygems_version: 2.7.6
|
4802
|
+
rubygems_version: 3.1.3
|
4800
4803
|
signing_key:
|
4801
4804
|
specification_version: 4
|
4802
4805
|
summary: A gem for EmojiOne
|