31 lines
759 B
Nim
31 lines
759 B
Nim
import jsony
|
|
|
|
type
|
|
Emoji* = object
|
|
emoji*: string
|
|
name*: string
|
|
group*: string
|
|
subgroup*: string
|
|
|
|
proc `$`(e: Emoji): string =
|
|
return e.emoji & " : " & e.name & " : " & e.group & " : " & e.subgroup
|
|
|
|
const ignore_groups = ["Flags", "Symbols"]
|
|
const include_groups_override = ["geometric", "other-symbol"]
|
|
|
|
proc getEmojis(): seq[string] =
|
|
let file_emojis = staticRead("../../emojis.json")
|
|
let emojis = file_emojis.fromJson(seq[Emoji])
|
|
var list: seq[string] = @[]
|
|
for e in emojis:
|
|
if e.group notin ignore_groups and e.subgroup in ignore_groups:
|
|
list.add($e)
|
|
if e.subgroup in include_groups_override:
|
|
list.add($e)
|
|
return list
|
|
|
|
const emoji_list = getEmojis()
|
|
|
|
proc getEmoji*(): seq[string] =
|
|
return emoji_list
|
|
|