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