-
Notifications
You must be signed in to change notification settings - Fork 787
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
Adds support for aliases #44
Conversation
Do lookups via `Hash#fetch`, and return nil directly without having to create an intermediate empty array for missed lookups
Some emojis have multiple named mappings pointing to it, like "hocho" = "knife". This tweaks the inverted_mapping hash to keep track of all names for an emoji, not just the last one registered.
Example: require 'emoji/aliases' Emoji.aliases_for('smile') #=> [...]
Example: rake db:dump | less -r
It should be in the standard require.
I kinda like not normalizing to a canonical name. That requires the use of a suggester. I'd rather have literal We currently have a issue with the symlinks we might need to work out first. When the gem is built, symlinks get stripped. So we might need to move to a data file anyway. |
👍 to killing all the symlinked files. The gem should just contain the images in If the data file mapped each unicode to an array of names ( The install task could then create all the symlinks. |
Here's the difference right now with "names" vs. "aliases":
This creates 2 different vectors for referring to a single emoji. I don't like that, and even before this PR I didn't like the symlink style:
I think I'll open a separate PR to first propose how I would get rid of symlinks. Adding aliases to the current situation would just be confusing. |
Rad. |
🤘 |
Closing this; going with #47 instead |
The use-case is to enhance the completion suggester for entering emojis.
This initial set of aliases is inspired by @muan's emojis.json.
This is 🚧 🚧 since there are a couple of open questions:
(g)emoji
?This PR adds another scheme for aliasing, and now we end up with 2 levels of aliasing, which I don't like. I would prefer to get rid of multiple aliases on the filesystem and just go the route with aliases kept in a data file. However, if we delete the filesystem aliases then we break backwards compatibility, since people might be using
:knife:
in their textareas andknife.png
in their apps.