mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 19:08:58 +03:00
undo changes to emoji_codegen.py
This commit is contained in:
parent
9ad9c8ddf0
commit
f40d8d15b5
1 changed files with 3 additions and 6 deletions
|
@ -11,15 +11,12 @@ class Emoji(object):
|
||||||
self.code = repr(code.encode('utf-8'))[1:].strip("'")
|
self.code = repr(code.encode('utf-8'))[1:].strip("'")
|
||||||
self.shortname = shortname
|
self.shortname = shortname
|
||||||
|
|
||||||
def to_shortcode(shortname):
|
|
||||||
return shortname.replace(" ", "-").replace(":", "-")
|
|
||||||
|
|
||||||
def generate_code(emojis, category):
|
def generate_code(emojis, category):
|
||||||
tmpl = Template('''
|
tmpl = Template('''
|
||||||
const std::vector<Emoji> emoji::Provider::{{ category }} = {
|
const std::vector<Emoji> emoji::Provider::{{ category }} = {
|
||||||
// {{ category.capitalize() }}
|
// {{ category.capitalize() }}
|
||||||
{%- for e in emoji %}
|
{%- for e in emoji %}
|
||||||
Emoji{QString::fromUtf8("{{ e.code }}"), "{{ e.shortname }}", "{{ to_shortcode(e.shortname) }}", emoji::EmojiCategory::{{ category.capitalize() }}},
|
Emoji{QString::fromUtf8("{{ e.code }}"), "{{ e.shortname }}", emoji::EmojiCategory::{{ category.capitalize() }}},
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
};
|
};
|
||||||
''')
|
''')
|
||||||
|
@ -33,7 +30,7 @@ const QVector<Emoji> emoji::Provider::emoji = {
|
||||||
{%- for c in kwargs.items() %}
|
{%- for c in kwargs.items() %}
|
||||||
// {{ c[0].capitalize() }}
|
// {{ c[0].capitalize() }}
|
||||||
{%- for e in c[1] %}
|
{%- for e in c[1] %}
|
||||||
Emoji{QString::fromUtf8("{{ e.code }}"), "{{ e.shortname }}", "{{ to_shortcode(e.shortname) }}", emoji::EmojiCategory::{{ c[0].capitalize() }}},
|
Emoji{QString::fromUtf8("{{ e.code }}"), "{{ e.shortname }}", emoji::EmojiCategory::{{ c[0].capitalize() }}},
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue