tanuki_emoji 0.5.0 → 0.6.0
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 +3 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +9 -0
- data/Dangerfile +5 -0
- data/Gemfile.lock +87 -1
- data/README.md +25 -6
- data/lib/tanuki_emoji/character.rb +11 -1
- data/lib/tanuki_emoji/db/gemojione.rb +4 -0
- data/lib/tanuki_emoji/index.rb +14 -2
- data/lib/tanuki_emoji/version.rb +1 -1
- data/lib/tanuki_emoji.rb +9 -2
- data/tanuki_emoji.gemspec +5 -2
- metadata +22 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80827a5454f2eb6ed96102851f315c04215bda544c83892570e6b035ce43cbdd
|
4
|
+
data.tar.gz: c3a97c5c042b909a8544173865f8921e23093333b465fc47ee4f6e306df9480f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5d4fa24f4a0a954df5000d6a04f5c7f8621f6e1b9c2aa5fcb448b3e15af4df927f7033f57c125d9d1b0e11132175cf7351b631c19fe05aa4678c07f402e7636
|
7
|
+
data.tar.gz: 59439b83f98f62e9ace8756accfa327499182309b777864ad87847e567ddfe157b5056844a9033b50548784dec78d51b3d6ab358ef9b0c0a78ffff0e2fe20a67
|
data/.gitlab-ci.yml
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.7.
|
1
|
+
2.7.5
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [0.6.0] - 2022-02-16
|
10
|
+
### Added
|
11
|
+
- `Character` responds to `ascii_aliases` which contain ASCII aliases from Gemojione
|
12
|
+
|
13
|
+
### Fixed
|
14
|
+
- Fixed `TanukiEmoji.add` command, which should now require `category:` to be provided
|
15
|
+
- Fixed issue where `TanukiEmoji::Index#codepoints_pattern` would split apart emoji-modifier pairs
|
16
|
+
|
9
17
|
## [0.5.0] - 2021-09-16
|
10
18
|
### Added
|
11
19
|
- Add Category information into `Character`
|
@@ -49,3 +57,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
49
57
|
[0.3.0]:https://gitlab.com/gitlab-org/tanuki_emoji/-/releases/v0.3.0
|
50
58
|
[0.4.0]:https://gitlab.com/gitlab-org/tanuki_emoji/-/releases/v0.4.0
|
51
59
|
[0.5.0]:https://gitlab.com/gitlab-org/tanuki_emoji/-/releases/v0.5.0
|
60
|
+
[0.6.0]:https://gitlab.com/gitlab-org/tanuki_emoji/-/releases/v0.6.0
|
data/Dangerfile
ADDED
data/Gemfile.lock
CHANGED
@@ -1,19 +1,98 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
tanuki_emoji (0.
|
4
|
+
tanuki_emoji (0.6.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
+
addressable (2.8.0)
|
10
|
+
public_suffix (>= 2.0.2, < 5.0)
|
9
11
|
ast (2.4.2)
|
12
|
+
claide (1.1.0)
|
13
|
+
claide-plugins (0.9.2)
|
14
|
+
cork
|
15
|
+
nap
|
16
|
+
open4 (~> 1.3)
|
17
|
+
colored2 (3.1.2)
|
18
|
+
cork (0.3.0)
|
19
|
+
colored2 (~> 3.1)
|
20
|
+
danger (8.4.2)
|
21
|
+
claide (~> 1.0)
|
22
|
+
claide-plugins (>= 0.9.2)
|
23
|
+
colored2 (~> 3.1)
|
24
|
+
cork (~> 0.1)
|
25
|
+
faraday (>= 0.9.0, < 2.0)
|
26
|
+
faraday-http-cache (~> 2.0)
|
27
|
+
git (~> 1.7)
|
28
|
+
kramdown (~> 2.3)
|
29
|
+
kramdown-parser-gfm (~> 1.0)
|
30
|
+
no_proxy_fix
|
31
|
+
octokit (~> 4.7)
|
32
|
+
terminal-table (>= 1, < 4)
|
33
|
+
danger-gitlab (8.0.0)
|
34
|
+
danger
|
35
|
+
gitlab (~> 4.2, >= 4.2.0)
|
10
36
|
diff-lcs (1.4.4)
|
11
37
|
docile (1.4.0)
|
38
|
+
faraday (1.9.3)
|
39
|
+
faraday-em_http (~> 1.0)
|
40
|
+
faraday-em_synchrony (~> 1.0)
|
41
|
+
faraday-excon (~> 1.1)
|
42
|
+
faraday-httpclient (~> 1.0)
|
43
|
+
faraday-multipart (~> 1.0)
|
44
|
+
faraday-net_http (~> 1.0)
|
45
|
+
faraday-net_http_persistent (~> 1.0)
|
46
|
+
faraday-patron (~> 1.0)
|
47
|
+
faraday-rack (~> 1.0)
|
48
|
+
faraday-retry (~> 1.0)
|
49
|
+
ruby2_keywords (>= 0.0.4)
|
50
|
+
faraday-em_http (1.0.0)
|
51
|
+
faraday-em_synchrony (1.0.0)
|
52
|
+
faraday-excon (1.1.0)
|
53
|
+
faraday-http-cache (2.2.0)
|
54
|
+
faraday (>= 0.8)
|
55
|
+
faraday-httpclient (1.0.1)
|
56
|
+
faraday-multipart (1.0.3)
|
57
|
+
multipart-post (>= 1.2, < 3)
|
58
|
+
faraday-net_http (1.0.1)
|
59
|
+
faraday-net_http_persistent (1.2.0)
|
60
|
+
faraday-patron (1.0.0)
|
61
|
+
faraday-rack (1.0.0)
|
62
|
+
faraday-retry (1.0.3)
|
63
|
+
git (1.10.2)
|
64
|
+
rchardet (~> 1.8)
|
65
|
+
gitlab (4.18.0)
|
66
|
+
httparty (~> 0.18)
|
67
|
+
terminal-table (>= 1.5.1)
|
68
|
+
gitlab-dangerfiles (2.8.0)
|
69
|
+
danger (>= 8.3.1)
|
70
|
+
danger-gitlab (>= 8.0.0)
|
71
|
+
httparty (0.20.0)
|
72
|
+
mime-types (~> 3.0)
|
73
|
+
multi_xml (>= 0.5.2)
|
74
|
+
kramdown (2.3.1)
|
75
|
+
rexml
|
76
|
+
kramdown-parser-gfm (1.1.0)
|
77
|
+
kramdown (~> 2.0)
|
78
|
+
mime-types (3.4.1)
|
79
|
+
mime-types-data (~> 3.2015)
|
80
|
+
mime-types-data (3.2022.0105)
|
81
|
+
multi_xml (0.6.0)
|
82
|
+
multipart-post (2.1.1)
|
83
|
+
nap (1.1.0)
|
84
|
+
no_proxy_fix (0.1.2)
|
85
|
+
octokit (4.22.0)
|
86
|
+
faraday (>= 0.9)
|
87
|
+
sawyer (~> 0.8.0, >= 0.5.3)
|
88
|
+
open4 (1.3.4)
|
12
89
|
parallel (1.20.1)
|
13
90
|
parser (3.0.2.0)
|
14
91
|
ast (~> 2.4.1)
|
92
|
+
public_suffix (4.0.6)
|
15
93
|
rainbow (3.0.0)
|
16
94
|
rake (13.0.6)
|
95
|
+
rchardet (1.8.0)
|
17
96
|
regexp_parser (2.1.1)
|
18
97
|
rexml (3.2.5)
|
19
98
|
rspec (3.10.0)
|
@@ -43,6 +122,10 @@ GEM
|
|
43
122
|
rubocop-ast (1.8.0)
|
44
123
|
parser (>= 3.0.1.1)
|
45
124
|
ruby-progressbar (1.11.0)
|
125
|
+
ruby2_keywords (0.0.5)
|
126
|
+
sawyer (0.8.2)
|
127
|
+
addressable (>= 2.3.5)
|
128
|
+
faraday (> 0.8, < 2.0)
|
46
129
|
simplecov (0.21.2)
|
47
130
|
docile (~> 1.1)
|
48
131
|
simplecov-html (~> 0.11)
|
@@ -51,6 +134,8 @@ GEM
|
|
51
134
|
simplecov (~> 0.8)
|
52
135
|
simplecov-html (0.12.3)
|
53
136
|
simplecov_json_formatter (0.1.3)
|
137
|
+
terminal-table (3.0.2)
|
138
|
+
unicode-display_width (>= 1.1.1, < 3)
|
54
139
|
unicode-display_width (2.0.0)
|
55
140
|
|
56
141
|
PLATFORMS
|
@@ -59,6 +144,7 @@ PLATFORMS
|
|
59
144
|
x86_64-linux
|
60
145
|
|
61
146
|
DEPENDENCIES
|
147
|
+
gitlab-dangerfiles (~> 2.8.0)
|
62
148
|
rake (~> 13.0)
|
63
149
|
rspec (~> 3.0)
|
64
150
|
rspec_junit_formatter (~> 0.4.0)
|
data/README.md
CHANGED
@@ -70,17 +70,36 @@ File.join(TanukiEmoji.images_path, c.image_name)
|
|
70
70
|
|
71
71
|
## Development
|
72
72
|
|
73
|
-
|
74
|
-
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
73
|
+
In order to contribute to TanukiEmoji gem, you need to:
|
75
74
|
|
76
|
-
|
77
|
-
|
78
|
-
|
75
|
+
1. Clone the repository to your local machine.
|
76
|
+
1. Run `bin/setup` to initialize `git submodules` and install ruby dependencies.
|
77
|
+
|
78
|
+
Many workflow tasks are available as Rake tasks:
|
79
|
+
|
80
|
+
- `bundle exec rake spec` can be used to run tests.
|
81
|
+
- `bundle exec rake install` will build and install the gem on your local machine.
|
82
|
+
|
83
|
+
To load an interactive console with the gem you can use `bin/console`.
|
84
|
+
|
85
|
+
### Releasing a new version
|
86
|
+
|
87
|
+
Before releasing a new gem, create a MR with the following changes:
|
88
|
+
|
89
|
+
- Update `CHANGELOG.md` by adding a version section and moving any changes from `[Unreleased]` to it.
|
90
|
+
- Update the version number in `lib/tanuki_emoji/version.rb`.
|
91
|
+
|
92
|
+
With that MR approved and merged, pull the changes to your `main` branch and run `bundle exec rake release`.
|
93
|
+
This command will create a git tag for the version and push it, generate a new `.gem` file and publish into
|
79
94
|
[rubygems.org](https://rubygems.org).
|
80
95
|
|
81
96
|
## Contributing
|
82
97
|
|
83
|
-
See [CONTRIBUTING.md](CONTRIBUTING.md).
|
98
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) and [Development](#development) section.
|
99
|
+
|
100
|
+
When you create a new Merge Request, consider adding your change to the `CHANGELOG.md` if it includes a new feature, a feature change or a fix.
|
101
|
+
|
102
|
+
Please do not increase the version numbers, as this is handled by a separate process when we [release a new version](#releasing-a-new-version).
|
84
103
|
|
85
104
|
## License
|
86
105
|
|
@@ -16,11 +16,12 @@ module TanukiEmoji
|
|
16
16
|
|
17
17
|
# This denotes a "plain" (black/white) or "textual" version
|
18
18
|
PLAIN_VARIATION_SELECTOR = 0xFE0E
|
19
|
+
PLAIN_VARIATION_SELECTOR_STRING = PLAIN_VARIATION_SELECTOR.chr(Encoding::UTF_8)
|
19
20
|
|
20
21
|
# Zero Width Joiner is used in sequences to indicate they should all be evaluated and displayed as a single thing
|
21
22
|
ZWJ_TAG = 0x200D
|
22
23
|
|
23
|
-
attr_reader :name, :codepoints, :codepoints_alternates, :alpha_code, :aliases, :description, :category
|
24
|
+
attr_reader :name, :codepoints, :codepoints_alternates, :alpha_code, :aliases, :ascii_aliases, :description, :category
|
24
25
|
|
25
26
|
attr_accessor :unicode_version
|
26
27
|
|
@@ -35,6 +36,7 @@ module TanukiEmoji
|
|
35
36
|
@codepoints_alternates = []
|
36
37
|
@alpha_code = self.class.format_alpha_code(alpha_code)
|
37
38
|
@aliases = []
|
39
|
+
@ascii_aliases = []
|
38
40
|
@description = description
|
39
41
|
@category = category
|
40
42
|
end
|
@@ -53,6 +55,13 @@ module TanukiEmoji
|
|
53
55
|
aliases << self.class.format_alpha_code(alpha_code)
|
54
56
|
end
|
55
57
|
|
58
|
+
# Add alternative ASCII aliases to this character
|
59
|
+
#
|
60
|
+
# @param [String] ascii_string
|
61
|
+
def add_ascii_alias(ascii_string)
|
62
|
+
ascii_aliases << ascii_string
|
63
|
+
end
|
64
|
+
|
56
65
|
# Return a Hex formatted version of the Unicode code points
|
57
66
|
#
|
58
67
|
# @return [String] Hex formatted version of the unicode
|
@@ -94,6 +103,7 @@ module TanukiEmoji
|
|
94
103
|
codepoints_alternates == other.codepoints_alternates &&
|
95
104
|
alpha_code == other.alpha_code &&
|
96
105
|
aliases == other.aliases &&
|
106
|
+
ascii_aliases == other.ascii_aliases &&
|
97
107
|
description == other.description
|
98
108
|
end
|
99
109
|
|
data/lib/tanuki_emoji/index.rb
CHANGED
@@ -14,6 +14,7 @@ module TanukiEmoji
|
|
14
14
|
# Add a new Emoji to the index
|
15
15
|
#
|
16
16
|
# @param [TanukiEmoji::Character] emoji
|
17
|
+
# @return [TanukiEmoji::Character]
|
17
18
|
def add(emoji)
|
18
19
|
@name_index ||= {}
|
19
20
|
@alpha_code_index ||= {}
|
@@ -88,9 +89,14 @@ module TanukiEmoji
|
|
88
89
|
|
89
90
|
# Return a regular expression that can be used to search for emoji codepoints
|
90
91
|
#
|
92
|
+
# @param [Boolean] exclude_text_presentation exclude codepoints and sequences with text presentation selector
|
91
93
|
# @return [Regexp] regular expression that matches indexed emoji codepoints
|
92
|
-
def codepoints_pattern
|
93
|
-
|
94
|
+
def codepoints_pattern(exclude_text_presentation: false)
|
95
|
+
possible_codepoints = sorted_codepoints.map { |moji, _| Regexp.escape(moji) }.join('|')
|
96
|
+
variation_selector = ""
|
97
|
+
variation_selector = /(?!#{TanukiEmoji::Character::PLAIN_VARIATION_SELECTOR_STRING})/ if exclude_text_presentation
|
98
|
+
|
99
|
+
/(#{possible_codepoints})#{variation_selector}/
|
94
100
|
end
|
95
101
|
|
96
102
|
private
|
@@ -109,5 +115,11 @@ module TanukiEmoji
|
|
109
115
|
Db::Gemojione.new(index: self).load!
|
110
116
|
Db::UnicodeVersion.new(index: self).load!
|
111
117
|
end
|
118
|
+
|
119
|
+
# Order the codepoints to match the most specific (longest) sequences first,
|
120
|
+
# so #gsub doesn't unintentionally split an emoji from its modifier(s).
|
121
|
+
def sorted_codepoints
|
122
|
+
@sorted_codepoints ||= @codepoints_index.dup.sort_by { |_, v| -v.hex.length }
|
123
|
+
end
|
112
124
|
end
|
113
125
|
end
|
data/lib/tanuki_emoji/version.rb
CHANGED
data/lib/tanuki_emoji.rb
CHANGED
@@ -38,8 +38,15 @@ module TanukiEmoji
|
|
38
38
|
# @param [String] name
|
39
39
|
# @param [String] codepoints
|
40
40
|
# @param [String] alpha_code
|
41
|
-
|
42
|
-
|
41
|
+
# @param [String] description
|
42
|
+
# @param [String] category
|
43
|
+
# @return [TanukiEmoji::Character]
|
44
|
+
def self.add(name, codepoints:, alpha_code:, description:, category:)
|
45
|
+
emoji = Character.new(name,
|
46
|
+
codepoints: codepoints,
|
47
|
+
alpha_code: alpha_code,
|
48
|
+
description: description,
|
49
|
+
category: category)
|
43
50
|
|
44
51
|
index.add(emoji)
|
45
52
|
end
|
data/tanuki_emoji.gemspec
CHANGED
@@ -15,8 +15,9 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
16
16
|
|
17
17
|
spec.metadata['homepage_uri'] = spec.homepage
|
18
|
-
spec.metadata['source_code_uri'] =
|
19
|
-
spec.metadata['changelog_uri'] =
|
18
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
19
|
+
spec.metadata['changelog_uri'] = "#{spec.homepage}/-/blob/main/CHANGELOG.md"
|
20
|
+
spec.metadata['bug_tracker_uri'] = "#{spec.homepage}/-/issues"
|
20
21
|
|
21
22
|
# Specify which files should be added to the gem when it is released.
|
22
23
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -27,4 +28,6 @@ Gem::Specification.new do |spec|
|
|
27
28
|
git_files + asset_files
|
28
29
|
end
|
29
30
|
spec.require_paths = ['lib']
|
31
|
+
|
32
|
+
spec.add_development_dependency 'gitlab-dangerfiles', '~> 2.8.0'
|
30
33
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tanuki_emoji
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriel Mazetto
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
11
|
+
date: 2022-02-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: gitlab-dangerfiles
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.8.0
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.8.0
|
13
27
|
description: Tanuki Emoji provides Emoji character information and metadata with support
|
14
28
|
for Noto Emoji resources as fallback
|
15
29
|
email:
|
@@ -27,6 +41,7 @@ files:
|
|
27
41
|
- ".ruby-version"
|
28
42
|
- CHANGELOG.md
|
29
43
|
- CONTRIBUTING.md
|
44
|
+
- Dangerfile
|
30
45
|
- Gemfile
|
31
46
|
- Gemfile.lock
|
32
47
|
- LICENSE.txt
|
@@ -1860,7 +1875,8 @@ metadata:
|
|
1860
1875
|
homepage_uri: https://gitlab.com/gitlab-org/tanuki_emoji
|
1861
1876
|
source_code_uri: https://gitlab.com/gitlab-org/tanuki_emoji
|
1862
1877
|
changelog_uri: https://gitlab.com/gitlab-org/tanuki_emoji/-/blob/main/CHANGELOG.md
|
1863
|
-
|
1878
|
+
bug_tracker_uri: https://gitlab.com/gitlab-org/tanuki_emoji/-/issues
|
1879
|
+
post_install_message:
|
1864
1880
|
rdoc_options: []
|
1865
1881
|
require_paths:
|
1866
1882
|
- lib
|
@@ -1876,7 +1892,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1876
1892
|
version: '0'
|
1877
1893
|
requirements: []
|
1878
1894
|
rubygems_version: 3.1.6
|
1879
|
-
signing_key:
|
1895
|
+
signing_key:
|
1880
1896
|
specification_version: 4
|
1881
1897
|
summary: Tanuki Emoji
|
1882
1898
|
test_files: []
|