Skip to content

Commit

Permalink
Removed skin tone and not full-qualified emojis
Browse files Browse the repository at this point in the history
  • Loading branch information
Ri0n committed May 27, 2021
1 parent f75c0b6 commit 51dfc8c
Show file tree
Hide file tree
Showing 3 changed files with 702 additions and 10,158 deletions.
14 changes: 13 additions & 1 deletion admin/emoji.py
Expand Up @@ -73,12 +73,23 @@ def parse(f):
elif not line.strip() or line.startswith("#"):
continue
else:
match = re.match(r'^(.+);.*# .* E\d+\.\d+ (.*)', line)
if "skin tone" in line:
continue # will be implemented later
match = re.match(r'^(.+); fully-qualified.*# .* E\d+\.\d+ (.*)', line)
if not match:
continue
desc = match.group(2).split(':')
code = "".join([chr(int(c, 16)) for c in match.group(1).strip().split()])
subgroup["emojis"].append((code, desc[0].strip()))


def cleanup_empty():
global data
for group in data:
group["subgroups"] = [s for s in group["subgroups"] if len(s["emojis"])]
data = [g for g in data if len(g["subgroups"])]


def generate_ranges():
emojis=[]
for g in data:
Expand Down Expand Up @@ -113,5 +124,6 @@ def generate_cpp_db():
with open("emoji-test.txt") as f:
reset()
parse(f)
cleanup_empty()
generate_ranges()
generate_cpp_db()

0 comments on commit 51dfc8c

Please sign in to comment.