From 2d1ccc1ec8947dfc060ab5c58904cc3d6962e2a7 Mon Sep 17 00:00:00 2001 From: Cyrille L Date: Thu, 29 Dec 2022 23:44:07 +0100 Subject: [PATCH] wip: Added module to convert inline-codes --- src/var/lib/tyto/program/wip.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/var/lib/tyto/program/wip.py b/src/var/lib/tyto/program/wip.py index c17b7b9..f979dec 100644 --- a/src/var/lib/tyto/program/wip.py +++ b/src/var/lib/tyto/program/wip.py @@ -89,6 +89,9 @@ def wip_article(target): # Quotes wip_quotes() # Decode B64 and convert + + # inline_codes + wip_icodes() print(article_bottom) @@ -286,9 +289,9 @@ def quote_params(qline): globals()[tag[1]] = qline.rsplit(' ',1)[1].lstrip() return(True) -# -# INDEV: convert quote in article -# +#==========================# +# Convert quote in article # +#--------------------------# def wip_quotes() : global article_bottom global author, link, lang, book, date @@ -417,4 +420,15 @@ def wip_quotes() : article_bottom = article_bottom.replace( 'Q64.%s.Q64'%line, quote_html ) - + +#==========================# +# Convert all inline-codes # +#--------------------------# +def wip_icodes(): + global article_bottom + + matches = re.findall(r'I64.(.*?).I64', article_bottom) + for match in matches: + rep_icode = 'I64.' + match + '.I64' + src_icode = tyto.b64("Decode", match, 'I64.', '.I64') + article_bottom = article_bottom.replace(rep_icode, src_icode)