|
|
@ -76,63 +76,61 @@ if __name__ == '__main__': |
|
|
|
# skip unqualified versions of same unicode |
|
|
|
# skip unqualified versions of same unicode |
|
|
|
if qualification != 'fully-qualified': |
|
|
|
if qualification != 'fully-qualified': |
|
|
|
continue |
|
|
|
continue |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char, name = re.match(r'^(\S+) E\d+\.\d+ (.*)$', charAndName).groups() |
|
|
|
char, name = re.match(r'^(\S+) E\d+\.\d+ (.*)$', charAndName).groups() |
|
|
|
shortname = name |
|
|
|
shortname = name |
|
|
|
# until skin tone is handled, keep them around |
|
|
|
# until skin tone is handled, keep them around |
|
|
|
# discard skin tone variants for sanity |
|
|
|
## discard skin tone variants for sanity |
|
|
|
# __contains__ is so stupid i hate prototype languages |
|
|
|
# if "skin tone" in name and qualification != 'component': |
|
|
|
# if name.__contains__("skin tone") and qualification != 'component': |
|
|
|
|
|
|
|
# continue |
|
|
|
# continue |
|
|
|
# if qualification == 'component' and not name.__contains__("skin tone"): |
|
|
|
# if qualification == 'component' and not "skin tone" in name: |
|
|
|
# continue |
|
|
|
# continue |
|
|
|
#TODO: Handle skintone modifiers in a sane way |
|
|
|
#TODO: Handle skintone modifiers in a sane way |
|
|
|
basicallyTheSame = False |
|
|
|
basicallyTheSame = False |
|
|
|
if code in shortcodeDict: |
|
|
|
if code in shortcodeDict: |
|
|
|
shortname = shortcodeDict[code] |
|
|
|
shortname = shortcodeDict[code] |
|
|
|
else: |
|
|
|
else: |
|
|
|
shortname = shortname.lower() |
|
|
|
shortname = shortname.lower() |
|
|
|
if shortname.endswith(' (blood type)'): |
|
|
|
if shortname.endswith(' (blood type)'): |
|
|
|
shortname = shortname[:-13] |
|
|
|
shortname = shortname[:-13] |
|
|
|
if shortname.endswith(': red hair'): |
|
|
|
if shortname.endswith(': red hair'): |
|
|
|
shortname = "red_haired_" + shortname[:-10] |
|
|
|
shortname = "red_haired_" + shortname[:-10] |
|
|
|
if shortname.endswith(': curly hair'): |
|
|
|
if shortname.endswith(': curly hair'): |
|
|
|
shortname = "curly_haired_" + shortname[:-12] |
|
|
|
shortname = "curly_haired_" + shortname[:-12] |
|
|
|
if shortname.endswith(': white hair'): |
|
|
|
if shortname.endswith(': white hair'): |
|
|
|
shortname = "white_haried_" + shortname[:-12] |
|
|
|
shortname = "white_haried_" + shortname[:-12] |
|
|
|
if shortname.endswith(': bald'): |
|
|
|
if shortname.endswith(': bald'): |
|
|
|
shortname = "bald_" + shortname[:-6] |
|
|
|
shortname = "bald_" + shortname[:-6] |
|
|
|
if shortname.endswith(': beard'): |
|
|
|
if shortname.endswith(': beard'): |
|
|
|
shortname = "bearded_" + shortname[:-7] |
|
|
|
shortname = "bearded_" + shortname[:-7] |
|
|
|
if shortname.endswith(' face'): |
|
|
|
if shortname.endswith(' face'): |
|
|
|
shortname = shortname[:-5] |
|
|
|
shortname = shortname[:-5] |
|
|
|
if shortname.endswith(' button'): |
|
|
|
if shortname.endswith(' button'): |
|
|
|
shortname = shortname[:-7] |
|
|
|
shortname = shortname[:-7] |
|
|
|
if shortname.endswith(' banknote'): |
|
|
|
if shortname.endswith(' banknote'): |
|
|
|
shortname = shortname[:-9] |
|
|
|
shortname = shortname[:-9] |
|
|
|
|
|
|
|
|
|
|
|
# FIXME: Is there a better way to do this? |
|
|
|
# FIXME: Is there a better way to do this? |
|
|
|
matchobj = re.match(r'^flag: (.*)$', shortname) |
|
|
|
matchobj = re.match(r'^flag: (.*)$', shortname) |
|
|
|
if shortname.startswith("flag: "): |
|
|
|
if shortname.startswith("flag: "): |
|
|
|
country = shortname[5:] |
|
|
|
country = shortname[5:] |
|
|
|
shortname = country + " flag" |
|
|
|
shortname = country + " flag" |
|
|
|
shortname = shortname.replace("u.s.", "us") |
|
|
|
shortname = shortname.replace("u.s.", "us") |
|
|
|
shortname = shortname.replace("&", "and") |
|
|
|
shortname = shortname.replace("&", "and") |
|
|
|
|
|
|
|
|
|
|
|
if shortname == name.lower(): |
|
|
|
if shortname == name.lower(): |
|
|
|
basicallyTheSame = True |
|
|
|
basicallyTheSame = True |
|
|
|
|
|
|
|
|
|
|
|
shortname = shortname.replace("-", "_") |
|
|
|
shortname = shortname.replace("-", "_") |
|
|
|
shortname = re.sub(r'\W', '_', shortname) |
|
|
|
shortname = re.sub(r'\W', '_', shortname) |
|
|
|
shortname, = re.match(r'^_*(.+)_*$', shortname).groups() |
|
|
|
shortname, = re.match(r'^_*(.+)_*$', shortname).groups() |
|
|
|
shortname = re.sub(r'_{2,}', '_', shortname) |
|
|
|
shortname = re.sub(r'_{2,}', '_', shortname) |
|
|
|
shortname = unidecode(shortname) |
|
|
|
shortname = unidecode(shortname) |
|
|
|
# if basicallyTheSame: |
|
|
|
# if basicallyTheSame: |
|
|
|
# shortname = "" |
|
|
|
# shortname = "" |
|
|
|
categories[current_category].append(Emoji(code, shortname, name)) |
|
|
|
categories[current_category].append(Emoji(code, shortname, name)) |
|
|
|
|
|
|
|
|
|
|
|
# Use xclip to pipe the output to clipboard. |
|
|
|
# Use xclip to pipe the output to clipboard. |
|
|
|
# e.g ./codegen.py emoji.json | xclip -sel clip |
|
|
|
# e.g ./emoji_codegen.py emoji.json | xclip -sel clip |
|
|
|
# alternatively - delete the var from src/emoji/Provider.cpp, and do ./codegen.py emojis shortcodes >> src/emoji/Provider.cpp |
|
|
|
# alternatively - delete the var from src/emoji/Provider.cpp, and do ./codegen.sh emojis shortcodes >> ../src/emoji/Provider.cpp |
|
|
|
generate_qml_list(people=people, nature=nature, food=food, activity=activity, travel=travel, objects=objects, symbols=symbols, flags=flags) |
|
|
|
generate_qml_list(people=people, nature=nature, food=food, activity=activity, travel=travel, objects=objects, symbols=symbols, flags=flags) |
|
|
|