From 61a27495eae945d613f77f2f740c53b3eb2c5f51 Mon Sep 17 00:00:00 2001 From: Cyrille L Date: Sun, 18 Dec 2022 16:08:03 +0100 Subject: [PATCH] Indev for quotes --- src/var/lib/tyto/program/wip.py | 48 ++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/src/var/lib/tyto/program/wip.py b/src/var/lib/tyto/program/wip.py index 1afb991..58d069d 100644 --- a/src/var/lib/tyto/program/wip.py +++ b/src/var/lib/tyto/program/wip.py @@ -289,8 +289,48 @@ def wip_quotes() : line = line.replace('_Q64', '') quote = tyto.b64('Decode', line, 'Q64_', '_Q64').rsplit("\n") - # Read the quote + # Read the quote. Get parameters + author = date = lang = book = link = quote_html = '' for qline in quote: - if line.startswith('tyto.words_tags[11][0]'): - set_css = get_css(line) - print(set_css) + if qline.startswith(tyto.words_tags[11][0]): + set_css = tyto.get_css(qline) + continue + if qline.startswith('_cite:'): + author = qline.rsplit('_cite:')[1].lstrip() + continue + if qline.startswith('_date:'): + date = qline.rsplit('_date:')[1].lstrip() + continue + if qline.startswith('_book:'): + book = qline.rsplit('_book:')[1].lstrip() + continue + if qline.startswith('_lang:'): + lang = qline.rsplit('_lang:')[1].lstrip() + continue + if qline.startswith('_link:'): + lang = qline.rsplit('_link:')[1].lstrip() + continue + + # paragraphs + # Construct quote_html + if qline.startswith(tyto.words_tags[10][0]): + par_css = tyto.get_css(qline) + qline_html = '%s'%(tyto.words_tags[10][2]%par_css) + + if quote_html: quote_html = '%s\n%s'%(quote_html,qline_html) + else: quote_html = qline_html + continue + + if qline.startswith(tyto.words_tags[10][1]): + qline_html = tyto.words_tags[10][3] + quote_html = '%s\n%s'%(quote_html, qline_html) + continue + + # End of quote + if qline.startswith(tyto.words_tags[11][1]): + continue + + if quote_html: quote_html = '%s\n%s'%(quote_html,qline) + else: quote_html = qline + + print('>>>>', quote_html)