#!/usr/bin/env python3 import json GROUPS_JSON = '../../../twemoji-picker/generated/groups.json' # Load and group emoji data with open(GROUPS_JSON, 'r') as f: groups = json.loads(f.read()) # Define category order category_order = [ {'id': 'people', 'name': 'Smileys & People'}, {'id': 'nature', 'name': 'Animals & Nature'}, {'id': 'food', 'name': 'Food & Drink'}, {'id': 'activity', 'name': 'Activity'}, {'id': 'travel', 'name': 'Travel & Places'}, {'id': 'objects', 'name': 'Objects'}, {'id': 'symbols', 'name': 'Symbols'}, {'id': 'flags', 'name': 'Flags'}, ] # Helper functions def make_hexchar(codepoint): return '&#x%s;' % codepoint.replace('-', ';&#x') # Generate HTML print('
') for i, category in enumerate(category_order): print('
') print(' ' % (i, ' checked' if i == 0 else '')) print(' ') print('
') def print_emoji(emoji): print(' ', end='') print('{}'.format(make_hexchar(hex_codepoint))) for emoji in groups[category['id']]: if 'gender' in emoji and emoji['gender'] is None: # Skip gender-neutral emoji if gendered versions are available continue print_emoji(emoji) print('
') print('
') print('
') print(' ') print(' ') print(' ') print(' ') print(' ') print(' ') print('
') print('
')