generate-shortname-mapping.py 467 B

1234567891011121314151617
  1. #!/usr/bin/env python3
  2. import json
  3. GROUPS_JSON = '../../../twemoji-picker/generated/groups.json'
  4. with open(GROUPS_JSON, 'r') as f:
  5. groups = json.loads(f.read())
  6. print('const shortnames = {')
  7. for emoji_list in groups.values():
  8. for emoji in emoji_list:
  9. for shortname in emoji['shortnames']:
  10. print(" '{}': '{}',".format(
  11. shortname.strip(':'),
  12. emoji['codepoint_fully_qualified']
  13. ))
  14. print('}')