mirror of
https://github.com/emojisum/emojisum.git
synced 2025-08-03 13:50:27 +00:00
list: link unicode codepoint the full list
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
85d3b16c68
commit
043174f418
3 changed files with 122 additions and 102 deletions
16
emoji/map.go
16
emoji/map.go
|
@ -1,6 +1,9 @@
|
|||
package emoji
|
||||
|
||||
import "strings"
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Map returns the emoji at the provided position.
|
||||
// This list is from 0-255
|
||||
|
@ -37,3 +40,14 @@ func IsColonNotation(word string) bool {
|
|||
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
|
||||
// full list if not a codepoint
|
||||
func UnicodeLink(word string) string {
|
||||
if !IsCodepoint(word) {
|
||||
return unicodeURL
|
||||
}
|
||||
return fmt.Sprintf("%s#%s", unicodeURL, strings.SplitN(strings.ToLower(word), "+", 2)[1])
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue