From a0a425afb209bd143d3a4152224afa26e59704f9 Mon Sep 17 00:00:00 2001 From: Cyrille L Date: Sat, 19 Nov 2022 15:42:09 +0100 Subject: [PATCH] wip: end of process, convert all b64 --- src/var/lib/tyto/program/wip.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/var/lib/tyto/program/wip.py b/src/var/lib/tyto/program/wip.py index 972c3d3..d394f6b 100644 --- a/src/var/lib/tyto/program/wip.py +++ b/src/var/lib/tyto/program/wip.py @@ -101,6 +101,9 @@ def manage_wip(file_post, Force): if links_u > 0: wip_links( wip_html) if quotes > 0: wip_quotes( wip_html.rsplit('\n')) + # Get Legacy contents from base64 markers + convert_all_b64(wip_html.rsplit('\n')) + print('> Article HTML:') print(wip_html) @@ -504,6 +507,25 @@ def convert_icodes(article, css): ) +#=======================================# +# Convert all base64 to legacy contents # +#---------------------------------------# +def convert_all_b64(wip_lines): + global wip_html + + wip_tmp = '' + + for line in wip_lines: + b64s = re.findall(r'B64\|(.*?)\|B64', line) + for b64 in b64s: + convert_from_b64(b64) + line = line.replace('B64|%s|B64'%b64, src_content) + if wip_tmp: wip_tmp = wip_tmp + line + '\n' + else : wip_tmp = line + '\n' + + wip_html = wip_tmp + + #=======# # TOOLS # #=======#--------------------------------------------------------------