generate-textdefault-emoji.py 652 B

12345678910111213141516171819202122
  1. #!/usr/bin/env python3
  2. import json
  3. import re
  4. GROUPS_JSON = '../../../twemoji-picker/generated/groups.json'
  5. with open(GROUPS_JSON, 'r') as f:
  6. groups = json.loads(f.read())
  7. text_default = []
  8. for emoji_list in groups.values():
  9. for emoji in emoji_list:
  10. if emoji['representation'] == 'text-default':
  11. text_default.append(emoji['codepoint'])
  12. text_default.append(re.sub(r'-fe0[ef]$', '', emoji['codepoint']))
  13. print('// Generated with tools/twemoji/generate-textdefault-emoji.py')
  14. print('const TEXT_DEFAULT_EMOJI = [')
  15. for codepoint in sorted(set(text_default)):
  16. print(" '{}',".format(codepoint))
  17. print('];')