diff --git a/.travis.yml b/.travis.yml index 642f159..4a115ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,17 @@ language: go go: - 1.x + - 1.11.x + - 1.10.x - 1.9.x - 1.8.x - 1.7.x - - 1.6.x sudo: false before_install: - git config --global url."https://".insteadOf git:// - - go get -u github.com/golang/lint/golint + - go get -u -v golang.org/x/lint/golint - mkdir -p $GOPATH/src/github.com/emojisum && ln -sf $(pwd) $GOPATH/src/github.com/emojisum/emojisum - go get -d ./... diff --git a/README.md b/README.md index 6d81fe2..49d46ea 100644 --- a/README.md +++ b/README.md @@ -68,3 +68,27 @@ SHA1(main.go)= 🇯🇵 🇬🇧 🤘 🐐 👪 🚀 😺 🏊 🍫 🌵 🍬 And like so: SHA1(main.go)= 🇯🇵 🇬🇧 🤘 🐐 👪 🚀 😺 🏊 🍫 🌵 🍬 😄 🐝 🏠 🍒 ☁️🍟 🙇 〰️ 🎼 + + +## Library + +Use the golang library to access the mapped emoji words: + +```golang +package main + +import ( + "fmt" + + "github.com/emojisum/emojisum/emoji" +) + +func main() { + for i := 0; i < 255; i++ { + fmt.Printf("%d (%2.2x):\n", i, i) + for _, word := range emoji.Map(byte(i)) { + fmt.Printf(" - %s\n", emoji.CodepointToUnicode(word)) + } + } +} +``` diff --git a/emoji/README.md b/emoji/README.md index 194fe84..6e6f018 100644 --- a/emoji/README.md +++ b/emoji/README.md @@ -50,7 +50,7 @@ The purpose of this practice is provide simplified way to convey [checksums](htt ### Intended Audience -This is intended for use by implementors of software to convey checksums or validate conveyed checksums. +This is intended for use by implementors of software to convey checksums or validate conveyed checksums or unique fingerprints. ## Details @@ -60,6 +60,17 @@ Most checksums convey in a hexadecimal notation, there showing a par of case-ins Having a mapping of 256 emojis this thereby reduces the number of characters (or emojis) needed to convey the checksum. In example, a [SHA1](https://en.wikipedia.org/wiki/SHA-1) checksum is 40 hexadecimal characters long, whereas an SHA1-emojisum is only 20 emojis. +### The emojimap + +In the common document [`emojimap.json`](./emojimap.json) there is an ordered list of arrays. +Each array contains a set of strings that are either a human readable word or the human readable unicode point. +For example, byte `0xe8` (position 232) is `[":nauseated_face:", "U+1F922"]`. + +For more complex and visually similar emoji there are times that the unicode is a combination. +This is the case for flags and people. +For example, byte `0xd9` (position 217) includes `:surfer:`, `U+1F3C4`, and `U+1F3C4U+200DU+2642U+FEOF`. +When there is a combination, implementations MUST split on the "`U+`". + ## References * Unicode Technical Report #51 - http://www.unicode.org/reports/tr51/ diff --git a/emoji/emojimap.json b/emoji/emojimap.json index cf06d4c..5c9041e 100644 --- a/emoji/emojimap.json +++ b/emoji/emojimap.json @@ -1,5 +1,5 @@ { - "version": "draft+2", + "version": "draft+3", "description": "This ordered list of emojiwords is the conventional order for the practice of conveying checksums with emoji. Each position provides the alternative for resolving the desired emoji.", "emojiwords": [ [":+1:", "U+1F44D"], @@ -45,7 +45,7 @@ [":clap:", "U+1F44F"], [":cloud:", "U+2601"], [":clubs:", "U+2663"], - [":cn:", "U+1F1E8", "U+1F1F3"], + [":cn:", "U+1F1E8U+1F1F3"], [":coffee:", "U+2615"], [":construction:", "U+1F6A7"], [":cookie:", "U+1F36A"], @@ -59,7 +59,7 @@ [":curly_loop:", "U+27B0"], [":dancers:", "U+1F46F"], [":dash:", "U+1F4A8"], - [":de:", "U+1F1E9", "U+1F1EA"], + [":de:", "U+1F1E9U+1F1EA"], [":diamonds:", "U+2666"], [":dog:", "U+1F436"], [":doughnut:", "U+1F369"], @@ -70,7 +70,7 @@ [":elephant:", "U+1F418"], [":end:", "U+1F51A"], [":envelope:", "U+2709"], - [":es:", "U+1F1EA", "U+1F1F8"], + [":es:", "U+1F1EAU+1F1F8"], [":eyes:", "U+1F440"], [":facepunch:", "U+1F44A"], [":family:", "U+1F46A"], @@ -82,13 +82,13 @@ [":football:", "U+1F3C8"], [":fork_and_knife:", "U+1F374"], [":four_leaf_clover:", "U+1F340"], - [":fr:", "U+1F1EB", "U+1F1F7"], + [":fr:", "U+1F1EBU+1F1F7"], [":fries:", "U+1F35F"], [":peanuts:", "U+1F95C"], [":fu:", "U+1F595"], [":full_moon:", "U+1F315"], [":game_die:", "U+1F3B2"], - [":eu:", "U+1F1EA", "U+1F1FA"], + [":eu:", "U+1F1EAU+1F1FA"], [":gem:", "U+1F48E"], [":girl:", "U+1F467"], [":goat:", "U+1F410"], @@ -114,18 +114,18 @@ [":horse_racing:", "U+1F3C7"], [":hourglass:", "U+231B"], [":house:", "U+1F3E0"], - [":female_detective:", "U+1F575", "U+1FE0F", "U+200D", "U+2640"], + [":female_detective:", ":detective:", "U+1F575", "U+1F575U+FE0FU+200DU+2642U+FE0F", "U+1F575U+FE0FU+200DU+2640U+FE0F"], [":icecream:", "U+1F366"], [":imp:", "U+1F608"], - [":it:", "U+1F1EE", "U+1F1F9"], + [":it:", "U+1F1EEU+1F1F9"], [":jack_o_lantern:", "U+1F383"], [":japanese_goblin:", "U+1F47A"], - [":jp:", "U+1F1EF", "U+1F1F5"], + [":jp:", "U+1F1EFU+1F1F5"], [":key:", "U+1F511"], [":kiss:", "U+1F48B"], [":kissing_cat:", "U+1F63D"], [":koala:", "U+1F428"], - [":kr:", "U+1F1F0", "U+1F1F7"], + [":kr:", "U+1F1F0U+1F1F7"], [":lemon:", "U+1F34B"], [":lipstick:", "U+1F484"], [":lock:", "U+1F512"], @@ -185,7 +185,7 @@ [":rocket:", "U+1F680"], [":roller_coaster:", "U+1F3A2"], [":rooster:", "U+1F413"], - [":ru:", "U+1F1F7", "U+1F1FA"], + [":ru:", "U+1F1F7U+1F1FA"], [":sailboat:", "U+26F5"], [":santa:", "U+1F385"], [":satellite:", "U+1F6F0"], @@ -206,57 +206,57 @@ [":snail:", "U+1F40C"], [":snake:", "U+1F40D"], [":snowflake:", "U+FE0F", "U+2744"], - [":soccer:"], - [":soon:"], - [":space_invader:"], - [":spades:"], - [":speak_no_evil:"], - [":star:"], - [":stars:"], - [":statue_of_liberty:"], - [":steam_locomotive:"], - [":sunflower:"], - [":sunglasses:"], - [":sunny:"], - [":sunrise:"], - [":surfer:"], - [":swimmer:"], + [":soccer:", "U+26BD"], + [":soon:", "U+1F51C"], + [":space_invader:", "U+1F47E"], + [":spades:", "U+2660"], + [":speak_no_evil:", "U+1F64A"], + [":star:", "U+2B50", "U+1F31F"], + [":fountain:", "U+26F2"], + [":statue_of_liberty:", "U+1F5FD"], + [":steam_locomotive:", "U+1F682"], + [":sunflower:", "U+1F33B"], + [":sunglasses:", "U+1F576"], + [":sunny:", "U+2600"], + [":sunrise:", "U+1F304", "U+1F305"], + [":surfer:", "U+1F3C4", "U+1F3C4U+200DU+2642U+FEOF", "U+1F3C4U+200DU+2640U+FEOF"], + [":swimmer:", "U+1F3CA", "U+1F3CAU+200DU+2640U+FE0F", "U+1F3CAU+200DU+2642U+FE0F"], [":syringe:", "U+1F489"], - [":tada:"], - [":tangerine:"], - [":taxi:"], - [":tennis:"], - [":tent:"], - [":thought_balloon:"], - [":tm:"], - [":toilet:"], - [":tongue:"], - [":tophat:"], - [":tractor:"], - [":trolleybus:"], + [":tada:", "U+1F389", "U+1F38A"], + [":tangerine:", "U+1F34A"], + [":taxi:", "U+1F695"], + [":tennis:", "U+1F3BE"], + [":tent:", "U+26FA"], + [":thought_balloon:", "U+1F4AD"], + [":tm:", "U+2122"], + [":toilet:", "U+1F6BD"], + [":tongue:", "U+1F445"], + [":tophat:", "U+1F3A9"], + [":tractor:", "U+1F69C"], + [":trolleybus:", "U+1F68E"], [":nauseated_face:", "U+1F922"], - [":trophy:"], - [":trumpet:"], - [":turtle:"], + [":trophy:", "U+1F3C6"], + [":trumpet:", "U+1F3BA"], + [":turtle:", "U+1F422"], [":carousel_horse:", "U+1F3A0"], [":two_women_holding_hands:", ":two_men_holding_hands:", ":couple:", "U+1F46C ", "U+1F46D", "U+1F46B"], - [":uk:"], - [":umbrella:"], - [":unlock:"], - [":us:"], - [":v:"], - [":vhs:"], - [":violin:"], - [":warning:"], - [":watermelon:"], - [":wave:"], - [":wavy_dash:"], - [":wc:"], - [":wheelchair:"], - [":woman:"], - [":x:"], - [":yum:"], - [":zap:"], - [":zzz:"] + [":uk:", "U+1F1ECU+1F1E7"], + [":umbrella:", "U+2602", "U+2614"], + [":unlock:", "U+1F513"], + [":us:", "U+1F1FAU+1F1F8"], + [":v:", "U+270C"], + [":vhs:", "U+1F4FC"], + [":violin:", "U+1F3BB"], + [":warning:", "U+26A0"], + [":watermelon:", "U+1F349"], + [":wave:", "U+1F44B"], + [":wavy_dash:", "U+3030"], + [":wc:", "U+1F6BE"], + [":wheelchair:", "U+267F"], + [":woman:", "U+1F469"], + [":x:", "U+2716", "U+274C"], + [":yum:", "U+1F60B"], + [":zap:", "U+26A1"], + [":zzz:", "U+1F4A4"] ] } diff --git a/emoji/list.md b/emoji/list.md index b5201c7..2e41d19 100644 --- a/emoji/list.md +++ b/emoji/list.md @@ -12,7 +12,7 @@ This ordered list of emojiwords is the conventional order for the practice of co ### Version -draft+2 +draft+3 ### List * `0` -- :+1: `:+1:` [U+1F44D](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f44d) @@ -58,7 +58,7 @@ draft+2 * `40` -- :clap: `:clap:` [U+1F44F](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f44f) * `41` -- :cloud: `:cloud:` [U+2601](http://www.unicode.org/emoji/charts/full-emoji-list.html#2601) * `42` -- :clubs: `:clubs:` [U+2663](http://www.unicode.org/emoji/charts/full-emoji-list.html#2663) - * `43` -- :cn: `:cn:` [U+1F1E8](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f1e8) [U+1F1F3](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f1f3) + * `43` -- :cn: `:cn:` [U+1F1E8U+1F1F3](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f1e8_1f1f3) * `44` -- :coffee: `:coffee:` [U+2615](http://www.unicode.org/emoji/charts/full-emoji-list.html#2615) * `45` -- :construction: `:construction:` [U+1F6A7](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f6a7) * `46` -- :cookie: `:cookie:` [U+1F36A](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f36a) @@ -72,7 +72,7 @@ draft+2 * `54` -- :curly_loop: `:curly_loop:` [U+27B0](http://www.unicode.org/emoji/charts/full-emoji-list.html#27b0) * `55` -- :dancers: `:dancers:` [U+1F46F](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f46f) * `56` -- :dash: `:dash:` [U+1F4A8](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f4a8) - * `57` -- :de: `:de:` [U+1F1E9](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f1e9) [U+1F1EA](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f1ea) + * `57` -- :de: `:de:` [U+1F1E9U+1F1EA](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f1e9_1f1ea) * `58` -- :diamonds: `:diamonds:` [U+2666](http://www.unicode.org/emoji/charts/full-emoji-list.html#2666) * `59` -- :dog: `:dog:` [U+1F436](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f436) * `60` -- :doughnut: `:doughnut:` [U+1F369](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f369) @@ -83,7 +83,7 @@ draft+2 * `65` -- :elephant: `:elephant:` [U+1F418](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f418) * `66` -- :end: `:end:` [U+1F51A](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f51a) * `67` -- :envelope: `:envelope:` [U+2709](http://www.unicode.org/emoji/charts/full-emoji-list.html#2709) - * `68` -- :es: `:es:` [U+1F1EA](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f1ea) [U+1F1F8](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f1f8) + * `68` -- :es: `:es:` [U+1F1EAU+1F1F8](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f1ea_1f1f8) * `69` -- :eyes: `:eyes:` [U+1F440](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f440) * `70` -- :facepunch: `:facepunch:` [U+1F44A](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f44a) * `71` -- :family: `:family:` [U+1F46A](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f46a) @@ -95,13 +95,13 @@ draft+2 * `77` -- :football: `:football:` [U+1F3C8](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f3c8) * `78` -- :fork_and_knife: `:fork_and_knife:` [U+1F374](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f374) * `79` -- :four_leaf_clover: `:four_leaf_clover:` [U+1F340](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f340) - * `80` -- :fr: `:fr:` [U+1F1EB](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f1eb) [U+1F1F7](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f1f7) + * `80` -- :fr: `:fr:` [U+1F1EBU+1F1F7](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f1eb_1f1f7) * `81` -- :fries: `:fries:` [U+1F35F](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f35f) * `82` -- :peanuts: `:peanuts:` [U+1F95C](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f95c) * `83` -- :fu: `:fu:` [U+1F595](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f595) * `84` -- :full_moon: `:full_moon:` [U+1F315](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f315) * `85` -- :game_die: `:game_die:` [U+1F3B2](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f3b2) - * `86` -- :eu: `:eu:` [U+1F1EA](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f1ea) [U+1F1FA](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f1fa) + * `86` -- :eu: `:eu:` [U+1F1EAU+1F1FA](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f1ea_1f1fa) * `87` -- :gem: `:gem:` [U+1F48E](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f48e) * `88` -- :girl: `:girl:` [U+1F467](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f467) * `89` -- :goat: `:goat:` [U+1F410](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f410) @@ -127,18 +127,18 @@ draft+2 * `109` -- :horse_racing: `:horse_racing:` [U+1F3C7](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f3c7) * `110` -- :hourglass: `:hourglass:` [U+231B](http://www.unicode.org/emoji/charts/full-emoji-list.html#231b) * `111` -- :house: `:house:` [U+1F3E0](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f3e0) - * `112` -- :female_detective: `:female_detective:` [U+1F575](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f575) [U+1FE0F](http://www.unicode.org/emoji/charts/full-emoji-list.html#1fe0f) [U+200D](http://www.unicode.org/emoji/charts/full-emoji-list.html#200d) [U+2640](http://www.unicode.org/emoji/charts/full-emoji-list.html#2640) + * `112` -- :female_detective: `:female_detective:`:detective: `:detective:` [U+1F575](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f575) [U+1F575U+FE0FU+200DU+2642U+FE0F](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f575_fe0f_200d_2642_fe0f) [U+1F575U+FE0FU+200DU+2640U+FE0F](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f575_fe0f_200d_2640_fe0f) * `113` -- :icecream: `:icecream:` [U+1F366](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f366) * `114` -- :imp: `:imp:` [U+1F608](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f608) - * `115` -- :it: `:it:` [U+1F1EE](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f1ee) [U+1F1F9](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f1f9) + * `115` -- :it: `:it:` [U+1F1EEU+1F1F9](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f1ee_1f1f9) * `116` -- :jack_o_lantern: `:jack_o_lantern:` [U+1F383](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f383) * `117` -- :japanese_goblin: `:japanese_goblin:` [U+1F47A](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f47a) - * `118` -- :jp: `:jp:` [U+1F1EF](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f1ef) [U+1F1F5](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f1f5) + * `118` -- :jp: `:jp:` [U+1F1EFU+1F1F5](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f1ef_1f1f5) * `119` -- :key: `:key:` [U+1F511](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f511) * `120` -- :kiss: `:kiss:` [U+1F48B](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f48b) * `121` -- :kissing_cat: `:kissing_cat:` [U+1F63D](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f63d) * `122` -- :koala: `:koala:` [U+1F428](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f428) - * `123` -- :kr: `:kr:` [U+1F1F0](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f1f0) [U+1F1F7](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f1f7) + * `123` -- :kr: `:kr:` [U+1F1F0U+1F1F7](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f1f0_1f1f7) * `124` -- :lemon: `:lemon:` [U+1F34B](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f34b) * `125` -- :lipstick: `:lipstick:` [U+1F484](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f484) * `126` -- :lock: `:lock:` [U+1F512](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f512) @@ -198,7 +198,7 @@ draft+2 * `180` -- :rocket: `:rocket:` [U+1F680](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f680) * `181` -- :roller_coaster: `:roller_coaster:` [U+1F3A2](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f3a2) * `182` -- :rooster: `:rooster:` [U+1F413](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f413) - * `183` -- :ru: `:ru:` [U+1F1F7](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f1f7) [U+1F1FA](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f1fa) + * `183` -- :ru: `:ru:` [U+1F1F7U+1F1FA](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f1f7_1f1fa) * `184` -- :sailboat: `:sailboat:` [U+26F5](http://www.unicode.org/emoji/charts/full-emoji-list.html#26f5) * `185` -- :santa: `:santa:` [U+1F385](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f385) * `186` -- :satellite: `:satellite:` [U+1F6F0](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f6f0) @@ -219,55 +219,55 @@ draft+2 * `201` -- :snail: `:snail:` [U+1F40C](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f40c) * `202` -- :snake: `:snake:` [U+1F40D](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f40d) * `203` -- :snowflake: `:snowflake:` [U+FE0F](http://www.unicode.org/emoji/charts/full-emoji-list.html#fe0f) [U+2744](http://www.unicode.org/emoji/charts/full-emoji-list.html#2744) - * `204` -- :soccer: `:soccer:` - * `205` -- :soon: `:soon:` - * `206` -- :space_invader: `:space_invader:` - * `207` -- :spades: `:spades:` - * `208` -- :speak_no_evil: `:speak_no_evil:` - * `209` -- :star: `:star:` - * `210` -- :stars: `:stars:` - * `211` -- :statue_of_liberty: `:statue_of_liberty:` - * `212` -- :steam_locomotive: `:steam_locomotive:` - * `213` -- :sunflower: `:sunflower:` - * `214` -- :sunglasses: `:sunglasses:` - * `215` -- :sunny: `:sunny:` - * `216` -- :sunrise: `:sunrise:` - * `217` -- :surfer: `:surfer:` - * `218` -- :swimmer: `:swimmer:` + * `204` -- :soccer: `:soccer:` [U+26BD](http://www.unicode.org/emoji/charts/full-emoji-list.html#26bd) + * `205` -- :soon: `:soon:` [U+1F51C](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f51c) + * `206` -- :space_invader: `:space_invader:` [U+1F47E](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f47e) + * `207` -- :spades: `:spades:` [U+2660](http://www.unicode.org/emoji/charts/full-emoji-list.html#2660) + * `208` -- :speak_no_evil: `:speak_no_evil:` [U+1F64A](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f64a) + * `209` -- :star: `:star:` [U+2B50](http://www.unicode.org/emoji/charts/full-emoji-list.html#2b50) [U+1F31F](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f31f) + * `210` -- :fountain: `:fountain:` [U+26F2](http://www.unicode.org/emoji/charts/full-emoji-list.html#26f2) + * `211` -- :statue_of_liberty: `:statue_of_liberty:` [U+1F5FD](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f5fd) + * `212` -- :steam_locomotive: `:steam_locomotive:` [U+1F682](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f682) + * `213` -- :sunflower: `:sunflower:` [U+1F33B](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f33b) + * `214` -- :sunglasses: `:sunglasses:` [U+1F576](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f576) + * `215` -- :sunny: `:sunny:` [U+2600](http://www.unicode.org/emoji/charts/full-emoji-list.html#2600) + * `216` -- :sunrise: `:sunrise:` [U+1F304](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f304) [U+1F305](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f305) + * `217` -- :surfer: `:surfer:` [U+1F3C4](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f3c4) [U+1F3C4U+200DU+2642U+FEOF](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f3c4_200d_2642_feof) [U+1F3C4U+200DU+2640U+FEOF](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f3c4_200d_2640_feof) + * `218` -- :swimmer: `:swimmer:` [U+1F3CA](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f3ca) [U+1F3CAU+200DU+2640U+FE0F](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f3ca_200d_2640_fe0f) [U+1F3CAU+200DU+2642U+FE0F](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f3ca_200d_2642_fe0f) * `219` -- :syringe: `:syringe:` [U+1F489](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f489) - * `220` -- :tada: `:tada:` - * `221` -- :tangerine: `:tangerine:` - * `222` -- :taxi: `:taxi:` - * `223` -- :tennis: `:tennis:` - * `224` -- :tent: `:tent:` - * `225` -- :thought_balloon: `:thought_balloon:` - * `226` -- :tm: `:tm:` - * `227` -- :toilet: `:toilet:` - * `228` -- :tongue: `:tongue:` - * `229` -- :tophat: `:tophat:` - * `230` -- :tractor: `:tractor:` - * `231` -- :trolleybus: `:trolleybus:` + * `220` -- :tada: `:tada:` [U+1F389](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f389) [U+1F38A](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f38a) + * `221` -- :tangerine: `:tangerine:` [U+1F34A](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f34a) + * `222` -- :taxi: `:taxi:` [U+1F695](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f695) + * `223` -- :tennis: `:tennis:` [U+1F3BE](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f3be) + * `224` -- :tent: `:tent:` [U+26FA](http://www.unicode.org/emoji/charts/full-emoji-list.html#26fa) + * `225` -- :thought_balloon: `:thought_balloon:` [U+1F4AD](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f4ad) + * `226` -- :tm: `:tm:` [U+2122](http://www.unicode.org/emoji/charts/full-emoji-list.html#2122) + * `227` -- :toilet: `:toilet:` [U+1F6BD](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f6bd) + * `228` -- :tongue: `:tongue:` [U+1F445](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f445) + * `229` -- :tophat: `:tophat:` [U+1F3A9](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f3a9) + * `230` -- :tractor: `:tractor:` [U+1F69C](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f69c) + * `231` -- :trolleybus: `:trolleybus:` [U+1F68E](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f68e) * `232` -- :nauseated_face: `:nauseated_face:` [U+1F922](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f922) - * `233` -- :trophy: `:trophy:` - * `234` -- :trumpet: `:trumpet:` - * `235` -- :turtle: `:turtle:` + * `233` -- :trophy: `:trophy:` [U+1F3C6](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f3c6) + * `234` -- :trumpet: `:trumpet:` [U+1F3BA](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f3ba) + * `235` -- :turtle: `:turtle:` [U+1F422](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f422) * `236` -- :carousel_horse: `:carousel_horse:` [U+1F3A0](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f3a0) * `237` -- :two_women_holding_hands: `:two_women_holding_hands:`:two_men_holding_hands: `:two_men_holding_hands:`:couple: `:couple:` [U+1F46C ](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f46c ) [U+1F46D](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f46d) [U+1F46B](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f46b) - * `238` -- :uk: `:uk:` - * `239` -- :umbrella: `:umbrella:` - * `240` -- :unlock: `:unlock:` - * `241` -- :us: `:us:` - * `242` -- :v: `:v:` - * `243` -- :vhs: `:vhs:` - * `244` -- :violin: `:violin:` - * `245` -- :warning: `:warning:` - * `246` -- :watermelon: `:watermelon:` - * `247` -- :wave: `:wave:` - * `248` -- :wavy_dash: `:wavy_dash:` - * `249` -- :wc: `:wc:` - * `250` -- :wheelchair: `:wheelchair:` - * `251` -- :woman: `:woman:` - * `252` -- :x: `:x:` - * `253` -- :yum: `:yum:` - * `254` -- :zap: `:zap:` - * `255` -- :zzz: `:zzz:` + * `238` -- :uk: `:uk:` [U+1F1ECU+1F1E7](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f1ec_1f1e7) + * `239` -- :umbrella: `:umbrella:` [U+2602](http://www.unicode.org/emoji/charts/full-emoji-list.html#2602) [U+2614](http://www.unicode.org/emoji/charts/full-emoji-list.html#2614) + * `240` -- :unlock: `:unlock:` [U+1F513](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f513) + * `241` -- :us: `:us:` [U+1F1FAU+1F1F8](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f1fa_1f1f8) + * `242` -- :v: `:v:` [U+270C](http://www.unicode.org/emoji/charts/full-emoji-list.html#270c) + * `243` -- :vhs: `:vhs:` [U+1F4FC](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f4fc) + * `244` -- :violin: `:violin:` [U+1F3BB](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f3bb) + * `245` -- :warning: `:warning:` [U+26A0](http://www.unicode.org/emoji/charts/full-emoji-list.html#26a0) + * `246` -- :watermelon: `:watermelon:` [U+1F349](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f349) + * `247` -- :wave: `:wave:` [U+1F44B](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f44b) + * `248` -- :wavy_dash: `:wavy_dash:` [U+3030](http://www.unicode.org/emoji/charts/full-emoji-list.html#3030) + * `249` -- :wc: `:wc:` [U+1F6BE](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f6be) + * `250` -- :wheelchair: `:wheelchair:` [U+267F](http://www.unicode.org/emoji/charts/full-emoji-list.html#267f) + * `251` -- :woman: `:woman:` [U+1F469](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f469) + * `252` -- :x: `:x:` [U+2716](http://www.unicode.org/emoji/charts/full-emoji-list.html#2716) [U+274C](http://www.unicode.org/emoji/charts/full-emoji-list.html#274c) + * `253` -- :yum: `:yum:` [U+1F60B](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f60b) + * `254` -- :zap: `:zap:` [U+26A1](http://www.unicode.org/emoji/charts/full-emoji-list.html#26a1) + * `255` -- :zzz: `:zzz:` [U+1F4A4](http://www.unicode.org/emoji/charts/full-emoji-list.html#1f4a4) diff --git a/emoji/map.go b/emoji/map.go index b146e6c..10a304c 100644 --- a/emoji/map.go +++ b/emoji/map.go @@ -2,6 +2,7 @@ package emoji import ( "fmt" + "strconv" "strings" ) @@ -28,7 +29,8 @@ type VersionedMap struct { } // Words are a set of options to represent an emoji. -// Possible options could be the ":colon_notation:" or a "U+26CF" style codepoint. +// Possible options could be the ":colon_notation:", a "U+26CF" style +// codepoint, or the unicode value itself. type Words []string // IsColonNotation checks for whether a word is the :colon_notation: of emoji @@ -36,18 +38,37 @@ func IsColonNotation(word string) bool { return strings.HasPrefix(word, ":") && strings.HasSuffix(word, ":") } -// IsCodepoint checks for whether a word is the "U+1234" codepoint style of emoji +// IsCodepoint checks for whether a word is the "U+1234" codepoint style of emoji. Codepoints can sometimes be a combo, like flags func IsCodepoint(word string) bool { return strings.HasPrefix(strings.ToUpper(word), "U+") } var unicodeURL = `http://www.unicode.org/emoji/charts/full-emoji-list.html` -// UnicodeLink returns a link to unicode.org list for CodePoint, or just the +// UnicodeLinkURL returns a link to unicode.org list for CodePoint, or just the // full list if not a codepoint -func UnicodeLink(word string) string { +func UnicodeLinkURL(word string) string { if !IsCodepoint(word) { return unicodeURL } - return fmt.Sprintf("%s#%s", unicodeURL, strings.SplitN(strings.ToLower(word), "+", 2)[1]) + + return fmt.Sprintf("%s#%s", unicodeURL, strings.Join(strings.Split(strings.TrimPrefix(strings.ToLower(word), "u+"), "u+"), "_")) +} + +// CodepointToUnicode takes a "U+26CF" style word and returns the `\U00026CF` formated unicode string +func CodepointToUnicode(word string) string { + if !IsCodepoint(word) { + return word + } + + var ret string + + for _, chunk := range strings.Split(strings.TrimPrefix(strings.ToUpper(word), "U+"), "U+") { + c, err := strconv.ParseInt(chunk, 16, 64) + if err != nil { + return ret + } + ret = fmt.Sprintf("%s%c", ret, c) + } + return ret } diff --git a/emoji/map_gen.go b/emoji/map_gen.go index 2b85dc6..2a0cbf3 100644 --- a/emoji/map_gen.go +++ b/emoji/map_gen.go @@ -6,7 +6,7 @@ package emoji func init() { mapGen = VersionedMap{ Description: "This ordered list of emojiwords is the conventional order for the practice of conveying checksums with emoji. Each position provides the alternative for resolving the desired emoji.", - Version: "draft+2", + Version: "draft+3", EmojiWords: []Words{ Words{ ":+1:","U+1F44D", }, @@ -94,7 +94,7 @@ func init() { }, Words{ ":clubs:","U+2663", }, - Words{ ":cn:","U+1F1E8","U+1F1F3", + Words{ ":cn:","U+1F1E8U+1F1F3", }, Words{ ":coffee:","U+2615", }, @@ -122,7 +122,7 @@ func init() { }, Words{ ":dash:","U+1F4A8", }, - Words{ ":de:","U+1F1E9","U+1F1EA", + Words{ ":de:","U+1F1E9U+1F1EA", }, Words{ ":diamonds:","U+2666", }, @@ -144,7 +144,7 @@ func init() { }, Words{ ":envelope:","U+2709", }, - Words{ ":es:","U+1F1EA","U+1F1F8", + Words{ ":es:","U+1F1EAU+1F1F8", }, Words{ ":eyes:","U+1F440", }, @@ -168,7 +168,7 @@ func init() { }, Words{ ":four_leaf_clover:","U+1F340", }, - Words{ ":fr:","U+1F1EB","U+1F1F7", + Words{ ":fr:","U+1F1EBU+1F1F7", }, Words{ ":fries:","U+1F35F", }, @@ -180,7 +180,7 @@ func init() { }, Words{ ":game_die:","U+1F3B2", }, - Words{ ":eu:","U+1F1EA","U+1F1FA", + Words{ ":eu:","U+1F1EAU+1F1FA", }, Words{ ":gem:","U+1F48E", }, @@ -232,19 +232,19 @@ func init() { }, Words{ ":house:","U+1F3E0", }, - Words{ ":female_detective:","U+1F575","U+1FE0F","U+200D","U+2640", + Words{ ":female_detective:",":detective:","U+1F575","U+1F575U+FE0FU+200DU+2642U+FE0F","U+1F575U+FE0FU+200DU+2640U+FE0F", }, Words{ ":icecream:","U+1F366", }, Words{ ":imp:","U+1F608", }, - Words{ ":it:","U+1F1EE","U+1F1F9", + Words{ ":it:","U+1F1EEU+1F1F9", }, Words{ ":jack_o_lantern:","U+1F383", }, Words{ ":japanese_goblin:","U+1F47A", }, - Words{ ":jp:","U+1F1EF","U+1F1F5", + Words{ ":jp:","U+1F1EFU+1F1F5", }, Words{ ":key:","U+1F511", }, @@ -254,7 +254,7 @@ func init() { }, Words{ ":koala:","U+1F428", }, - Words{ ":kr:","U+1F1F0","U+1F1F7", + Words{ ":kr:","U+1F1F0U+1F1F7", }, Words{ ":lemon:","U+1F34B", }, @@ -374,7 +374,7 @@ func init() { }, Words{ ":rooster:","U+1F413", }, - Words{ ":ru:","U+1F1F7","U+1F1FA", + Words{ ":ru:","U+1F1F7U+1F1FA", }, Words{ ":sailboat:","U+26F5", }, @@ -416,109 +416,109 @@ func init() { }, Words{ ":snowflake:","U+FE0F","U+2744", }, - Words{ ":soccer:", + Words{ ":soccer:","U+26BD", }, - Words{ ":soon:", + Words{ ":soon:","U+1F51C", }, - Words{ ":space_invader:", + Words{ ":space_invader:","U+1F47E", }, - Words{ ":spades:", + Words{ ":spades:","U+2660", }, - Words{ ":speak_no_evil:", + Words{ ":speak_no_evil:","U+1F64A", }, - Words{ ":star:", + Words{ ":star:","U+2B50","U+1F31F", }, - Words{ ":stars:", + Words{ ":fountain:","U+26F2", }, - Words{ ":statue_of_liberty:", + Words{ ":statue_of_liberty:","U+1F5FD", }, - Words{ ":steam_locomotive:", + Words{ ":steam_locomotive:","U+1F682", }, - Words{ ":sunflower:", + Words{ ":sunflower:","U+1F33B", }, - Words{ ":sunglasses:", + Words{ ":sunglasses:","U+1F576", }, - Words{ ":sunny:", + Words{ ":sunny:","U+2600", }, - Words{ ":sunrise:", + Words{ ":sunrise:","U+1F304","U+1F305", }, - Words{ ":surfer:", + Words{ ":surfer:","U+1F3C4","U+1F3C4U+200DU+2642U+FEOF","U+1F3C4U+200DU+2640U+FEOF", }, - Words{ ":swimmer:", + Words{ ":swimmer:","U+1F3CA","U+1F3CAU+200DU+2640U+FE0F","U+1F3CAU+200DU+2642U+FE0F", }, Words{ ":syringe:","U+1F489", }, - Words{ ":tada:", + Words{ ":tada:","U+1F389","U+1F38A", }, - Words{ ":tangerine:", + Words{ ":tangerine:","U+1F34A", }, - Words{ ":taxi:", + Words{ ":taxi:","U+1F695", }, - Words{ ":tennis:", + Words{ ":tennis:","U+1F3BE", }, - Words{ ":tent:", + Words{ ":tent:","U+26FA", }, - Words{ ":thought_balloon:", + Words{ ":thought_balloon:","U+1F4AD", }, - Words{ ":tm:", + Words{ ":tm:","U+2122", }, - Words{ ":toilet:", + Words{ ":toilet:","U+1F6BD", }, - Words{ ":tongue:", + Words{ ":tongue:","U+1F445", }, - Words{ ":tophat:", + Words{ ":tophat:","U+1F3A9", }, - Words{ ":tractor:", + Words{ ":tractor:","U+1F69C", }, - Words{ ":trolleybus:", + Words{ ":trolleybus:","U+1F68E", }, Words{ ":nauseated_face:","U+1F922", }, - Words{ ":trophy:", + Words{ ":trophy:","U+1F3C6", }, - Words{ ":trumpet:", + Words{ ":trumpet:","U+1F3BA", }, - Words{ ":turtle:", + Words{ ":turtle:","U+1F422", }, Words{ ":carousel_horse:","U+1F3A0", }, Words{ ":two_women_holding_hands:",":two_men_holding_hands:",":couple:","U+1F46C ","U+1F46D","U+1F46B", }, - Words{ ":uk:", + Words{ ":uk:","U+1F1ECU+1F1E7", }, - Words{ ":umbrella:", + Words{ ":umbrella:","U+2602","U+2614", }, - Words{ ":unlock:", + Words{ ":unlock:","U+1F513", }, - Words{ ":us:", + Words{ ":us:","U+1F1FAU+1F1F8", }, - Words{ ":v:", + Words{ ":v:","U+270C", }, - Words{ ":vhs:", + Words{ ":vhs:","U+1F4FC", }, - Words{ ":violin:", + Words{ ":violin:","U+1F3BB", }, - Words{ ":warning:", + Words{ ":warning:","U+26A0", }, - Words{ ":watermelon:", + Words{ ":watermelon:","U+1F349", }, - Words{ ":wave:", + Words{ ":wave:","U+1F44B", }, - Words{ ":wavy_dash:", + Words{ ":wavy_dash:","U+3030", }, - Words{ ":wc:", + Words{ ":wc:","U+1F6BE", }, - Words{ ":wheelchair:", + Words{ ":wheelchair:","U+267F", }, - Words{ ":woman:", + Words{ ":woman:","U+1F469", }, - Words{ ":x:", + Words{ ":x:","U+2716","U+274C", }, - Words{ ":yum:", + Words{ ":yum:","U+1F60B", }, - Words{ ":zap:", + Words{ ":zap:","U+26A1", }, - Words{ ":zzz:", + Words{ ":zzz:","U+1F4A4", }, }, } diff --git a/emoji/map_json.go b/emoji/map_json.go index 1b1013c..b94fc84 100644 --- a/emoji/map_json.go +++ b/emoji/map_json.go @@ -51,7 +51,7 @@ func main() { } func codepointLinkMarkdown(word string) string { - return fmt.Sprintf(`[%s](%s)`, word, emoji.UnicodeLink(word)) + return fmt.Sprintf(`[%s](%s)`, word, emoji.UnicodeLinkURL(word)) } var (