Quotes: working, but missing HTML time tag

This commit is contained in:
Cyrille L 2022-12-19 17:41:57 +01:00
parent b1e250a3cf
commit cacad4565d
1 changed files with 51 additions and 23 deletions

View File

@ -302,8 +302,9 @@ 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 = figc = ''
tab_p = tab_c = 2 # Init 2 tabs after <blockquote> tab_p = tab_c = 2 # Init 2 tabs after <blockquote>
auth_html = title_html = ''
for qline in quote: for qline in quote:
# Begin marker quote [11] # Begin marker quote [11]
@ -319,11 +320,9 @@ def wip_quotes() :
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: # Set tabulation for paragraphs and content
tab_p = tab_p + 2 if author: tab_p = tab_p + 2 ; tab_c = tab_c + 4
tab_c = tab_c + 4 else: tab_c = tab_c + 2
else:
tab_c = tab_c + 2
# Replace opened paragrph with html line # Replace opened paragrph with html line
qline_html = '%s%s'%( qline_html = '%s%s'%(
@ -349,33 +348,62 @@ def wip_quotes() :
continue continue
# Add other lines # Add other lines
if quote_html: if quote_html: quote_html = '%s\n%s%s'%(
quote_html = '%s\n%s%s'%(quote_html, int(tab_c) * ' ', qline) 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: else:
quote_html = '%s%s'%(tab_c * ' ', qline) title_html = ' title="%s"'%author
auth_html = '%s'%author
if link: figc= '<a class="figc" href="%s">%s</a>'%(
if link: link, auth_html
cite = ' cite="%s"'%(link) )
else:
if lang: if book and date: title_html = ' title="%s (%s)"'%(
lang = ' lang="%s"'%lang book, date
)
elif book: title_html = ' title="%s"'%(book)
elif date: title_html = ' title="(%s)"'%(date)
# Create HTML Quote with datas
if author: if author:
quote_html = '<figure class="%s">\n'%set_css + \ quote_html = '<figure class="%s">\n'%set_css + \
' <blockquote class="%s"%s%s>\n'%( ' <blockquote class="%s"%s%s%s>\n'%(
set_css, lang, cite set_css, lang, cite, title_html
) + \ ) + \
'%s\n'%quote_html + \ '%s\n'%quote_html + \
' </blockquote>\n' + \ ' </blockquote>\n' + \
' <figcaption class="%s">\n'%set_css + \
' %s\n'%figc + \
' </figcaption>\n' + \
'</figure>' '</figure>'
else: else:
quote_html = '<blockquote class="%s"%s%s>\n'%( quote_html = '<blockquote class="%s"%s%s%s>\n'%(
set_css, lang, cite set_css, lang, cite, title_html
) + \ ) + \
'%s\n'%quote_html + \ '%s\n'%quote_html + \
'</blockquote>' '</blockquote>'
print('> quote:') # Replace line with final HTML Quote
print(quote_html) article_bottom = article_bottom.replace('Q64_%s_Q64'%line, quote_html)