wip: ABBRs converted to base64

This commit is contained in:
Cyrille L 2022-11-18 11:09:45 +01:00
parent b66769a20a
commit 42bd5a40d8
2 changed files with 33 additions and 14 deletions

View File

@ -95,6 +95,7 @@ def manage_wip(file_post, Force):
wip_titles( wip_html.rsplit('\n'))
wip_words_markers(wip_html)
wip_anchors( wip_html)
wip_abbrs( wip_html)
# After all, convert protected contents
wip_links( wip_html)
@ -234,6 +235,25 @@ def wip_links(article):
wip_html = article
#
#
#
def wip_abbrs(article):
global wip_html
abbr_fmt = '<abbr class="%s" title="%s">%s</abbr>'
all_vars = set(globals())
for var in all_vars:
if var.startswith('abbr_'):
abbr = globals()[var]
abbr_b64 = abbr_fmt%(domain.domain_css, abbr[1], abbr[2])
convert_to_b64(abbr_b64)
print('B64 for %s :> %s'%(abbr[1], b64_content))
article = article.replace(abbr[0], b64_content)
wip_html = article
#======================================#
# Words Markers (strongs, emphasis...) #
#--------------------------------------#
@ -360,7 +380,9 @@ def convert_quote(bQuote):
else : quote_html = line
if not cite : author_show = 'NC'
if year and book: author_show = '%s%s%s'%(author_show, book_show, year_show)
if year and book: author_show = '%s%s%s'%(
author_show, book_show, year_show
)
if cite or link:
author_show = '%s%s'%(cite, author_show)
@ -397,7 +419,6 @@ def convert_quote(bQuote):
)
else : quote_html = blockquote
#print('> Quote_HTML:\n', quote_html)
#=================================#
# Return datas in quote from line #
@ -437,10 +458,8 @@ def convert_bcodes(article, fm, lm, css):
)
continue
if bCode:
bCode_lines = '%s%s\n'%(bCode_lines, line)
else:
article_temp = '%s%s\n'%(article_temp, line)
if bCode: bCode_lines = '%s%s\n'%(bCode_lines, line)
else : article_temp = '%s%s\n'%(article_temp, line)
#====================================#
# Protect bCodes contents to base64 #