negarmoji 0.1.6 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +28 -48
- data/Rakefile +0 -16
- data/db/filenames.json +3188 -0
- data/db/negarmoji.json +9127 -4621
- data/lib/negarmoji/character.rb +2 -1
- data/lib/negarmoji/emoji.rb +1 -1
- data/lib/negarmoji/version.rb +1 -1
- data/script/downloader.sh +15 -0
- data/script/filename_generator.rb +11 -0
- data/script/json_generator.py +163 -0
- data/script/test.sh +2 -2
- data/script/updater.py +30 -0
- data/test/emoji_test.rb +77 -54
- data/test/test_helper.rb +1 -0
- metadata +8 -6
- data/db/dump.rb +0 -67
- data/db/index.html +0 -113
- data/script/bootstrap +0 -10
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: negarmoji
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mohammad Mahdi Baghbani Pourvahid
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -117,9 +117,8 @@ files:
|
|
117
117
|
- ROADMAP.md
|
118
118
|
- Rakefile
|
119
119
|
- SUPPORT.md
|
120
|
-
- db/dump.rb
|
121
120
|
- db/emoji-test-parser.rb
|
122
|
-
- db/
|
121
|
+
- db/filenames.json
|
123
122
|
- db/negarmoji.json
|
124
123
|
- lib/negarmoji.rb
|
125
124
|
- lib/negarmoji/character.rb
|
@@ -127,13 +126,16 @@ files:
|
|
127
126
|
- lib/negarmoji/version.rb
|
128
127
|
- logo.svg
|
129
128
|
- negarmoji.gemspec
|
130
|
-
- script/bootstrap
|
131
129
|
- script/ci_rubygems.sh
|
132
130
|
- script/dev_release.py
|
133
131
|
- script/dev_revert_tag.py
|
132
|
+
- script/downloader.sh
|
133
|
+
- script/filename_generator.rb
|
134
|
+
- script/json_generator.py
|
134
135
|
- script/test.sh
|
135
136
|
- script/test_module.sh
|
136
137
|
- script/test_style.sh
|
138
|
+
- script/updater.py
|
137
139
|
- test/documentation_test.rb
|
138
140
|
- test/emoji_test.rb
|
139
141
|
- test/test_helper.rb
|
@@ -157,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
159
|
- !ruby/object:Gem::Version
|
158
160
|
version: '0'
|
159
161
|
requirements: []
|
160
|
-
rubygems_version: 3.
|
162
|
+
rubygems_version: 3.1.2
|
161
163
|
signing_key:
|
162
164
|
specification_version: 4
|
163
165
|
summary: Unicode emoji library.
|
data/db/dump.rb
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "emoji"
|
4
|
-
require "json"
|
5
|
-
require_relative "./emoji-test-parser"
|
6
|
-
|
7
|
-
items = []
|
8
|
-
|
9
|
-
_, categories = EmojiTestParser.parse(File.expand_path("../vendor/unicode-emoji-test.txt", __dir__))
|
10
|
-
seen_existing = {}
|
11
|
-
|
12
|
-
categories.each do |category|
|
13
|
-
category[:emoji].each do |sub_category|
|
14
|
-
sub_category[:emoji].each do |emoji_item|
|
15
|
-
raw = emoji_item[:sequences][0]
|
16
|
-
existing_emoji = Emoji.find_by_unicode(raw) || Emoji.find_by_unicode("#{raw}\u{fe0f}")
|
17
|
-
if seen_existing.key?(existing_emoji)
|
18
|
-
existing_emoji = nil
|
19
|
-
else
|
20
|
-
seen_existing[existing_emoji] = true
|
21
|
-
end
|
22
|
-
description = emoji_item[:description].sub(/^E\d+(\.\d+)? /, "")
|
23
|
-
output_item = {
|
24
|
-
:emoji => raw,
|
25
|
-
:description => description,
|
26
|
-
:category => category[:name]
|
27
|
-
}
|
28
|
-
if existing_emoji
|
29
|
-
output_item.update(
|
30
|
-
:aliases => existing_emoji.aliases,
|
31
|
-
:tags => existing_emoji.tags,
|
32
|
-
:unicode_version => existing_emoji.unicode_version,
|
33
|
-
:ios_version => existing_emoji.ios_version
|
34
|
-
)
|
35
|
-
else
|
36
|
-
output_item.update(
|
37
|
-
:aliases => [description.gsub(%r{\W+}, "_").downcase],
|
38
|
-
:tags => [],
|
39
|
-
:unicode_version => "12.1",
|
40
|
-
:ios_version => "13.2"
|
41
|
-
)
|
42
|
-
end
|
43
|
-
output_item[:skin_tones] = true if emoji_item[:skin_tones]
|
44
|
-
items << output_item
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
missing_emoji = Emoji.all.reject { |e| e.custom? || seen_existing.key?(e) }
|
50
|
-
if missing_emoji.any?
|
51
|
-
warn "Error: these `negarmoji.json` entries were not matched:"
|
52
|
-
warn missing_emoji.map { |e| format("%s (%s)", e.hex_inspect, e.name) }
|
53
|
-
exit 1
|
54
|
-
end
|
55
|
-
|
56
|
-
Emoji.all.select(&:custom?).each do |emoji|
|
57
|
-
items << {
|
58
|
-
:aliases => emoji.aliases,
|
59
|
-
:tags => emoji.tags
|
60
|
-
}
|
61
|
-
end
|
62
|
-
|
63
|
-
trap(:PIPE) { abort }
|
64
|
-
|
65
|
-
puts JSON.pretty_generate(items)
|
66
|
-
.gsub("\n\n", "\n")
|
67
|
-
.gsub(%r{,\n( +)}) { format("\n%<regex>s, ", :regex => Regexp.last_match(1)[2..-1]) }
|
data/db/index.html
DELETED
@@ -1,113 +0,0 @@
|
|
1
|
-
<!doctype html>
|
2
|
-
<title>Emoji preview</title>
|
3
|
-
|
4
|
-
<style type="text/css">
|
5
|
-
body {
|
6
|
-
font: 14px/18px Verdana, Arial, sans-serif;
|
7
|
-
padding: 2em;
|
8
|
-
}
|
9
|
-
ol {
|
10
|
-
list-style: none;
|
11
|
-
padding-left: 0;
|
12
|
-
}
|
13
|
-
li {
|
14
|
-
margin-left: 0;
|
15
|
-
margin-top: 5px;
|
16
|
-
clear: left;
|
17
|
-
}
|
18
|
-
li:first-child { display: none; }
|
19
|
-
li > span {
|
20
|
-
display: block;
|
21
|
-
}
|
22
|
-
.emoji {
|
23
|
-
font-size: 50px;
|
24
|
-
line-height: 50px;
|
25
|
-
float: left;
|
26
|
-
margin-right: 20px;
|
27
|
-
}
|
28
|
-
.description {
|
29
|
-
font-style: italic;
|
30
|
-
color: gray;
|
31
|
-
}
|
32
|
-
.aliases span:before, .aliases span:after {
|
33
|
-
content: ":";
|
34
|
-
color: gray;
|
35
|
-
}
|
36
|
-
.tags {
|
37
|
-
font-size: 11px;
|
38
|
-
}
|
39
|
-
.tags span {
|
40
|
-
display: inline-block;
|
41
|
-
padding: 1px 5px 2px;
|
42
|
-
border-radius: 3px;
|
43
|
-
background: #dadada;
|
44
|
-
line-height: 11px;
|
45
|
-
}
|
46
|
-
</style>
|
47
|
-
|
48
|
-
<p><input type=search placeholder="Search..."></p>
|
49
|
-
|
50
|
-
<ol>
|
51
|
-
<li>
|
52
|
-
<span class="emoji"></span>
|
53
|
-
<span class="description"></span>
|
54
|
-
<span class="aliases"></span>
|
55
|
-
<span class="tags"></span>
|
56
|
-
</li>
|
57
|
-
</ol>
|
58
|
-
|
59
|
-
<script>
|
60
|
-
function renderEmoji(emojis) {
|
61
|
-
var item, els, template = document.querySelector('li')
|
62
|
-
for (var emoji, i=0; i < emojis.length; i++) {
|
63
|
-
emoji = emojis[i]
|
64
|
-
item = template.cloneNode(true)
|
65
|
-
els = item.querySelectorAll('span')
|
66
|
-
if (emoji.emoji) els[0].textContent = emoji.emoji
|
67
|
-
else {
|
68
|
-
var img = document.createElement('img')
|
69
|
-
img.src = "../images/" + emoji.aliases[0] + ".png"
|
70
|
-
els[0].appendChild(img)
|
71
|
-
}
|
72
|
-
els[1].textContent = emoji.description || ''
|
73
|
-
els[2].innerHTML = emoji.aliases.map(function(n){ return '<span>'+n+'</span>' }).join(' ')
|
74
|
-
els[3].innerHTML = emoji.tags.map(function(n){ return '<span>'+n+'</span>' }).join(' ')
|
75
|
-
template.parentNode.appendChild(item)
|
76
|
-
|
77
|
-
item._emojiText = (els[2].textContent + ' ' + els[3].textContent).replace(/_/g, '-')
|
78
|
-
}
|
79
|
-
}
|
80
|
-
|
81
|
-
xhr = new XMLHttpRequest
|
82
|
-
xhr.onreadystatechange = function() {
|
83
|
-
if (this.readyState == 4) {
|
84
|
-
json = JSON.parse(this.responseText)
|
85
|
-
renderEmoji(json)
|
86
|
-
}
|
87
|
-
}
|
88
|
-
xhr.open('GET', 'emoji.json', false)
|
89
|
-
xhr.send(null)
|
90
|
-
|
91
|
-
function searchEmoji(query) {
|
92
|
-
var el,
|
93
|
-
re = new RegExp('\\b' + query),
|
94
|
-
els = document.querySelectorAll('li')
|
95
|
-
|
96
|
-
for (var i=1; i < els.length; i++) {
|
97
|
-
el = els[i]
|
98
|
-
if ( !query || re.test(el._emojiText) ) {
|
99
|
-
el.style.display = 'list-item'
|
100
|
-
} else {
|
101
|
-
el.style.display = 'none'
|
102
|
-
}
|
103
|
-
}
|
104
|
-
}
|
105
|
-
|
106
|
-
var timeout, search = document.querySelector('input[type=search]')
|
107
|
-
search.addEventListener('input', function() {
|
108
|
-
var $this = this
|
109
|
-
if (timeout) clearTimeout(timeout)
|
110
|
-
timeout = setTimeout(function(){ searchEmoji($this.value) }, 200)
|
111
|
-
}, false)
|
112
|
-
search.focus()
|
113
|
-
</script>
|