[F] Fix tripple-quote escaping #222

This commit is contained in:
Azalea 2023-12-22 01:58:15 -05:00
parent 807eed022d
commit caa1547e8c
13 changed files with 63 additions and 36 deletions

View File

@ -2,7 +2,7 @@
from . import AsciiArt
aosc_os = AsciiArt(match=r'''"AOSC OS"*''', color='4 0 1 3', ascii=r"""
aosc_os = AsciiArt(match=r'''"AOSC OS"*''', color='4 0 1 3', ascii=r'''
${c2} __
${c2}gpBBBBBBBBBP
${c2}_gBBBBBBBBBRP
@ -13,12 +13,12 @@ ${c2} __
${c4}_w@@@@@@@@@@@@@@@@P" ${c1}_g@@@@@@@P"
${c4}_g@@@@@@@@@@@@@@@N"` ${c1}VMNN@NNNM^`
${c4}^MMM@@@@@@@@@@@MP" ${c3},ggppww__
${c4}`"\"\"\"" ${c3}_wNNNNNNNNNNNNNNNNNNN
${c4}`""""" ${c3}_wNNNNNNNNNNNNNNNNNNN
${c3}_gBNNNNNNNNNNNNNNNNNP"
${c3}_wNNNNNNNNNNNNNNNNNNMP`
${c3}_gBNNNNNNNNNNNNNNNNNP"
${c3}_wNNNNNNNNNNNNNNNNNNNM^
${c3}""Y^^MNNNNNNNNNNNNP`
${c3}`"\"\""\"\""
""")
${c3}`"""""""
''')

View File

@ -2,10 +2,10 @@
from . import AsciiArt
debian = AsciiArt(match=r'''"Debian"*''', color='1 7 3', ascii=r"""
debian = AsciiArt(match=r'''"Debian"*''', color='1 7 3', ascii=r'''
${c2} _,met$$$$$gg.
,g$$$$$$$$$$$$$$$P.
,g$$P" "\""Y$$.".
,g$$P" """Y$$.".
,$$P' `$$$.
',$$P ,ggs. `$$b:
`d$$' ,$P"' ${c1}.${c2} $$$
@ -19,6 +19,6 @@ ${c2} `Y$$
`$$b.
`Y$$b.
`"Y$b._
`"\""
""")
`"""
''')

View File

@ -624,6 +624,10 @@ def detect(name: str) -> AsciiArt | None:
from .interix import interix
return interix
if name.startswith('ironclad'):
from .ironclad import ironclad
return ironclad
if name.startswith('januslinux') or name.startswith('janus') or name.startswith('ataraxia linux') or name.startswith('ataraxia'):
from .januslinux import januslinux
return januslinux

View File

@ -2,7 +2,7 @@
from . import AsciiArt
haiku = AsciiArt(match=r'''"Haiku"*''', color='1 3 7 2', ascii=r"""
haiku = AsciiArt(match=r'''"Haiku"*''', color='1 3 7 2', ascii=r'''
${c3}
MMMM MMMM
@ -16,6 +16,6 @@ ${c3} MMMM${c4} .cOMMMMM|/MMMMM/`
MM${c4}MMMMMMM/`:MMM/ ${c3}MMMM
MMMM MMMM
MMMM MMMM
"\"\"" "\"\""
""")
"""" """"
''')

View File

@ -0,0 +1,19 @@
# This file is automatically generated. Please do not modify.
from . import AsciiArt
ironclad = AsciiArt(match=r'''"Ironclad"*''', color='5 7 0', ascii=r"""
${c3}
&#BGPPPPPG#&
B5?77!!?YJJ7!7YBB&
&G5YJ77!7JYYYYYBPJ&PY#
#PYYYYYY?!?YYYYY7?7JP5JJ
B?YYYYYY7!!7JYYYYJ!!?JJJ5
&& B7?J?77?7!!!!!77777!7Y5YYBBPGGG&
G77?YBB!!!!!!!!!!!!!JYJ??7JYJJY# PYPPG&
J777JB?!7JJ???!!!7?JYYYYYPJ!7JB
GYYG #JJJJJ??7!!!JYYY5PGB&GB&
#Y!?GB5YYJY5PG###&
GJJP
""")

View File

@ -7,7 +7,7 @@ ${c2} /==\
\==/
${c1} · · · · · · ·
· · · · · · · · · ·
· · · ${c2}.-======-.${c1}· · · ·
· · · ${c2}.-======-.${c1}· · · ·
${c2} .::.${c1} ·${c2}.-============-.${c1}· ${c2}.::.
.:==:${c1}· ${c2}.:===:'${c1}. ·· .${c2}':===:.${c1} ·${c2}:==:.
.:===:${c1} · ${c2}:===.${c1} · ${c3}.--.${c1} · ${c2}.===:${c1} · ${c2}:===:.

View File

@ -2,13 +2,13 @@
from . import AsciiArt
puffos = AsciiArt(match=r'''"PuffOS"*''', color='3', ascii=r"""
puffos = AsciiArt(match=r'''"PuffOS"*''', color='3', ascii=r'''
${c1}
_,..._,m,
,/' '"";
/ ".
,'mmmMMMMmm. \
_/-"^^^^^"\""%#%mm, ;
_/-"^^^^^"""%#%mm, ;
,m,_,' "###) ;,
(###% \#/ ;##mm.
^#/ __ ___ ; (######)
@ -16,5 +16,5 @@ ${c1}
_; (#\"// \"/#) ; ,/
@##\ \##/ = `"=" ,;mm/
`\##>.____,...,____,<####@
""")
''')

View File

@ -2,7 +2,7 @@
from . import AsciiArt
salix = AsciiArt(match=r'''"Salix"*''', color='2', ascii=r"""
salix = AsciiArt(match=r'''"Salix"*''', color='2', ascii=r'''
${c1} __s_aaaaaaaaauuoXSSSSSSSS:
._xSSSSSSSSSSSSSSSSSSSSSSSSSS:
_aSSSSSSSSSSSSSSSSSSSSSSSSSSSSS:
@ -15,13 +15,13 @@ ${c1} __s_aaaaaaaaauuoXSSSSSSSS:
oSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS;
:XSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS;
{SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
-"\"\""\"\""\"\""\"\""\"\""\"\""\"\""\"\""\"\""\"\""\"\"\""'
-"""""""""""""""""""""""""""""""""""'
<assssssssssssssssssssssssssssssss>
nSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS}
nSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS}`
XSSSSSSSSSSSSSSSSSSSSSSSSSSSS"`
SSSSSSSSSSSSSSSSSSSSSSSSS!"`
-"\"\""\"\""\"\""\"\""\"\""\"\""\"\""`
""")
-""""""""""""""""""""""`
''')

View File

@ -2,7 +2,7 @@
from . import AsciiArt
skiffos = AsciiArt(match=r'''"SkiffOS"*''', color='4 7', ascii=r"""
skiffos = AsciiArt(match=r'''"SkiffOS"*''', color='4 7', ascii=r'''
${c2}
,@@@@@@@@@@@w,_
${c2}====~~~,,.${c2}A@@@@@@@@@@@@@@@@@W,_
@ -12,6 +12,6 @@ ${c2}
${c2}*@@@@@@@@@@@@@@@@@@@@@@@@@p${c1}||||==,
${c1}`'||LLL{{""${c2}@$B@@@@@@@@@@@@@@@p${c1}||
${c1}`~=|||||||||||L"${c2}$@@@@@@@@@@@
${c1}````'"\"\""\"\""${c2}'"\"\""\"\"\""
""")
${c1}````'"""""""${c2}'""""""""
''')

View File

@ -2,14 +2,14 @@
from . import AsciiArt
slackel = AsciiArt(match=r'''"Slackel"*''', color='3', ascii=r"""
slackel = AsciiArt(match=r'''"Slackel"*''', color='3', ascii=r'''
${c1} _aawmmmmmwwaaaaas,,,_.
.ammmmm###mmmmmmm###BQmm##mws
.am###mmBmBmBmBmBmBmmmmm#mmmm#2
<q###mmBmBmBmBmBmBmBmBmBmBmmBmZ`
um#mmmBmBm##U##mmBmBmBmWmmBmWm#(
.wm#mmBBmm#Y~ ~XmBmBmWmmmmmBm#e
.dm#mmWmm#Z' ]#mBmBmmBZ!"\"\""`
.dm#mmWmm#Z' ]#mBmBmmBZ!""""`
.dm#mmBmm#2` ]mmmBmBm#2
jm#mmWmm#2` dmmBmBmB#(
)m##mBmmWZ` )##mBmBmmZ
@ -25,5 +25,5 @@ XBmBmBmBmm6s_aum##mmBmBm&^
)ZmBmBmmmBmBmmBmB##!`
-4U#mBmWmBmBm##2"
-!!XU##US*?"-
""")
''')

