Indev for quotes

This commit is contained in:
Cyrille L 2022-12-19 16:34:09 +01:00
parent 7f4b35b8fe
commit 4396417188
1 changed files with 23 additions and 16 deletions

View File

@ -294,6 +294,7 @@ def wip_quotes() :
global author, link, lang, book, date
for ln, line in enumerate(article_bottom.rsplit('\n')):
# Decode from base64
if line.startswith('Q64'):
line = line.replace('Q64_', '')
line = line.replace('_Q64', '')
@ -302,50 +303,56 @@ def wip_quotes() :
# Read the quote. Get parameters
author = date = lang = book = link = quote_html = ''
cite = ''
tab_p = tab_c = 2 # Init 2 tabs after <blockquote>
for qline in quote:
# Begin marker quote [11]
if qline.startswith(tyto.words_tags[11][0]):
set_css = tyto.get_css(qline)
continue
# Search for parameters ans set them
if quote_params(qline): continue
# Paragraph [10] Open
# Construct quote_html
if qline.startswith(tyto.words_tags[10][0]):
par_css = tyto.get_css(qline)
if author:
qline_html = ' %s'%(tyto.words_tags[10][2]%par_css)
else:
qline_html = ' %s'%(tyto.words_tags[10][2]%par_css)
if author:
tab_p = tab_p + 2
tab_c = tab_c + 4
else:
tab_c = tab_c + 2
# Replace opened paragrph with html line
qline_html = '%s%s'%(
tab_p * ' ', tyto.words_tags[10][2]%par_css
)
# Add line to quote_html
if quote_html:
qquote_html = '%s\n%s'%(quote_html, qline_html)
else:
quote_html = '%s'%qline_html
continue
# Paragraph Close
if qline.startswith(tyto.words_tags[10][1]):
# Replace closed paragrph with html line
qline_html = tyto.words_tags[10][3]
if author:
quote_html = '%s\n %s'%(quote_html, qline_html)
else:
quote_html = '%s\n %s'%(quote_html, qline_html)
quote_html = '%s\n%s%s'%(quote_html, int(tab_p) * ' ',qline_html)
continue
# End of quote
# End of marker quote
if qline.startswith(tyto.words_tags[11][1]):
continue
# Add other lines
if quote_html:
if author:
quote_html = '%s\n %s'%(quote_html, qline)
quote_html = '%s\n%s%s'%(quote_html, int(tab_c) * ' ', qline)
else:
quote_html = '%s\n %s'%(quote_html, qline)
else: quote_html = qline
quote_html = '%s%s'%(tab_c * ' ', qline)
if link:
@ -369,6 +376,6 @@ def wip_quotes() :
'%s\n'%quote_html + \
'</blockquote>'
print('> quote:')
print(quote_html)