diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2022-01-01 06:16:37 +0100 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2022-01-01 06:16:37 +0100 |
commit | a20650051040dec050ba262f46dedc2fdb152e14 (patch) | |
tree | 5bd1cd1083ce8de9f076e1717d12662767507a40 /scripts | |
parent | Update year in copyright notice to shut up lint job (diff) | |
download | nheko-a20650051040dec050ba262f46dedc2fdb152e14.tar.xz |
Use fully qualified emoji and use literals
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/emoji_codegen.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/scripts/emoji_codegen.py b/scripts/emoji_codegen.py index 88f711f3..700cc3e1 100755 --- a/scripts/emoji_codegen.py +++ b/scripts/emoji_codegen.py @@ -8,7 +8,7 @@ from jinja2 import Template class Emoji(object): def __init__(self, code, shortname): - self.code = repr(code.encode('utf-8'))[1:].strip("'") + self.code = ''.join(['\\U'+c.rjust(8, '0') for c in code.strip().split(' ')]) self.shortname = shortname def generate_qml_list(**kwargs): @@ -17,7 +17,7 @@ const QVector<Emoji> emoji::Provider::emoji = { {%- for c in kwargs.items() %} // {{ c[0].capitalize() }} {%- for e in c[1] %} - Emoji{QString::fromUtf8("{{ e.code }}"), "{{ e.shortname }}", emoji::Emoji::Category::{{ c[0].capitalize() }}}, + Emoji{QStringLiteral(u"{{ e.code }}"), QStringLiteral(u"{{ e.shortname }}"), emoji::Emoji::Category::{{ c[0].capitalize() }}}, {%- endfor %} {%- endfor %} }; @@ -67,8 +67,8 @@ if __name__ == '__main__': code, qualification, charAndName = segments - # skip fully qualified versions of same unicode - if code.endswith('FE0F'): + # skip unqualified versions of same unicode + if qualification == 'unqualified': continue if qualification == 'component': @@ -76,7 +76,7 @@ if __name__ == '__main__': char, name = re.match(r'^(\S+) E\d+\.\d+ (.*)$', charAndName).groups() - categories[current_category].append(Emoji(char, name)) + categories[current_category].append(Emoji(code, name)) # Use xclip to pipe the output to clipboard. # e.g ./codegen.py emoji.json | xclip -sel clip |