Initial commit

This commit is contained in:
Eirik Øverby 2025-08-24 00:01:23 +02:00
commit 009dd95b2a
3 changed files with 27 additions and 0 deletions

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "smiley"]
path = smiley
url = git@git.anduin.net:ltning/emoji_to_smiley

23
conv.py Normal file
View file

@ -0,0 +1,23 @@
#!/usr/bin/env python3
import sys
from smiley import smiley
from html.entities import codepoint2name
def retrohtml(text):
new_text_list = []
for character in text:
code_point = ord(character)
if code_point < 128:
new_text_list.append(character)
else:
try:
new_text_list.append(f"&{codepoint2name[code_point]};")
except KeyError:
# And fall back to a numeric entity
new_text_list.append(f"&#{code_point};")
return "".join(new_text_list).strip()
for line in sys.stdin:
line=smiley.replace_emoji(line)
line=retrohtml(line)
print(line)

1
smiley Submodule

@ -0,0 +1 @@
Subproject commit 483da44672613d011dac1025899e344830a841bd