-
Notifications
You must be signed in to change notification settings - Fork 785
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get emoji list & aliases from data file instead of symlinks #47
Conversation
Emoji aliases as symlinks didn't scale.
Pros:
Cons:
Open questions:
/cc @javan |
General 👍 I think the directly alias linking is fine to 🔥. Maybe we just want to release this as a new major version.
Yeah. Can we document what encoding that file is in. Assuming UTF-8, just want to be clear somewhere.
🔥 them and lets do a major release.
Yeah, the api should encompass image name and aliases now. |
puts " = #{aliases.join(', ')}" if aliases.any? | ||
puts " ~ #{tags.join(', ')}" if tags.any? | ||
puts " + #{unicodes.map{|u| Emoji::Character.hex_inspect(u) }.join(', ')}" if unicodes.any? | ||
# puts " * #{spec_aliases.join(', ')}" if spec_aliases.any? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is dump supposed to write back out to the .txt
file somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used it to create the .txt file via shell redirection, but yeah, it could write back to the .txt
file maybe. Or I can just 💣 the dump script? Honestly, I don't think that the .txt file will need being generated programatically anymore because it's supposed to be edited by hand from now on.
/cc @aroben for emoji too |
What do you think about using JSON instead since we already store emoji in |
On Wed, Jun 4, 2014 at 3:22 AM, Javan Makhmali [email protected]
I don't like JSON files as a source of data that's supposed to be manually We don't actually store emojis in Category-Emoji.json. That's simply a dump |
Question about aliases, do they have to be globally unique? How are we validating that if so? |
On Wed, Jun 4, 2014 at 10:42 AM, Joshua Peek [email protected]
|
True, that is easier, but IMO we don't need to make it easy to add aliases. In fact, I'd rather freeze our current aliases (and possibly allow people to extend them in their app). I'm more concerned with how it easy it us for us to add new emojis if / when Apple releases them. |
Good point.
Yeah, a set of new emojis are currently being discussed by the unicode community |
On Thu, Jun 5, 2014 at 7:43 PM, Javan Makhmali [email protected]
Yeah, I agree we shouldn't be going wild with new aliases. I intend to use
👍 for in-app extensions. Also, an API for adding custom emoji might be So do both of you think we should have a JSON format instead of plaintext As for new emojis, that's why we have "Category-Emoji.json" extracted from |
I'm not opposed to the plain text file and I like how readable it is. Just pushing back a little since it's a made up format, which makes it less useful universally. If, for example, http://www.emoji-cheat-sheet.com/ was built with a language other than Ruby, they'd have to write their own parser to consume our list of emojis. The emoji PNGs were extracted with https://github.com/tmm1/emoji-extractor. It's awesome, but it saves the files like |
On Fri, Jun 6, 2014 at 8:57 PM, Javan Makhmali [email protected]
That's a good point. |
Don't worry about 1.8. Consider it 1.9+. And if you wanted 1.8, you could just install the json gem as a polyfill. |
@josh @javan OK the list of emoji is now in JSON. Comma-first style to allow adding/removing specific aliases or tags without affecting surrounding lines. However, now that I think about it, I should probably configure CI or something to fail if someone tried to remove an existing alias via a PR, since that would constitute a breaking change. Will probably make such and other sanity checks in another PR. I would merge this PR in an attempt to start moving master branch towards the next major release. Other tasks that I had in mind for separate PRs:
|
Seems like we don't need |
= green_heart | ||
❤️ (2764-fe0f) heavy black heart | ||
= heart | ||
~ love |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current release of gemoji also maps a plain U+2764 character to this image. Is it intentional that we're no longer doing that? (Windows shows an emoji for plain U+2764, OS X does not.)
Did you generate emoji.json manually? Should we have a script that will generate it? |
It would be great to sort emoji.txt and emoji.json in ascending code point order. |
So many great things in this PR! I love the test that the README docs actually work. |
Looks like |
Thanks @aroben for the review. I'll fix these items and work towards wrapping up a 2.0 release soon |
Previously, emoji name & unicode aliases were determined by following symlinks among `images/emoji/*.png`. This led to nontrivial code for resolving these aliases, made it tricky for contributors to add new aliases and inspect existing ones, and didn't leave room for adding metadata to emojis such as tags or descriptions from the Unicode spec. Moreover, the aliases as symlinks led to duplication of image assets in users' applications, with `hocho.png` and `knife.png` representing the same emoji but being two separate images. Users were also unsure what to do with `unicode/{HEX-NAME}.png` files, which would end up among their images after running the `:emoji` task. This change removes the symlinks support and creates the list of emojis and their aliases in `emoji.json`. A single emoji is now represented with an Emoji::Character instance, which has the `image_filename` method to determine the path to the corresponding image instead of having to construct it manually.
This list contains textual descriptions for emoji characters.
This script was used to construct the initial `emoji.json` file. Example: rake db:dump | less -r
Instead of an unfriendly LocalJumpError, raise the Emoji::NotFound exception with a helpful message if the block was not given. If a fallback block was given, yield the value for which the lookup failed.
This brings it up to par with `aliases`, which includes `name` as well.
Ensure that tags accurately describe the original meaning of the emoji (with respect to its definition from Unicode spec).
Get emoji list & aliases from data file instead of symlinks
@aroben I've nuked |
⚡⚡⚡ On Fri, Jun 27, 2014 at 6:33 AM, Mislav Marohnić [email protected]
|
Alternative to #44
Previously, emoji name & unicode aliases were determined by following symlinks among
images/emoji/*.png
. This led to nontrivial code for resolving these aliases, made it tricky for contributors to add new aliases and inspect existing ones, and didn't leave room for adding metadata to emojis such as tags or descriptions from the Unicode spec.Moreover, the aliases as symlinks led to duplication of image assets in users' applications, with
hocho.png
andknife.png
representing the same emoji but being two separate images. Users were also unsure what to do withunicode/{HEX-NAME}.png
files, which would end up among their images after running the:emoji
task.This change removes the symlinks support and creates the list of emojis and their aliases in
emoji.txt
. A single emoji is now represented with an Emoji::Character instance, which has theimage_filename
method to determine the path to the corresponding image instead of having to construct it manually.This is kind of a breaking change, however. Since neither
hocho.png
norknife.png
images won't exist anymore in people's image assets (only theunicode/{HEX-CODE}.png
version of each emoji), simply gsubbing:knife:
with<img src="/images/emoji/knife.png">
won't work anymore. Instead, users need to look up the Emoji::Character and use itsimage_filename
method. I believe this is a worthwhile breaking change, since it gives us leverage to shift things around internally in future revisions (such as changing the images naming scheme) and not have to break anything for users again./cc @josh @muan