wip: end of process, convert all b64

This commit is contained in:
Cyrille L 2022-11-19 15:42:09 +01:00
parent 06794ea31a
commit a0a425afb2
1 changed files with 22 additions and 0 deletions

View File

@ -101,6 +101,9 @@ def manage_wip(file_post, Force):
if links_u > 0: wip_links( wip_html) if links_u > 0: wip_links( wip_html)
if quotes > 0: wip_quotes( wip_html.rsplit('\n')) 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('> Article HTML:')
print(wip_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 # # TOOLS #
#=======#-------------------------------------------------------------- #=======#--------------------------------------------------------------