Commit bb8df2b1 by Mark Wunsch

Add Nature range of characters

parent 8cfe1bad
......@@ -48,7 +48,7 @@ On the command line
Implement the emoji codes from emoji-cheat-sheet.com using a tool like [gemoji](https://github.com/github/gemoji) along with Rumoji, and you'll easily be able to transform user input with raw emoji unicode into images you can show to all users.
Currently, Rumoji only supports the _People_ characters in emoji-cheat-sheet, but that will change!
Currently, Rumoji only supports the _People_ and _Nature_ characters in emoji-cheat-sheet, but that will change!
_Having trouble discerning what's happening in this README?_ You might be on a device with NO emoji support! All the more reason to use Rumoji. Transcode the raw unicode into something users can understand across devices!
......
......@@ -7,7 +7,7 @@ module Rumoji
def encode(str)
remapped_codepoints = str.codepoints.flat_map do |codepoint|
emoji = EMOJI_NAME_TO_CODEPOINT.key(codepoint.to_s(16).upcase)
emoji = EMOJI_NAME_TO_CODEPOINT.key codepoint_as_hex(codepoint)
emoji ? ":#{emoji}:".codepoints.entries : codepoint
end
remapped_codepoints.pack("U*")
......@@ -23,7 +23,7 @@ module Rumoji
def encode_io(readable, writeable=StringIO.new(""))
readable.each_codepoint do |codepoint|
emoji = codepoint.to_s(16).upcase
emoji = codepoint_as_hex(codepoint)
emoji_or_character = EMOJI_NAME_TO_CODEPOINT.has_value?(emoji) ? ":#{EMOJI_NAME_TO_CODEPOINT.key(emoji)}:" : [codepoint].pack("U")
writeable.write emoji_or_character
end
......@@ -42,6 +42,10 @@ module Rumoji
writeable
end
def codepoint_as_hex(codepoint)
codepoint.to_s(16).upcase
end
EMOJI_NAME_TO_CODEPOINT = {
# PEOPLE
smile: "1F604",
......@@ -118,7 +122,6 @@ module Rumoji
revolving_hearts: "1F49E",
cupid: "1F498",
sparkling_heart: "1F496",
sparkles: "2728",
star: "2B50", # In "Nature" range
star2: "1F31F",
......@@ -142,12 +145,10 @@ module Rumoji
musical_note: "1F3B5",
fire: "1F525",
# So much poop
hankey: "1F4A9",
poop: "1F4A9",
shit: "1F4A9",
thumbsup: "1F44D",
thumbsdown: "1F44E",
ok_hand: "1F44C",
......@@ -157,7 +158,6 @@ module Rumoji
v: "270C",
wave: "1F44B",
hand: "270B",
open_hands: "1F450",
point_up: "261D",
point_down: "1F447",
......@@ -168,7 +168,6 @@ module Rumoji
point_up_2: "1F446",
clap: "1F44F",
muscle: "1F4AA",
walking: "1F6B6",
runner: "1F3C3",
running: "1F3C3",
......@@ -205,7 +204,7 @@ module Rumoji
cop: "1F46E",
angel: "1F47C",
princess: "1F478",
# Cats
smiley_cat: "1F63A",
smile_cat: "1F638",
heart_eyes_cat: "1F63B",
......@@ -215,17 +214,14 @@ module Rumoji
crying_cat_face: "1F63F",
joy_cat: "1F639",
pouting_cat: "1F63E",
japanese_ogre: "1F479",
japanese_goblin: "1F47A",
# Monkeys
see_no_evil: "1F648",
hear_no_evil: "1F649",
speak_no_evil: "1F649",
guardsman: "1F482",
skull: "1F480",
feet: "1F463",
lips: "1F444",
kiss: "1F48B",
......@@ -238,7 +234,126 @@ module Rumoji
bust_in_silhouette: "1F464",
busts_in_silhouette: "1F465",
speech_balloon: "1F4AC",
thought_balloon: "1F4AD"
thought_balloon: "1F4AD",
# NATURE
sunny: "2600",
umbrella: "2614",
cloud: "2601",
snowflake: "2744",
snowman: "26C4",
zap: "26A1",
cyclone: "1F300",
foggy: "1F301",
ocean: "1F30A",
# Animals
cat: "1F431",
dog: "1F436",
mouse: "1F42D",
hamster: "1F439",
rabbit: "1F430",
wolf: "1F43A",
frog: "1F438",
tiger: "1F42F",
koala: "1F428",
bear: "1F43B",
pig: "1F437",
pig_nose: "1F43D",
cow: "1F42E",
boar: "1F417",
monkey_face: "1F435",
monkey: "1F412",
horse: "1F434",
racehorse: "1F40E",
camel: "1F42B",
sheep: "1F411",
elephant: "1F418",
panda_face: "1F43C",
snake: "1F40D",
bird: "1F426",
baby_chick: "1F424",
hatched_chick: "1F425",
hatching_chick: "1F423",
chicken: "1F414",
penguin: "1F427",
turtle: "1F422",
bug: "1F41B",
honeybee: "1F41D",
ant: "1F41C",
beetle: "1F41E",
snail: "1F40C",
octopus: "1F419",
tropical_fish: "1F420",
fish: "1F41F",
whale: "1F433",
whale2: "1F40B",
dolphin: "1F42C",
cow2: "1F404",
ram: "1F40F",
rat: "1F400",
water_buffalo: "1F403",
tiger2: "1F405",
rabbit2: "1F407",
dragon: "1F409",
goat: "1F410",
rooster: "1F413",
dog2: "1F415",
pig2: "1F416",
mouse2: "1F401",
ox: "1F402",
dragon_face: "1F432",
blowfish: "1F421",
crocodile: "1F40A",
dromedary_camel: "1F42A",
leopard: "1F406",
cat2: "1F408",
poodle: "1F429",
paw_prints: "1F43E",
# Flowers
bouquet: "1F490",
cherry_blossom: "1F338",
tulip: "1F337",
four_leaf_clover: "1F340",
rose: "1F339",
sunflower: "1F33B",
hibiscus: "1F33A",
maple_leaf: "1F341",
leaves: "1F343",
fallen_leaf: "1F342",
herb: "1F33F",
mushroom: "1F344",
cactus: "1F335",
palm_tree: "1F334",
evergreen_tree: "1F332",
deciduous_tree: "1F333",
chestnut: "1F330",
seedling: "1F331",
blossum: "1F33C",
ear_of_rice: "1F33E",
shell: "1F41A",
globe_with_meridians: "1F310",
# Moon
sun_with_face: "1F31E",
full_moon_with_face: "1F31D",
new_moon_with_face: "1F31A",
new_moon: "1F311",
waxing_crescent_moon: "1F312",
first_quarter_moon: "1F313",
waxing_gibbous_moon: "1F314",
full_moon: "1F315",
waning_gibbous_moon: "1F316",
last_quarter_moon: "1F317",
waning_crescent_moon: "1F318",
last_quarter_moon_with_face: "1F31C",
first_quarter_moon_with_face: "1F31B",
moon: "1F319",
earth_africa: "1F30D",
earth_americas: "1F30E",
earth_asia: "1F30F",
volcano: "1F30B",
milky_way: "1F30C",
partly_sunny: "26C5"
}
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment