diff --git a/src/var/lib/tyto/program/wip.py b/src/var/lib/tyto/program/wip.py index d205267..28e0043 100644 --- a/src/var/lib/tyto/program/wip.py +++ b/src/var/lib/tyto/program/wip.py @@ -302,8 +302,9 @@ def wip_quotes() : # Read the quote. Get parameters author = date = lang = book = link = quote_html = '' - cite = '' + cite = figc = '' tab_p = tab_c = 2 # Init 2 tabs after
+ auth_html = title_html = '' for qline in quote: # Begin marker quote [11] @@ -319,11 +320,9 @@ def wip_quotes() : if qline.startswith(tyto.words_tags[10][0]): par_css = tyto.get_css(qline) - if author: - tab_p = tab_p + 2 - tab_c = tab_c + 4 - else: - tab_c = tab_c + 2 + # Set tabulation for paragraphs and content + 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'%( @@ -349,33 +348,62 @@ def wip_quotes() : continue # Add other lines - if quote_html: - quote_html = '%s\n%s%s'%(quote_html, int(tab_c) * ' ', qline) + if quote_html: quote_html = '%s\n%s%s'%( + quote_html, int(tab_c) * ' ', qline + ) + else: quote_html = '%s%s'%(tab_c * ' ', qline) + + # New quote set, then, repare datas + if link: cite = ' cite="%s"'%(link) + if lang: lang = ' lang="%s"'%lang + + # Preparing title="" tag and author reference + if author: + if book and date: + title_html = ' title="%s - %s (%s)"'%( + author, book, date + ) + auth_html = '%s - %s (%s)'%( + author, book, date + ) + elif book: + title_html = ' title="%s - %s"'%(author, book) + auth_html = '%s - %s'%(author, book) + elif date: + title_html = ' title="%s (%s)"'%(author, date) + auth_html = '%s (%s)'%(author, date) else: - quote_html = '%s%s'%(tab_c * ' ', qline) - - - if link: - cite = ' cite="%s"'%(link) - - if lang: - lang = ' lang="%s"'%lang + title_html = ' title="%s"'%author + auth_html = '%s'%author + if link: figc= '%s'%( + link, auth_html + ) + else: + if book and date: title_html = ' title="%s (%s)"'%( + book, date + ) + elif book: title_html = ' title="%s"'%(book) + elif date: title_html = ' title="(%s)"'%(date) + # Create HTML Quote with datas if author: quote_html = '
\n'%set_css + \ - '
\n'%( - set_css, lang, cite + '
\n'%( + set_css, lang, cite, title_html ) + \ '%s\n'%quote_html + \ '
\n' + \ + '
\n'%set_css + \ + ' %s\n'%figc + \ + '
\n' + \ '
' else: - quote_html = '
\n'%( - set_css, lang, cite + quote_html = '
\n'%( + set_css, lang, cite, title_html ) + \ '%s\n'%quote_html + \ '
' - - print('> quote:') - print(quote_html) + + # Replace line with final HTML Quote + article_bottom = article_bottom.replace('Q64_%s_Q64'%line, quote_html)