View File

@ -2,9 +2,9 @@
from . import AsciiArt
trisquel = AsciiArt(match=r'''"Trisquel"*''', color='4 6', ascii=r"""
trisquel = AsciiArt(match=r'''"Trisquel"*''', color='4 6', ascii=r'''
${c1} ,o$$$o.
,o$$Y"\""Y$$b
,o$$Y"""Y$$b
,o$$$$$$o. ,$$' , Y$$b
,o$$$$$$$$$$$$o. :$ b Y$$.
,$$"' "Y$$$$o. 'b. ,b d$$$
@ -12,7 +12,7 @@ $$' .d$$$$b '$$$$o 'Y$$$Y d$$$'
$$' q' 'b '$$$$$o._ _.o$$$$'
.$$,_ _,d$ ,$$$$$$$$$$$$${c2}$$$$Y'
${c1} '$$$$aaa$$$' .$$$$$$${c2}$$$$$$$$'
${c1} "\"\"" ${c2}d$$$$"'
${c1} """" ${c2}d$$$$"'
d$$$' .d$$b.
$$$$ .$" 'a$.
$$$$ $b $$.
@ -20,5 +20,5 @@ ${c1} "\"\"" ${c2}d$$$$"'
'$$$. .$$'
'a$$$o._.o$$a'
'a$$$$a'
""")
''')

View File

@ -2,7 +2,7 @@
from . import AsciiArt
windows95 = AsciiArt(match=r'''"Windows95"''', color='6 4 3 2 1 0', ascii=r"""
windows95 = AsciiArt(match=r'''"Windows95"''', color='6 4 3 2 1 0', ascii=r'''
${c6} ___
.--=+++++=-:.
. _ *%@@@@@@@@@@@@@@*
@ -18,8 +18,8 @@ ${c1} " , ${c6}%@@ ${c1}&&&&&%${c6}@@${c3}%&&&&&#${c6}@@
${c1} * oo *# ${c6}" _ ${c1}&&&&&%${c6}@@${c3}%&&&&&#${c6}@@
${c1} " , ${c6}%@@ ${c1}&&*"${c6}%@@@@@@${c3}"*%&${c6}@@
.${c1} * oo *# ${c6}" _ @@@@@@@@@@@@@@@@@
*:+:.__ :+# @@@ @%#=+"\"\""\""+==%#@
*:+:.__ :+# @@@ @%#=+""""""+==%#@
"+.-#+ +%* %+" " ":@
" "
""")
''')

View File

@ -141,16 +141,20 @@ def export_distro(d: AsciiArt) -> str:
# Escape/unescape ascii
ascii = d.ascii.replace("\\\\", "\\")
while '"""' in ascii:
ascii = ascii.replace('"""', '"\\""')
quotes = '"""'
if '"""' in ascii:
quotes = "'''"
if "'''" in ascii:
print(f"TODO: Cannot escape ascii because both \"\"\" and ''' exist: {ascii}")
script = f"""# This file is automatically generated. Please do not modify.
from . import AsciiArt
{varname} = AsciiArt(match=r'''{d.match}''', color='{d.color}', ascii=r\"""
{varname} = AsciiArt(match=r'''{d.match}''', color='{d.color}', ascii=r{quotes}
{ascii}
\""")
{quotes})
"""
write(Path(__file__).parent.parent / f'hyfetch/distros/{varname}.py', script)