From 439641718849483ea8cd8578d255e26d94cf98ff Mon Sep 17 00:00:00 2001 From: Cyrille L Date: Mon, 19 Dec 2022 16:34:09 +0100 Subject: [PATCH] Indev for quotes --- src/var/lib/tyto/program/wip.py | 39 +++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/src/var/lib/tyto/program/wip.py b/src/var/lib/tyto/program/wip.py index 9536b8a..3281038 100644 --- a/src/var/lib/tyto/program/wip.py +++ b/src/var/lib/tyto/program/wip.py @@ -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
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) + tab_p = tab_p + 2 + tab_c = tab_c + 4 else: - qline_html = ' %s'%(tyto.words_tags[10][2]%par_css) - + 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) - else: - quote_html = '%s\n %s'%(quote_html, qline) - else: quote_html = qline + quote_html = '%s\n%s%s'%(quote_html, int(tab_c) * ' ', qline) + else: + quote_html = '%s%s'%(tab_c * ' ', qline) if link: @@ -369,6 +376,6 @@ def wip_quotes() : '%s\n'%quote_html + \ '
' - + print('> quote:') print(quote_html)