Compare commits
193 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5476a66d27 | ||
|
|
ee6e06c648 | ||
|
|
da33f740a3 | ||
|
|
07b49d7de7 | ||
|
|
cb5c514d47 | ||
|
|
ed57eb86fd | ||
|
|
33caddce20 | ||
|
|
ac35c33c44 | ||
|
|
70eb18cf81 | ||
|
|
d04fd7701e | ||
|
|
744495f776 | ||
|
|
ea4d73899a | ||
|
|
d7ca116556 | ||
|
|
f7a6bb68c0 | ||
|
|
a8d55fd539 | ||
|
|
5f3415f5fe | ||
|
|
9917299963 | ||
|
|
e13ac61ebd | ||
|
|
6af51fcecd | ||
|
|
a166a06499 | ||
|
|
44c22eac93 | ||
|
|
1c3519c6bb | ||
|
|
55bb37afa4 | ||
|
|
64cd0e9ccf | ||
|
|
0f2f9ce047 | ||
|
|
b1c7878afe | ||
|
|
ce6c4ab12a | ||
|
|
4c47a26900 | ||
|
|
2a97e7e98c | ||
|
|
f6fa963350 | ||
|
|
2eb30abcd1 | ||
|
|
59ef859169 | ||
|
|
be99618db3 | ||
|
|
3675a8781f | ||
|
|
7f6550fe73 | ||
|
|
5361b5639f | ||
|
|
955be747f2 | ||
|
|
d98617abf2 | ||
|
|
bf598c57fc | ||
|
|
d371b81198 | ||
|
|
cefc4b015e | ||
|
|
d1002aa48c | ||
|
|
3cde479627 | ||
|
|
cbf7fb30b9 | ||
|
|
59b3fde91e | ||
|
|
f9e41a8739 | ||
|
|
0a24792305 | ||
|
|
d48b0d90ac | ||
|
|
a5865153a2 | ||
|
|
37b14e495b | ||
|
|
fd84af55cf | ||
|
|
b37659ccd8 | ||
|
|
5766d15e27 | ||
|
|
03dea3bd7d | ||
|
|
69009d4c1e | ||
|
|
22b920f8bd | ||
|
|
55a00803d8 | ||
|
|
6f5518a9ed | ||
|
|
ff9b85268e | ||
|
|
c8cebe22eb | ||
|
|
28a179180b | ||
|
|
b801800935 | ||
|
|
16c382b744 | ||
|
|
0f9400398e | ||
|
|
040aebef64 | ||
|
|
4b2d44d272 | ||
|
|
987463b50b | ||
|
|
3bc9fe0694 | ||
|
|
e55d1457ab | ||
|
|
444ad5b1f4 | ||
|
|
e2911b66f2 | ||
|
|
3e67cc2a60 | ||
|
|
e5eb1e8bcf | ||
|
|
f00846a597 | ||
|
|
4301394495 | ||
|
|
294b5c4c5c | ||
|
|
6ac95753f0 | ||
|
|
3e7a9bebe2 | ||
|
|
70b65c3b10 | ||
|
|
d582f48cbf | ||
|
|
a3cefa60de | ||
|
|
3668746720 | ||
|
|
1a652be3dc | ||
|
|
df9d9491e8 | ||
|
|
667d62c1a6 | ||
|
|
8d7c6fa4e3 | ||
|
|
21c4e27ee2 | ||
|
|
7c91775a0b | ||
|
|
afc91a5235 | ||
|
|
aed88bb347 | ||
|
|
b04991b001 | ||
|
|
8d6aff3fc6 | ||
|
|
3f8feffc48 | ||
|
|
3f6057146c | ||
|
|
61e16ae891 | ||
|
|
9b8ad85de0 | ||
|
|
09125ab983 | ||
|
|
b9ce241bf1 | ||
|
|
ed954928d7 | ||
|
|
7858e79566 | ||
|
|
7bdd3f657f | ||
|
|
68af9e3320 | ||
|
|
7d27517382 | ||
|
|
53325ab398 | ||
|
|
09f66fc38a | ||
|
|
342b76f06e | ||
|
|
6b556ba8b2 | ||
|
|
74a321c07a | ||
|
|
7e10d1a38a | ||
|
|
8ff20db97f | ||
|
|
492e18f849 | ||
|
|
cf852befd9 | ||
|
|
9d313238bd | ||
|
|
840655ad6b | ||
|
|
f394c85d80 | ||
|
|
42a606c804 | ||
|
|
21c4cfe247 | ||
|
|
31a6c8b97b | ||
|
|
36d295f2b7 | ||
|
|
d3b9f412c9 | ||
|
|
a71ba68b6d | ||
|
|
380fd48cfd | ||
|
|
1e485abfe0 | ||
|
|
537ccc48ed | ||
|
|
9cf53bf513 | ||
|
|
0e72fb70cc | ||
|
|
8db519ecbe | ||
|
|
d0d9227065 | ||
|
|
72e9749225 | ||
|
|
16c7e21e5e | ||
|
|
cb3ab19847 | ||
|
|
9ffd0e63aa | ||
|
|
50865e8895 | ||
|
|
a76d5f02f4 | ||
|
|
be21932d23 | ||
|
|
ee403f0b7d | ||
|
|
75d8b4374b | ||
|
|
6de1de2fa1 | ||
|
|
be21f6efc6 | ||
|
|
f21379209f | ||
|
|
b84bf23a5b | ||
|
|
b05ddab3b9 | ||
|
|
365c7a184c | ||
|
|
3db7811891 | ||
|
|
22e198644d | ||
|
|
677084b5ed | ||
|
|
859778cc4b | ||
|
|
a8204fd8d3 | ||
|
|
694f862f73 | ||
|
|
11b4f69f5a | ||
|
|
4e6ce27ed6 | ||
|
|
9308a10b52 | ||
|
|
b841e20394 | ||
|
|
ac3620cf89 | ||
|
|
60a473bfe5 | ||
|
|
df1b6fac6e | ||
|
|
eda537e1a9 | ||
|
|
9967b2ef28 | ||
|
|
d41a53d459 | ||
|
|
06a2df3427 | ||
|
|
757584d2b9 | ||
|
|
f5092b7aa4 | ||
|
|
8a9a8572aa | ||
|
|
3d35b9f862 | ||
|
|
5dea160045 | ||
|
|
6984758915 | ||
|
|
29c25127d0 | ||
|
|
701f434b60 | ||
|
|
112cc8fb8b | ||
|
|
5162959546 | ||
|
|
75ada7cc89 | ||
|
|
0bb789e3e6 | ||
|
|
9beb9c0172 | ||
|
|
ea70c98946 | ||
|
|
7d416739ba | ||
|
|
96295d7871 | ||
|
|
584939127e | ||
|
|
680d1bc59b | ||
|
|
2c58377420 | ||
|
|
3bb3cea8d3 | ||
|
|
5e6dcae949 | ||
|
|
2aaf9693a9 | ||
|
|
0d1a82dc6a | ||
|
|
6b9cdd6eb5 | ||
|
|
75f837e6b5 | ||
|
|
c2286e7c5b | ||
|
|
3e21d95409 | ||
|
|
a86999a7f1 | ||
|
|
b7c2b8e4d8 | ||
|
|
1212951bc6 | ||
|
|
b1736a387c | ||
|
|
f9aba615af | ||
|
|
2741be5eb6 |
24
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
name: Test
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
ruby: ["2.7", "3.0", "3.1"]
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: ${{matrix.ruby}}
|
||||
bundler-cache: true
|
||||
|
||||
- name: Run tests
|
||||
run: bundle exec rake
|
||||
6
.gitignore
vendored
@@ -1,2 +1,6 @@
|
||||
/bin/*
|
||||
.bundle
|
||||
.ruby-version
|
||||
db/NamesList.txt
|
||||
Gemfile.lock
|
||||
vendor/*
|
||||
!vendor/unicode-emoji-test.txt
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
rvm:
|
||||
- 1.9.3
|
||||
- 2.1.2
|
||||
notifications:
|
||||
email: false
|
||||
31
CONTRIBUTING.md
Normal file
@@ -0,0 +1,31 @@
|
||||
Contributions to this project are [released](https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license) to the public under the [project's open source license](LICENSE).
|
||||
|
||||
Some useful tools in development are:
|
||||
|
||||
```
|
||||
script/bootstrap
|
||||
```
|
||||
|
||||
Sets up the development environment. The prerequisites are:
|
||||
|
||||
* Ruby 1.9+
|
||||
* Bundler
|
||||
|
||||
```
|
||||
script/test
|
||||
```
|
||||
|
||||
Runs the test suite.
|
||||
|
||||
```
|
||||
script/console
|
||||
```
|
||||
|
||||
Opens `irb` console with gemoji library preloded for experimentation.
|
||||
|
||||
```
|
||||
script/release
|
||||
```
|
||||
|
||||
For maintainers only: after the gemspec has been edited, this commits the
|
||||
change, tags a release, and pushes it to both GitHub and RubyGems.org.
|
||||
5
Gemfile
@@ -1,6 +1,7 @@
|
||||
source "https://rubygems.org"
|
||||
|
||||
gem "rake"
|
||||
gem "minitest"
|
||||
gem "rake", "~> 10.3.2"
|
||||
gem "minitest", "~> 5.3.5"
|
||||
gem "i18n", "~> 1.8.5"
|
||||
|
||||
gemspec
|
||||
|
||||
13
Gemfile.lock
@@ -1,11 +1,14 @@
|
||||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
gemoji (1.5.0)
|
||||
gemoji (4.1.0)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
concurrent-ruby (1.1.7)
|
||||
i18n (1.8.5)
|
||||
concurrent-ruby (~> 1.0)
|
||||
minitest (5.3.5)
|
||||
rake (10.3.2)
|
||||
|
||||
@@ -14,5 +17,9 @@ PLATFORMS
|
||||
|
||||
DEPENDENCIES
|
||||
gemoji!
|
||||
minitest
|
||||
rake
|
||||
i18n (~> 1.8.5)
|
||||
minitest (~> 5.3.5)
|
||||
rake (~> 10.3.2)
|
||||
|
||||
BUNDLED WITH
|
||||
2.4.10
|
||||
|
||||
19
LICENSE
@@ -1,21 +1,4 @@
|
||||
octocat, squirrel, shipit
|
||||
Copyright (c) 2013 GitHub Inc. All rights reserved.
|
||||
|
||||
bowtie, neckbeard, fu
|
||||
Copyright (c) 2013 37signals, LLC. All rights reserved.
|
||||
|
||||
feelsgood, finnadie, goberserk, godmode, hurtrealbad, rage 1-4, suspect
|
||||
Copyright (c) 2013 id Software. All rights reserved.
|
||||
|
||||
trollface
|
||||
Copyright (c) 2013 whynne@deviantart. All rights reserved.
|
||||
|
||||
All other images
|
||||
Copyright (c) 2013 Apple Inc. All rights reserved.
|
||||
|
||||
Source code:
|
||||
|
||||
Copyright (c) 2013 GitHub, Inc.
|
||||
Copyright (c) 2019 GitHub, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
# Maintainers
|
||||
|
||||
## Releasing a new gem
|
||||
|
||||
If you are just adding new emoji or making a small fix, only increment the patch level "1.0.x". If you need to rename a ton of emojis or making any other radical (but still mostly backwards compatible changes), bump the minor version "1.x.x".
|
||||
|
||||
### Make a release commit
|
||||
|
||||
To prepare the release commit, edit the [gemoji.gemspec](https://github.com/github/gemoji/blob/master/gemoji.gemspec) `version` value. Then make a single commit with the description as "Gemoji 1.x.x". Finally, tag the commit with `v1.x.x`.
|
||||
|
||||
Example commit https://github.com/github/gemoji/commit/v1.0.0
|
||||
|
||||
```
|
||||
$ git ci -m "Gemoji 1.0.0"
|
||||
$ git tag v1.0.0
|
||||
$ git push
|
||||
$ git push --tags
|
||||
```
|
||||
|
||||
### Publish the gem
|
||||
|
||||
Build and push the new gem with
|
||||
|
||||
```
|
||||
$ gem build gemoji.gemspec
|
||||
$ gem push gemoji-1.0.0.gem
|
||||
```
|
||||
45
README.md
@@ -1,7 +1,7 @@
|
||||
gemoji
|
||||
======
|
||||
|
||||
Emoji images and names. See the LICENSE for copyright information.
|
||||
This library contains character information about native emojis.
|
||||
|
||||
|
||||
Installation
|
||||
@@ -13,37 +13,6 @@ Add `gemoji` to your Gemfile.
|
||||
gem 'gemoji'
|
||||
```
|
||||
|
||||
**Sync images**
|
||||
|
||||
Images can be copied to your public directory with `rake emoji` in your app. This is the recommended approach since the images will be available at a consistent location. This works best with cached formatted user content generated by tools like [html-pipeline](https://github.com/jch/html-pipeline).
|
||||
|
||||
``` ruby
|
||||
# Rakefile
|
||||
load 'tasks/emoji.rake'
|
||||
```
|
||||
|
||||
```
|
||||
$ rake emoji
|
||||
```
|
||||
|
||||
**Assets Precompiling**
|
||||
|
||||
If you must, you can manually add all the images to your asset load path.
|
||||
|
||||
``` ruby
|
||||
# config/application.rb
|
||||
config.assets.paths << Emoji.images_path
|
||||
```
|
||||
|
||||
Then have them compiled to public on deploy.
|
||||
|
||||
``` ruby
|
||||
# config/application.rb
|
||||
config.assets.precompile << "emoji/**/*.png"
|
||||
```
|
||||
|
||||
**WARNING** Since there are a ton of images, just adding the path may slow down other lookups if you aren't using it. Compiling all the emojis on deploy will add overhead to your deploy if even the images haven't changed. Theres just so many more superfluous files to iterate over. Also, the urls will be fingerprinted which may not be ideal for referencing from cached content.
|
||||
|
||||
|
||||
Example Rails Helper
|
||||
--------------------
|
||||
@@ -56,8 +25,8 @@ See the [Emoji cheat sheet](http://www.emoji-cheat-sheet.com) for more examples.
|
||||
module EmojiHelper
|
||||
def emojify(content)
|
||||
h(content).to_str.gsub(/:([\w+-]+):/) do |match|
|
||||
if emoji = Emoji.find_by_alias($1) { nil }
|
||||
%(<img alt="#$1" src="#{asset_path("emoji/#{emoji.image_filename}")}" style="vertical-align:middle" width="20" height="20" />)
|
||||
if emoji = Emoji.find_by_alias($1)
|
||||
%(<img alt="#$1" src="#{image_path("emoji/#{emoji.image_filename}")}" style="vertical-align:middle" width="20" height="20" />)
|
||||
else
|
||||
match
|
||||
end
|
||||
@@ -107,6 +76,14 @@ emoji.image_filename #=> "music.png"
|
||||
As you create new emoji, you must ensure that you also create and put the images
|
||||
they reference by their `image_filename` to your assets directory.
|
||||
|
||||
You can customize `image_filename` with:
|
||||
|
||||
```ruby
|
||||
emoji = Emoji.create("music") do |char|
|
||||
char.image_filename = "subdirectory/my_emoji.gif"
|
||||
end
|
||||
```
|
||||
|
||||
For existing emojis, you can edit the list of aliases or add new tags in an edit block:
|
||||
|
||||
```ruby
|
||||
|
||||
15
Rakefile
@@ -9,7 +9,9 @@ end
|
||||
|
||||
namespace :db do
|
||||
desc %(Generate Emoji data files needed for development)
|
||||
task :generate => ['db/Category-Emoji.json', 'db/NamesList.txt']
|
||||
task :generate => [
|
||||
'vendor/unicode-emoji-test.txt',
|
||||
]
|
||||
|
||||
desc %(Dump a list of supported Emoji with Unicode descriptions and aliases)
|
||||
task :dump => :generate do
|
||||
@@ -17,13 +19,6 @@ namespace :db do
|
||||
end
|
||||
end
|
||||
|
||||
emoji_plist = '/System/Library/Input Methods/CharacterPalette.app/Contents/Resources/Category-Emoji.plist'
|
||||
nameslist_url = 'http://www.unicode.org/Public/6.3.0/ucd/NamesList.txt'
|
||||
|
||||
task 'db/Category-Emoji.json' do |t|
|
||||
system "plutil -convert json -r '#{emoji_plist}' -o '#{t.name}'"
|
||||
end
|
||||
|
||||
file 'db/NamesList.txt' do |t|
|
||||
system "curl -fsSL '#{nameslist_url}' -o '#{t.name}'"
|
||||
file 'vendor/unicode-emoji-test.txt' do |t|
|
||||
system 'curl', '-fsSL', 'http://unicode.org/Public/emoji/15.0/emoji-test.txt', '-o', t.name
|
||||
end
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
{
|
||||
"EmojiDataArray" : [
|
||||
{
|
||||
"CVDataTitle" : "EmojiCategory-People",
|
||||
"CVCategoryImage" : "Emoji-HumanImage",
|
||||
"CVCategoryData" : {
|
||||
"CVSkipNullGlyphs" : true,
|
||||
"Data" : "😄,😃,😀,😊,☺️,😉,😍,😘,😚,😗,😙,😜,😝,😛,😳,😁,😔,😌,😒,😞,😣,😢,😂,😭,😪,😥,😰,😅,😓,😩,😫,😨,😱,😠,😡,😤,😖,😆,😋,😷,😎,😴,😵,😲,😟,😦,😧,😈,👿,😮,😬,😐,😕,😯,😶,😇,😏,😑,👲,👳,👮,👷,💂,👶,👦,👧,👨,👩,👴,👵,👱,👼,👸,😺,😸,😻,😽,😼,🙀,😿,😹,😾,👹,👺,🙈,🙉,🙊,💀,👽,💩,🔥,✨,🌟,💫,💥,💢,💦,💧,💤,💨,👂,👀,👃,👅,👄,👍,👎,👌,👊,✊,✌️,👋,✋,👐,👆,👇,👉,👈,🙌,🙏,☝️,👏,💪,🚶,🏃,💃,👫,👪,👬,👭,💏,💑,👯,🙆,🙅,💁,🙋,💆,💇,💅,👰,🙎,🙍,🙇,🎩,👑,👒,👟,👞,👡,👠,👢,👕,👔,👚,👗,🎽,👖,👘,👙,💼,👜,👝,👛,👓,🎀,🌂,💄,💛,💙,💜,💚,❤️,💔,💗,💓,💕,💖,💞,💘,💌,💋,💍,💎,👤,👥,💬,👣,💭"
|
||||
}
|
||||
},
|
||||
{
|
||||
"CVDataTitle" : "EmojiCategory-Nature",
|
||||
"CVCategoryImage" : "Emoji-NatureImage",
|
||||
"CVCategoryData" : {
|
||||
"CVSkipNullGlyphs" : true,
|
||||
"Data" : "🐶,🐺,🐱,🐭,🐹,🐰,🐸,🐯,🐨,🐻,🐷,🐽,🐮,🐗,🐵,🐒,🐴,🐑,🐘,🐼,🐧,🐦,🐤,🐥,🐣,🐔,🐍,🐢,🐛,🐝,🐜,🐞,🐌,🐙,🐚,🐠,🐟,🐬,🐳,🐋,🐄,🐏,🐀,🐃,🐅,🐇,🐉,🐎,🐐,🐓,🐕,🐖,🐁,🐂,🐲,🐡,🐊,🐫,🐪,🐆,🐈,🐩,🐾,💐,🌸,🌷,🍀,🌹,🌻,🌺,🍁,🍃,🍂,🌿,🌾,🍄,🌵,🌴,🌲,🌳,🌰,🌱,🌼,🌐,🌞,🌝,🌚,🌑,🌒,🌓,🌔,🌕,🌖,🌗,🌘,🌜,🌛,🌙,🌍,🌎,🌏,🌋,🌌,🌠,⭐️,☀️,⛅️,☁️,⚡️,☔️,❄️,⛄️,🌀,🌁,🌈,🌊"
|
||||
}
|
||||
},
|
||||
{
|
||||
"CVDataTitle" : "EmojiCategory-Objects",
|
||||
"CVCategoryImage" : "Emoji-ObjectsImage",
|
||||
"CVCategoryData" : {
|
||||
"CVSkipNullGlyphs" : true,
|
||||
"Data" : "🎍,💝,🎎,🎒,🎓,🎏,🎆,🎇,🎐,🎑,🎃,👻,🎅,🎄,🎁,🎋,🎉,🎊,🎈,🎌,🔮,🎥,📷,📹,📼,💿,📀,💽,💾,💻,📱,☎️,📞,📟,📠,📡,📺,📻,🔊,🔉,🔈,🔇,🔔,🔕,📢,📣,⏳,⌛️,⏰,⌚️,🔓,🔒,🔏,🔐,🔑,🔎,💡,🔦,🔆,🔅,🔌,🔋,🔍,🛁,🛀,🚿,🚽,🔧,🔩,🔨,🚪,🚬,💣,🔫,🔪,💊,💉,💰,💴,💵,💷,💶,💳,💸,📲,📧,📥,📤,✉️,📩,📨,📯,📫,📪,📬,📭,📮,📦,📝,📄,📃,📑,📊,📈,📉,📜,📋,📅,📆,📇,📁,📂,✂️,📌,📎,✒️,✏️,📏,📐,📕,📗,📘,📙,📓,📔,📒,📚,📖,🔖,📛,🔬,🔭,📰,🎨,🎬,🎤,🎧,🎼,🎵,🎶,🎹,🎻,🎺,🎷,🎸,👾,🎮,🃏,🎴,🀄️,🎲,🎯,🏈,🏀,⚽️,⚾️,🎾,🎱,🏉,🎳,⛳️,🚵,🚴,🏁,🏇,🏆,🎿,🏂,🏊,🏄,🎣,☕️,🍵,🍶,🍼,🍺,🍻,🍸,🍹,🍷,🍴,🍕,🍔,🍟,🍗,🍖,🍝,🍛,🍤,🍱,🍣,🍥,🍙,🍘,🍚,🍜,🍲,🍢,🍡,🍳,🍞,🍩,🍮,🍦,🍨,🍧,🎂,🍰,🍪,🍫,🍬,🍭,🍯,🍎,🍏,🍊,🍋,🍒,🍇,🍉,🍓,🍑,🍈,🍌,🍐,🍍,🍠,🍆,🍅,🌽"
|
||||
}
|
||||
},
|
||||
{
|
||||
"CVDataTitle" : "EmojiCategory-Places",
|
||||
"CVCategoryImage" : "Emoji-PlacesImage",
|
||||
"CVCategoryData" : {
|
||||
"CVSkipNullGlyphs" : true,
|
||||
"Data" : "🏠,🏡,🏫,🏢,🏣,🏥,🏦,🏪,🏩,🏨,💒,⛪️,🏬,🏤,🌇,🌆,🏯,🏰,⛺️,🏭,🗼,🗾,🗻,🌄,🌅,🌃,🗽,🌉,🎠,🎡,⛲️,🎢,🚢,⛵️,🚤,🚣,⚓️,🚀,✈️,💺,🚁,🚂,🚊,🚉,🚞,🚆,🚄,🚅,🚈,🚇,🚝,🚋,🚃,🚎,🚌,🚍,🚙,🚘,🚗,🚕,🚖,🚛,🚚,🚨,🚓,🚔,🚒,🚑,🚐,🚲,🚡,🚟,🚠,🚜,💈,🚏,🎫,🚦,🚥,⚠️,🚧,🔰,⛽️,🏮,🎰,♨️,🗿,🎪,🎭,📍,🚩,🇯🇵,🇰🇷,🇩🇪,🇨🇳,🇺🇸,🇫🇷,🇪🇸,🇮🇹,🇷🇺,🇬🇧"
|
||||
}
|
||||
},
|
||||
{
|
||||
"CVDataTitle" : "EmojiCategory-Symbols",
|
||||
"CVCategoryImage" : "Emoji-SymbolImage",
|
||||
"CVCategoryData" : {
|
||||
"CVSkipNullGlyphs" : true,
|
||||
"Data" : "1️⃣,2️⃣,3️⃣,4️⃣,5️⃣,6️⃣,7️⃣,8️⃣,9️⃣,0️⃣,🔟,🔢,#️⃣,🔣,⬆️,⬇️,⬅️,➡️,🔠,🔡,🔤,↗️,↖️,↘️,↙️,↔️,↕️,🔄,◀️,▶️,🔼,🔽,↩️,↪️,ℹ️,⏪,⏩,⏫,⏬,⤵️,⤴️,🆗,🔀,🔁,🔂,🆕,🆙,🆒,🆓,🆖,📶,🎦,🈁,🈯️,🈳,🈵,🈴,🈲,🉐,🈹,🈺,🈶,🈚️,🚻,🚹,🚺,🚼,🚾,🚰,🚮,🅿️,♿️,🚭,🈷,🈸,🈂,Ⓜ️,🛂,🛄,🛅,🛃,🉑,㊙️,㊗️,🆑,🆘,🆔,🚫,🔞,📵,🚯,🚱,🚳,🚷,🚸,⛔️,✳️,❇️,❎,✅,✴️,💟,🆚,📳,📴,🅰,🅱,🆎,🅾,💠,➿,♻️,♈️,♉️,♊️,♋️,♌️,♍️,♎️,♏️,♐️,♑️,♒️,♓️,⛎,🔯,🏧,💹,💲,💱,©,®,™,❌,‼️,⁉️,❗️,❓,❕,❔,⭕️,🔝,🔚,🔙,🔛,🔜,🔃,🕛,🕧,🕐,🕜,🕑,🕝,🕒,🕞,🕓,🕟,🕔,🕠,🕕,🕖,🕗,🕘,🕙,🕚,🕡,🕢,🕣,🕤,🕥,🕦,✖️,➕,➖,➗,♠️,♥️,♣️,♦️,💮,💯,✔️,☑️,🔘,🔗,➰,〰,〽️,🔱,◼️,◻️,◾️,◽️,▪️,▫️,🔺,🔲,🔳,⚫️,⚪️,🔴,🔵,🔻,⬜️,⬛️,🔶,🔷,🔸,🔹"
|
||||
}
|
||||
}
|
||||
],
|
||||
"CVViewFontList" : [
|
||||
"AppleColorEmoji"
|
||||
]
|
||||
}
|
||||
114
db/dump.rb
@@ -1,79 +1,69 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "i18n"
|
||||
require 'emoji'
|
||||
require 'json'
|
||||
require_relative './emoji-test-parser'
|
||||
|
||||
names_list = File.expand_path('../NamesList.txt', __FILE__)
|
||||
I18n.config.available_locales = :en
|
||||
items = []
|
||||
|
||||
class UnicodeCharacter
|
||||
attr_reader :code, :description, :aliases
|
||||
_, categories = EmojiTestParser.parse(File.expand_path("../../vendor/unicode-emoji-test.txt", __FILE__))
|
||||
seen_existing = {}
|
||||
|
||||
@index = {}
|
||||
class << self
|
||||
attr_reader :index
|
||||
|
||||
def fetch(code, *args, &block)
|
||||
code = code.to_s(16).rjust(4, '0') if code.is_a?(Integer)
|
||||
index.fetch(code, *args, &block)
|
||||
for category in categories
|
||||
for sub_category in category[:emoji]
|
||||
for emoji_item in sub_category[:emoji]
|
||||
raw = emoji_item[:sequences][0]
|
||||
existing_emoji = Emoji.find_by_unicode(raw) || Emoji.find_by_unicode("#{raw}\u{fe0f}")
|
||||
if seen_existing.key?(existing_emoji)
|
||||
existing_emoji = nil
|
||||
else
|
||||
seen_existing[existing_emoji] = true
|
||||
end
|
||||
description = emoji_item[:description].sub(/^E\d+(\.\d+)? /, '')
|
||||
output_item = {
|
||||
emoji: raw,
|
||||
description: description,
|
||||
category: category[:name],
|
||||
}
|
||||
if existing_emoji
|
||||
output_item.update(
|
||||
aliases: existing_emoji.aliases,
|
||||
tags: existing_emoji.tags,
|
||||
unicode_version: existing_emoji.unicode_version,
|
||||
ios_version: existing_emoji.ios_version,
|
||||
)
|
||||
else
|
||||
output_item.update(
|
||||
aliases: [I18n.transliterate(description).gsub(/\W+/, '_').downcase],
|
||||
tags: [],
|
||||
unicode_version: "15.0",
|
||||
ios_version: "16.4",
|
||||
)
|
||||
end
|
||||
output_item[:skin_tones] = true if emoji_item[:skin_tones]
|
||||
items << output_item
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(code, description)
|
||||
@code = code.downcase
|
||||
@description = description.downcase
|
||||
@aliases = []
|
||||
@references = []
|
||||
|
||||
self.class.index[@code] = self
|
||||
end
|
||||
|
||||
def add_alias(string)
|
||||
@aliases.concat string.split(/\s*,\s*/)
|
||||
end
|
||||
|
||||
def add_reference(code)
|
||||
@references << code.downcase
|
||||
end
|
||||
end
|
||||
|
||||
char = nil
|
||||
missing_emoji = Emoji.all.reject { |e| e.custom? || seen_existing.key?(e) }
|
||||
if missing_emoji.any?
|
||||
$stderr.puts "Error: these `emoji.json` entries were not matched:"
|
||||
$stderr.puts missing_emoji.map { |e| "%s (%s)" % [e.hex_inspect, e.name] }
|
||||
exit 1
|
||||
end
|
||||
|
||||
File.foreach(names_list) do |line|
|
||||
case line
|
||||
when /^[A-F0-9]{4,5}\t/
|
||||
code, desc = line.chomp.split("\t", 2)
|
||||
codepoint = code.hex
|
||||
char = UnicodeCharacter.new(code, desc)
|
||||
when /^\t= /
|
||||
char.add_alias($')
|
||||
when /^\tx .+ - ([A-F0-9]{4,5})\)$/
|
||||
char.add_reference($1)
|
||||
end
|
||||
for emoji in Emoji.all.select(&:custom?)
|
||||
items << {
|
||||
aliases: emoji.aliases,
|
||||
tags: emoji.tags,
|
||||
}
|
||||
end
|
||||
|
||||
trap(:PIPE) { abort }
|
||||
|
||||
items = []
|
||||
variation = Emoji::VARIATION_SELECTOR_16
|
||||
|
||||
for emoji in Emoji.all
|
||||
unicodes = emoji.unicode_aliases.dup
|
||||
|
||||
item = {}
|
||||
|
||||
unless emoji.custom?
|
||||
variation_codepoint = variation.codepoints[0]
|
||||
chars = emoji.raw.codepoints.map { |code| UnicodeCharacter.fetch(code) unless code == variation_codepoint }.compact
|
||||
unicodes.select { |u| u.index(variation) }.each { |u| unicodes.delete(u.sub(variation, '')) }
|
||||
item[:emoji] = unicodes.shift
|
||||
item[:unicodes] = unicodes if unicodes.any?
|
||||
item[:description] = chars.map(&:description).join(' + ')
|
||||
end
|
||||
|
||||
item[:aliases] = emoji.aliases
|
||||
item[:tags] = emoji.tags
|
||||
|
||||
items << item
|
||||
end
|
||||
|
||||
puts JSON.pretty_generate(items)
|
||||
.gsub("\n\n", "\n")
|
||||
.gsub(/,\n( +)/) { "\n%s, " % $1[2..-1] }
|
||||
|
||||
117
db/emoji-test-parser.rb
Normal file
@@ -0,0 +1,117 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module EmojiTestParser
|
||||
VARIATION_SELECTOR_16 = "\u{fe0f}"
|
||||
SKIN_TONES = [
|
||||
"\u{1F3FB}", # light skin tone
|
||||
"\u{1F3FC}", # medium-light skin tone
|
||||
"\u{1F3FD}", # medium skin tone
|
||||
"\u{1F3FE}", # medium-dark skin tone
|
||||
"\u{1F3FF}", # dark skin tone
|
||||
]
|
||||
SKIN_TONES_RE = /(#{SKIN_TONES.join("|")})/o
|
||||
SKIP_TYPES = ["unqualified", "component"]
|
||||
|
||||
module_function
|
||||
|
||||
def parse(filename)
|
||||
File.open(filename, "r:UTF-8") do |file|
|
||||
parse_file(file)
|
||||
end
|
||||
end
|
||||
|
||||
def parse_file(io)
|
||||
data = []
|
||||
emoji_map = {}
|
||||
category = nil
|
||||
sub_category = nil
|
||||
|
||||
io.each do |line|
|
||||
begin
|
||||
if line.start_with?("# group: ")
|
||||
_, group_name = line.split(":", 2)
|
||||
category = {
|
||||
name: group_name.strip,
|
||||
emoji: [],
|
||||
}
|
||||
data << category
|
||||
sub_category = nil
|
||||
elsif line.start_with?("# subgroup: ")
|
||||
_, group_name = line.split(":", 2)
|
||||
sub_category = {
|
||||
name: group_name.strip,
|
||||
emoji: [],
|
||||
}
|
||||
category[:emoji] << sub_category
|
||||
elsif line.start_with?("#") || line.strip.empty?
|
||||
next
|
||||
else
|
||||
row, desc = line.split("#", 2)
|
||||
desc = desc.strip.split(" ", 2)[1]
|
||||
codepoints, qualification = row.split(";", 2)
|
||||
next if SKIP_TYPES.include?(qualification.strip)
|
||||
emoji_raw = codepoints.strip.split.map { |c| c.hex }.pack("U*")
|
||||
emoji_normalized = emoji_raw
|
||||
.gsub(VARIATION_SELECTOR_16, "")
|
||||
.gsub(SKIN_TONES_RE, "")
|
||||
emoji_item = emoji_map[emoji_normalized]
|
||||
if SKIN_TONES.any? { |s| emoji_raw.include?(s) }
|
||||
emoji_item[:skin_tones] = true if emoji_item
|
||||
next
|
||||
end
|
||||
if emoji_item
|
||||
emoji_item[:sequences] << emoji_raw
|
||||
else
|
||||
emoji_item = {
|
||||
sequences: [emoji_raw],
|
||||
description: desc,
|
||||
}
|
||||
emoji_map[emoji_normalized] = emoji_item
|
||||
sub_category[:emoji] << emoji_item
|
||||
end
|
||||
end
|
||||
rescue
|
||||
warn "line: %p" % line
|
||||
raise
|
||||
end
|
||||
end
|
||||
|
||||
[emoji_map, data]
|
||||
end
|
||||
end
|
||||
|
||||
if $0 == __FILE__
|
||||
html_output = false
|
||||
if ARGV[0] == "--html"
|
||||
ARGV.shift
|
||||
html_output = true
|
||||
end
|
||||
|
||||
_, categories = EmojiTestParser.parse(File.expand_path("../../vendor/unicode-emoji-test.txt", __FILE__))
|
||||
|
||||
trap(:PIPE) { abort }
|
||||
|
||||
if html_output
|
||||
puts "<!doctype html>"
|
||||
puts "<meta charset=utf-8>"
|
||||
for category in categories
|
||||
puts "<h2>#{category[:name]}</h2>"
|
||||
for sub_category in category[:emoji]
|
||||
puts "<h3>#{sub_category[:name]}</h3>"
|
||||
puts "<ol>"
|
||||
for char in sub_category[:emoji]
|
||||
puts "<li>"
|
||||
for sequence in char[:sequences]
|
||||
codepoints = sequence.unpack("U*").map { |c| c.to_s(16).upcase }.join(" ")
|
||||
printf '<span class=emoji title="%s">%s</span> ', codepoints, sequence
|
||||
end
|
||||
puts "#{char[:description]}</li>"
|
||||
end
|
||||
puts "</ol>"
|
||||
end
|
||||
end
|
||||
else
|
||||
require "json"
|
||||
puts JSON.pretty_generate(categories)
|
||||
end
|
||||
end
|
||||
25828
db/emoji.json
@@ -66,7 +66,7 @@ li > span {
|
||||
if (emoji.emoji) els[0].textContent = emoji.emoji
|
||||
else {
|
||||
var img = document.createElement('img')
|
||||
img.src = "../images/emoji/" + emoji.aliases[0] + ".png"
|
||||
img.src = "../images/" + emoji.aliases[0] + ".png"
|
||||
els[0].appendChild(img)
|
||||
}
|
||||
els[1].textContent = emoji.description || ''
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
Gem::Specification.new do |s|
|
||||
s.name = "gemoji"
|
||||
s.version = "2.0.0"
|
||||
s.summary = "Emoji conversion and image assets"
|
||||
s.description = "Image assets and character information for emoji."
|
||||
s.version = "4.1.0"
|
||||
s.summary = "Unicode emoji library"
|
||||
s.description = "Character information and metadata for Unicode emoji."
|
||||
|
||||
s.required_ruby_version = '> 1.9'
|
||||
|
||||
@@ -13,9 +13,8 @@ Gem::Specification.new do |s|
|
||||
|
||||
s.files = Dir[
|
||||
"README.md",
|
||||
"images/**/*.png",
|
||||
"LICENSE",
|
||||
"db/emoji.json",
|
||||
"lib/**/*.rb",
|
||||
"lib/tasks/*.rake"
|
||||
]
|
||||
end
|
||||
|
||||
|
Before Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 9.1 KiB |
|
Before Width: | Height: | Size: 1016 B |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 6.4 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 6.0 KiB |