jollygoodcode / twemoji Goto Github PK
View Code? Open in Web Editor NEW:shipit: Twitter emoji in Ruby :blush:
Home Page: https://github.com/jollygoodcode/twemoji
License: MIT License
:shipit: Twitter emoji in Ruby :blush:
Home Page: https://github.com/jollygoodcode/twemoji
License: MIT License
find_by_unicode doesn't work with country codes.
Currently only has 827 emojis while it should have 872 emojis.
There is an emoji named "eye in speech bubble" in the Unicode Emoji List.
eye in speech bubble - Emoji List, v5.0
According to this list, the emoji consists of codepoint U+1F441 U+FE0F U+200D U+1F5E8 U+FE0F
,
but the following code returns nil.
Twemoji.find_by(unicode: "\u{1f441}\u{fe0f}\u{200d}\u{1f5e8}\u{fe0f}")
This is because the emoji has a codepoint U+1F441 U+200D U+1F5E8
in this gem.
Codepoint U+FE0F
is "emoji presentation selector", a variation selector for emojis.
Similar issues are also found in keycap emojis. (:hash:
, :asterisk:
, etc.)
On the other hand, :{man,woman}-{kiss,heart}-{man,woman}:
emojis contains U+FE0F
in this gem.
I think this is a problem.
I think this issue should be fixed, but I have no idea.
What do you think?
// note that these categories are copied from Slack
// be careful, there are ~20 differences in synonyms, e.g. :boom: vs. :collision:
// a few Emoji are actually missing from the Slack categories as well (?), and were added
const groups = [
{
name:"people",
fullname:"People",
tabicon:"grinning",
icons:[
"slight_smile",
"grinning",
"grin",
"joy",
"smiley",
"smile",
"sweat_smile",
"laughing",
"innocent",
"smiling_imp",
"imp",
"wink",
"blush",
"relaxed",
"yum",
"relieved",
"heart_eyes",
"sunglasses",
"smirk",
"neutral_face",
"expressionless",
"unamused",
"sweat",
"pensive",
"confused",
"confounded",
"kissing",
"kissing_heart",
"kissing_smiling_eyes",
"kissing_closed_eyes",
"stuck_out_tongue",
"stuck_out_tongue_winking_eye",
"stuck_out_tongue_closed_eyes",
"disappointed",
"worried",
"angry",
"rage",
"cry",
"persevere",
"triumph",
"disappointed_relieved",
"frowning",
"anguished",
"fearful",
"weary",
"sleepy",
"tired_face",
"grimacing",
"sob",
"open_mouth",
"hushed",
"cold_sweat",
"scream",
"astonished",
"flushed",
"sleeping",
"dizzy_face",
"no_mouth",
"mask",
"smile_cat",
"joy_cat",
"smiley_cat",
"heart_eyes_cat",
"smirk_cat",
"kissing_cat",
"pouting_cat",
"crying_cat_face",
"scream_cat",
"footprints",
"bust_in_silhouette",
"busts_in_silhouette",
"baby",
"boy",
"girl",
"man",
"woman",
"family",
"couple",
"two_men_holding_hands",
"two_women_holding_hands",
"dancers",
"bride_with_veil",
"person_with_blond_hair",
"man_with_gua_pi_mao",
"man_with_turban",
"older_man",
"older_woman",
"cop",
"construction_worker",
"princess",
"guardsman",
"angel",
"santa",
"ghost",
"japanese_ogre",
"japanese_goblin",
"hankey",
"skull",
"alien",
"space_invader",
"bow",
"information_desk_person",
"no_good",
"ok_woman",
"raising_hand",
"person_with_pouting_face",
"person_frowning",
"massage",
"haircut",
"couple_with_heart",
"couplekiss",
"raised_hands",
"clap",
"hand",
"ear",
"eyes",
"nose",
"lips",
"kiss",
"tongue",
"nail_care",
"wave",
"+1",
"-1",
"point_up",
"point_up_2",
"point_down",
"point_left",
"point_right",
"ok_hand",
"v",
"facepunch",
"fist",
"raised_hand",
"muscle",
"open_hands",
"pray",
"anger_right",
"eye",
"frowning2",
"hand_splayed",
"head_bandage",
"hugging",
"middle_finger",
"money_mouth",
"nerd",
"poop",
"punch",
"robot",
"rolling_eyes",
"skull_crossbones",
"slight_frown",
"speaking_head",
"spy",
"thinking",
"thumbsdown",
"thumbsup",
"upside_down",
"urn",
"vulcan",
"wind_blowing_face",
"writing_hand",
"zipper_mouth"
]
},
{
name:"nature",
fullname:"Nature",
tabicon:"evergreen_tree",
icons:[
"seedling",
"evergreen_tree",
"deciduous_tree",
"palm_tree",
"cactus",
"tulip",
"cherry_blossom",
"rose",
"hibiscus",
"sunflower",
"blossom",
"bouquet",
"ear_of_rice",
"herb",
"four_leaf_clover",
"maple_leaf",
"fallen_leaf",
"leaves",
"mushroom",
"chestnut",
"rat",
"mouse2",
"mouse",
"hamster",
"ox",
"water_buffalo",
"cow2",
"cow",
"tiger2",
"leopard",
"tiger",
"rabbit2",
"rabbit",
"cat2",
"cat",
"racehorse",
"horse",
"ram",
"sheep",
"goat",
"rooster",
"chicken",
"baby_chick",
"hatching_chick",
"hatched_chick",
"bird",
"penguin",
"elephant",
"dromedary_camel",
"camel",
"boar",
"pig2",
"pig",
"pig_nose",
"dog2",
"poodle",
"dog",
"wolf",
"bear",
"koala",
"panda_face",
"monkey_face",
"see_no_evil",
"hear_no_evil",
"speak_no_evil",
"monkey",
"dragon",
"dragon_face",
"crocodile",
"snake",
"turtle",
"frog",
"whale2",
"whale",
"dolphin",
"octopus",
"fish",
"tropical_fish",
"blowfish",
"shell",
"snail",
"bug",
"ant",
"bee",
"beetle",
"feet",
"zap",
"fire",
"crescent_moon",
"sunny",
"partly_sunny",
"cloud",
"droplet",
"sweat_drops",
"umbrella",
"dash",
"snowflake",
"star2",
"star",
"stars",
"sunrise_over_mountains",
"sunrise",
"rainbow",
"ocean",
"volcano",
"milky_way",
"mount_fuji",
"japan",
"globe_with_meridians",
"earth_africa",
"earth_americas",
"earth_asia",
"new_moon",
"waxing_crescent_moon",
"first_quarter_moon",
"moon",
"full_moon",
"waning_gibbous_moon",
"last_quarter_moon",
"waning_crescent_moon",
"new_moon_with_face",
"full_moon_with_face",
"first_quarter_moon_with_face",
"last_quarter_moon_with_face",
"sun_with_face",
"chipmunk",
"cloud_lightning",
"cloud_rain",
"cloud_snow",
"cloud_tornado",
"comet",
"crab",
"dove",
"fog",
"lion_face",
"scorpion",
"spider",
"spider_web",
"thunder_cloud_rain",
"turkey",
"unicorn",
"waxing_gibbous_moon",
"white_sun_cloud",
"white_sun_rain_cloud",
"white_sun_small_cloud"
]
},
{
name:"food",
fullname:"Food & Drink",
tabicon:"hamburger",
icons:[
"tomato",
"eggplant",
"corn",
"sweet_potato",
"grapes",
"melon",
"watermelon",
"tangerine",
"lemon",
"banana",
"pineapple",
"apple",
"green_apple",
"pear",
"peach",
"cherries",
"strawberry",
"hamburger",
"pizza",
"meat_on_bone",
"poultry_leg",
"rice_cracker",
"rice_ball",
"rice",
"curry",
"ramen",
"spaghetti",
"bread",
"fries",
"dango",
"oden",
"sushi",
"fried_shrimp",
"fish_cake",
"icecream",
"shaved_ice",
"ice_cream",
"doughnut",
"cookie",
"chocolate_bar",
"candy",
"lollipop",
"custard",
"honey_pot",
"cake",
"bento",
"stew",
"egg",
"fork_and_knife",
"tea",
"coffee",
"sake",
"wine_glass",
"cocktail",
"tropical_drink",
"beer",
"beers",
"baby_bottle",
"burrito",
"champagne",
"cheese",
"hot_pepper",
"hotdog",
"taco"
]
},
{
name:"celebration",
fullname:"Celebration",
tabicon:"gift",
icons:[
"ribbon",
"gift",
"birthday",
"jack_o_lantern",
"christmas_tree",
"tanabata_tree",
"bamboo",
"rice_scene",
"fireworks",
"sparkler",
"tada",
"confetti_ball",
"balloon",
"dizzy",
"sparkles",
"boom",
"mortar_board",
"crown",
"dolls",
"flags",
"wind_chime",
"crossed_flags",
"izakaya_lantern",
"ring",
"heart",
"broken_heart",
"love_letter",
"two_hearts",
"revolving_hearts",
"heartbeat",
"heartpulse",
"sparkling_heart",
"cupid",
"gift_heart",
"heart_decoration",
"purple_heart",
"yellow_heart",
"green_heart",
"blue_heart",
"heart_exclamation"
]
},
{
name:"activity",
fullname:"Activities",
tabicon:"soccer",
icons:[
"runner",
"walking",
"dancer",
"rowboat",
"swimmer",
"surfer",
"bath",
"snowboarder",
"ski",
"snowman",
"bicyclist",
"mountain_bicyclist",
"horse_racing",
"tent",
"fishing_pole_and_fish",
"soccer",
"basketball",
"football",
"baseball",
"tennis",
"rugby_football",
"golf",
"trophy",
"running_shirt_with_sash",
"checkered_flag",
"musical_keyboard",
"guitar",
"violin",
"saxophone",
"trumpet",
"musical_note",
"notes",
"musical_score",
"headphones",
"microphone",
"performing_arts",
"ticket",
"tophat",
"circus_tent",
"clapper",
"art",
"dart",
"8ball",
"bowling",
"slot_machine",
"game_die",
"video_game",
"flower_playing_cards",
"black_joker",
"mahjong",
"carousel_horse",
"ferris_wheel",
"roller_coaster",
"badminton",
"ballot_box",
"basketball_player",
"bow_and_arrow",
"cricket",
"crossed_swords",
"field_hockey",
"golfer",
"hockey",
"ice_skate",
"paintbrush",
"skier",
"snowman2",
"stadium",
"volleyball"
]
},
{
name:"travel",
fullname:"Travel & Places",
tabicon:"airplane",
icons:[
"train",
"mountain_railway",
"railway_car",
"steam_locomotive",
"monorail",
"bullettrain_side",
"bullettrain_front",
"train2",
"metro",
"light_rail",
"station",
"tram",
"bus",
"oncoming_bus",
"trolleybus",
"minibus",
"ambulance",
"fire_engine",
"police_car",
"oncoming_police_car",
"rotating_light",
"taxi",
"oncoming_taxi",
"car",
"oncoming_automobile",
"blue_car",
"truck",
"articulated_lorry",
"tractor",
"bike",
"busstop",
"fuelpump",
"construction",
"vertical_traffic_light",
"traffic_light",
"rocket",
"helicopter",
"airplane",
"seat",
"anchor",
"ship",
"speedboat",
"boat",
"aerial_tramway",
"mountain_cableway",
"suspension_railway",
"passport_control",
"customs",
"baggage_claim",
"left_luggage",
"yen",
"euro",
"pound",
"dollar",
"statue_of_liberty",
"moyai",
"foggy",
"tokyo_tower",
"fountain",
"european_castle",
"japanese_castle",
"city_sunrise",
"city_sunset",
"night_with_stars",
"bridge_at_night",
"house",
"house_with_garden",
"office",
"department_store",
"factory",
"post_office",
"european_post_office",
"hospital",
"bank",
"hotel",
"love_hotel",
"wedding",
"church",
"convenience_store",
"school",
"cn",
"de",
"es",
"fr",
"gb",
"it",
"jp",
"kr",
"ru",
"us",
"airplane_arriving",
"airplane_departure",
"airplane_small",
"beach",
"beach_umbrella",
"camping",
"city_dusk",
"cityscape",
"classical_building",
"construction_site",
"cruise_ship",
"desert",
"ferry",
"flag_black",
"flag_cn",
"flag_de",
"flag_es",
"flag_fr",
"flag_gb",
"flag_it",
"flag_jp",
"flag_kr",
"flag_ru",
"flag_us",
"flag_white",
"hole",
"homes",
"house_abandoned",
"island",
"kaaba",
"map",
"mosque",
"motorboat",
"motorcycle",
"motorway",
"mountain",
"mountain_snow",
"park",
"place_of_worship",
"race_car",
"railway_track",
"red_car",
"sailboat",
"shinto_shrine",
"sleeping_accommodation",
"synagogue"
]
},
{
name:"objects",
fullname:"Objects & Symbols",
tabicon:"eyeglasses",
icons:[
"watch",
"iphone",
"calling",
"computer",
"alarm_clock",
"hourglass_flowing_sand",
"hourglass",
"camera",
"video_camera",
"movie_camera",
"tv",
"radio",
"pager",
"telephone_receiver",
"phone",
"fax",
"minidisc",
"floppy_disk",
"cd",
"dvd",
"vhs",
"battery",
"electric_plug",
"bulb",
"flashlight",
"satellite",
"credit_card",
"money_with_wings",
"moneybag",
"gem",
"closed_umbrella",
"pouch",
"purse",
"handbag",
"briefcase",
"school_satchel",
"lipstick",
"eyeglasses",
"womans_hat",
"sandal",
"high_heel",
"boot",
"mans_shoe",
"athletic_shoe",
"bikini",
"dress",
"kimono",
"womans_clothes",
"shirt",
"necktie",
"jeans",
"door",
"shower",
"bathtub",
"toilet",
"barber",
"syringe",
"pill",
"microscope",
"telescope",
"crystal_ball",
"wrench",
"hocho",
"nut_and_bolt",
"hammer",
"bomb",
"smoking",
"gun",
"bookmark",
"newspaper",
"key",
"email",
"envelope_with_arrow",
"incoming_envelope",
"e-mail",
"inbox_tray",
"outbox_tray",
"package",
"postal_horn",
"postbox",
"mailbox_closed",
"mailbox",
"mailbox_with_mail",
"mailbox_with_no_mail",
"page_facing_up",
"page_with_curl",
"bookmark_tabs",
"chart_with_upwards_trend",
"chart_with_downwards_trend",
"bar_chart",
"date",
"calendar",
"low_brightness",
"high_brightness",
"scroll",
"clipboard",
"book",
"notebook",
"notebook_with_decorative_cover",
"ledger",
"closed_book",
"green_book",
"blue_book",
"orange_book",
"books",
"card_index",
"link",
"paperclip",
"pushpin",
"scissors",
"triangular_ruler",
"round_pushpin",
"straight_ruler",
"triangular_flag_on_post",
"file_folder",
"open_file_folder",
"black_nib",
"pencil2",
"memo",
"lock_with_ink_pen",
"closed_lock_with_key",
"lock",
"unlock",
"mega",
"loudspeaker",
"sound",
"loud_sound",
"speaker",
"mute",
"zzz",
"bell",
"no_bell",
"thought_balloon",
"speech_balloon",
"children_crossing",
"mag",
"mag_right",
"no_entry_sign",
"no_entry",
"name_badge",
"no_pedestrians",
"do_not_litter",
"no_bicycles",
"non-potable_water",
"no_mobile_phones",
"underage",
"accept",
"ideograph_advantage",
"white_flower",
"secret",
"congratulations",
"u5408",
"u6e80",
"u7981",
"u6709",
"u7121",
"u7533",
"u55b6",
"u6708",
"u5272",
"u7a7a",
"sa",
"koko",
"u6307",
"chart",
"sparkle",
"eight_spoked_asterisk",
"negative_squared_cross_mark",
"white_check_mark",
"eight_pointed_black_star",
"vibration_mode",
"mobile_phone_off",
"vs",
"a",
"b",
"ab",
"cl",
"o2",
"sos",
"id",
"parking",
"wc",
"cool",
"free",
"new",
"ng",
"ok",
"up",
"atm",
"aries",
"taurus",
"gemini",
"cancer",
"leo",
"virgo",
"libra",
"scorpius",
"sagittarius",
"capricorn",
"aquarius",
"pisces",
"restroom",
"mens",
"womens",
"baby_symbol",
"wheelchair",
"potable_water",
"no_smoking",
"put_litter_in_its_place",
"arrow_forward",
"arrow_backward",
"arrow_up_small",
"arrow_down_small",
"fast_forward",
"rewind",
"arrow_double_up",
"arrow_double_down",
"arrow_right",
"arrow_left",
"arrow_up",
"arrow_down",
"arrow_upper_right",
"arrow_lower_right",
"arrow_lower_left",
"arrow_upper_left",
"arrow_up_down",
"left_right_arrow",
"arrows_counterclockwise",
"arrow_right_hook",
"leftwards_arrow_with_hook",
"arrow_heading_up",
"arrow_heading_down",
"twisted_rightwards_arrows",
"repeat",
"repeat_one",
"zero",
"one",
"two",
"three",
"four",
"five",
"six",
"seven",
"eight",
"nine",
"keycap_ten",
"1234",
"hash",
"abc",
"abcd",
"capital_abcd",
"information_source",
"signal_strength",
"cinema",
"symbols",
"heavy_plus_sign",
"heavy_minus_sign",
"wavy_dash",
"heavy_division_sign",
"heavy_multiplication_x",
"heavy_check_mark",
"arrows_clockwise",
"tm",
"copyright",
"registered",
"currency_exchange",
"heavy_dollar_sign",
"curly_loop",
"loop",
"part_alternation_mark",
"exclamation",
"bangbang",
"question",
"grey_exclamation",
"grey_question",
"interrobang",
"x",
"o",
"100",
"end",
"back",
"on",
"top",
"soon",
"cyclone",
"m",
"ophiuchus",
"six_pointed_star",
"beginner",
"trident",
"warning",
"hotsprings",
"recycle",
"anger",
"diamond_shape_with_a_dot_inside",
"spades",
"clubs",
"hearts",
"diamonds",
"ballot_box_with_check",
"white_circle",
"black_circle",
"radio_button",
"red_circle",
"large_blue_circle",
"small_red_triangle",
"small_red_triangle_down",
"small_orange_diamond",
"small_blue_diamond",
"large_orange_diamond",
"large_blue_diamond",
"black_small_square",
"white_small_square",
"black_large_square",
"white_large_square",
"black_medium_square",
"white_medium_square",
"black_medium_small_square",
"white_medium_small_square",
"black_square_button",
"white_square_button",
"clock1",
"clock2",
"clock3",
"clock4",
"clock5",
"clock6",
"clock7",
"clock8",
"clock9",
"clock10",
"clock11",
"clock12",
"clock130",
"clock230",
"clock330",
"clock430",
"clock530",
"clock630",
"clock730",
"clock830",
"clock930",
"clock1030",
"clock1130",
"clock1230",
"alembic",
"amphora",
"atom",
"biohazard",
"bed",
"bellhop",
"calendar_spiral",
"camera_with_flash",
"candle",
"card_box",
"chains",
"clock",
"coffin",
"compression",
"control_knobs",
"couch",
"crayon",
"cross",
"dagger",
"dark_sunglasses",
"desktop",
"dividers",
"envelope",
"file_cabinet",
"film_frames",
"fleur-de-lis",
"fork_knife_plate",
"frame_photo",
"gear",
"hammer_pick",
"helmet_with_cross",
"joystick",
"key2",
"keyboard",
"knife",
"label",
"level_slider",
"levitate",
"lifter",
"medal",
"menorah",
"metal",
"microphone2",
"military_medal",
"mouse_three_button",
"newspaper2",
"notepad_spiral",
"oil",
"om_symbol",
"orthodox_cross",
"paperclips",
"pause_button",
"peace",
"pen_ballpoint",
"pen_fountain",
"pencil",
"pick",
"ping_pong",
"play_pause",
"popcorn",
"prayer_beads",
"printer",
"projector",
"radioactive",
"record_button",
"reminder_ribbon",
"rosette",
"satellite_orbital",
"scales",
"shamrock",
"shield",
"shopping_bags",
"star_and_crescent",
"star_of_david",
"stop_button",
"stopwatch",
"telephone",
"ten",
"thermometer",
"thermometer_face",
"tickets",
"timer",
"tools",
"track_next",
"track_previous",
"trackball",
"umbrella2",
"wastebasket",
"wheel_of_dharma",
"yin_yang",
]
}
];
// scrub groups
groups.forEach(group => {
group.icons = group.icons.reject(obj => !Discourse.Emoji.exists(obj));
});
// export so others can modify
Discourse.Emoji.groups = groups;
export default groups;
๐ป U+1F3FB
๐ผ U+1F3FC
๐ฝ U+1F3FD
๐พ U+1F3FE
๐ฟ U+1F3FF
I'm sure you intentionally chose to exclude 1.9.3 since it is not going to be supported soon. I have a project that is going to be moving slowly to 2.x and have created a temporary fork/branch for 1.9.3 support here:
https://github.com/bramswenson/twemoji/tree/ruby-1.9.3
You can see my fix here (uses jsdelivr instead of maxcdn): k5o@3a1f7fd
For more context: twitter/twemoji#580
I'll be using my fork in the meantime but I think a PR can be made (and perhaps allow a config option to set the base
aka asset_host
) for this ruby gem as well ๐ Thanks!
For instance:
Twemoji.configure do |config|
config.file_ext = "svg"
end
Hello first of all thanks for an awesome gem!
so i had a question and was looking to learn more:
Question: what is the benefit to using the "Integration with HTML::Pipeline"?
Side Question: Do i have to use HTML::Pipeline?
Thank you in advance & keep up the awesome work!
I'm using twemoji.js on the front end for some preview features. I'm using twemoji.rb for backend rendering. If I take these steps I run into issues:
title = ":heart_eyes:"
<img title=":heart_eyes:">
tag) in a wysiwyg editor on the front end after backend renderingtwemoji.parse
in the frontend for preview the title attribute value is replaced for another img tag:(
We can fix this a number of ways in our own app, but if we made one of three possible easy modifications to twemoji.rb it would be a non-issue.
:
so heart_eyes
instead of :heart_eyes:
options[:default_img_attrs]
or make options[:img_attrs]
that default.I would be happy to code whatever solution you prefer.
Thanks!
Here's the PR: #59
You can use the latest Twemoji set via the fork ๐
https://github.com/sqlhabit/twemoji#about-this-fork
gem "twemoji", github: "sqlhabit/twemoji", tag: "v4.0.1"
Current the twemoji have 3360 emojis: https://twemoji.maxcdn.com/2/test/preview.html
while this project seem have only 1161 emojis.
Can you update the data?
btw, it seems https://unicode.org/emoji/charts/full-emoji-list.html contains the regual emojis.
2.6.5 :001 > Twemoji.parse "๐ค๐ค๐ป๐ค๐ฟ"
=> "๐ค๐ค<img draggable=\"false\" title=\":skin-tone-2:\" alt=\"๐ป\" src=\"https://twemoji.maxcdn.com/2/72x72/1f3fb.png\" class=\"emoji\">๐ค<img draggable=\"false\" title=\":skin-tone-6:\" alt=\"๐ฟ\" src=\"https://twemoji.maxcdn.com/2/72x72/1f3ff.png\" class=\"emoji\">"
2.6.5 :001 > Twemoji.parse "๐ค๐ฟ"
=> "๐ค<img draggable=\"false\" title=\":skin-tone-6:\" alt=\"๐ฟ\" src=\"https://twemoji.maxcdn.com/2/72x72/1f3ff.png\" class=\"emoji\">"
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux] on Rails 6.0.2.1
More emojis.
The Twemoji library offers support for 2,477 emojis, including skin tone and gender modifiers.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.