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

@ -1115,7 +1115,7 @@ def create_DB(post_db):
if stats_abbrs_uniq > 0:
for n in range(1,stats_abbrs_uniq+1):
m = 'abbr_%s'%n
domain.append_f(post_db,'%s = %s'%(m,globals()[m]))
domain.append_f(post_db,'%s = %s'%(m,globals()[m]))
# Statistics Post conf
lines_conf = ''

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...) #
#--------------------------------------#
@ -356,11 +376,13 @@ def convert_quote(bQuote):
# main quote content
else:
if quote_html: quote_html = '%s\n%s'%(quote_html, line)
else : quote_html = line
if quote_html: quote_html = '%s\n%s'%(quote_html, line)
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)
@ -393,17 +415,16 @@ def convert_quote(bQuote):
)
else:
if year: quote_html = '<time datetime="%s">\n%s\n</time>'%(
year, blockquote
)
else: quote_html = blockquote
#print('> Quote_HTML:\n', quote_html)
year, blockquote
)
else : quote_html = blockquote
#=================================#
# Return datas in quote from line #
#---------------------------------#
def quote_data(line):
return line.split(' ',1)[1].lstrip()
return line.split(' ', 1)[1].lstrip()
#=========================#
@ -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 #