[F] Unescape backslash

This commit is contained in:
Hykilpikonna 2022-12-11 07:03:10 -05:00
parent 485aa44f3f
commit 5d392262c1
No known key found for this signature in database
GPG key ID: 256CD01A41D7FA26
42 changed files with 188 additions and 184 deletions

View file

@ -135,10 +135,14 @@ def export_distro(d: AsciiArt) -> str:
"""
Export distro to a python script
"""
# Escape variable name
varname = d.name.lower()
for s in string.punctuation + ' ':
varname = varname.replace(s, '_')
ascii = d.ascii.replace('"""', '\\"""')
# Escape/unescape ascii
ascii = d.ascii.replace('"""', '\\"""').replace("\\\\", "\\")
script = f"""
from ..distro import AsciiArt