Indev for quotes
This commit is contained in:
parent
61a27495ea
commit
4ea481bbf1
|
@ -140,9 +140,20 @@ single_tags = [
|
||||||
markers_lists = ('+', '=', ' ')
|
markers_lists = ('+', '=', ' ')
|
||||||
|
|
||||||
# Tags used for titles
|
# Tags used for titles
|
||||||
|
#---------------------
|
||||||
titles_tags = ('#1 ', '#2 ', '#3 ', '#4 ', '#5 ', '#6 ')
|
titles_tags = ('#1 ', '#2 ', '#3 ', '#4 ', '#5 ', '#6 ')
|
||||||
|
|
||||||
|
|
||||||
|
# Tags for quote
|
||||||
|
quote_tags = [
|
||||||
|
('_cite:', 'author'),
|
||||||
|
('_date:', 'date'),
|
||||||
|
('_link:', 'link'),
|
||||||
|
('_book:', 'book'),
|
||||||
|
('_lang:', 'lang')
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
#=======#
|
#=======#
|
||||||
# TOOLS #
|
# TOOLS #
|
||||||
#=======#--------------------------------------------------------------
|
#=======#--------------------------------------------------------------
|
||||||
|
|
|
@ -277,11 +277,21 @@ def wip_images():
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
#============================================#
|
||||||
|
# Get parameters for quote (author, date...) #
|
||||||
|
#--------------------------------------------#
|
||||||
|
def quote_params(qline):
|
||||||
|
for tag in tyto.quote_tags:
|
||||||
|
if qline.startswith(tag[0]):
|
||||||
|
globals()[tag[1]] = qline.rsplit(' ',1)[1].lstrip()
|
||||||
|
return(True)
|
||||||
|
|
||||||
#
|
#
|
||||||
# INDEV: convert quote in article
|
# INDEV: convert quote in article
|
||||||
#
|
#
|
||||||
def wip_quotes() :
|
def wip_quotes() :
|
||||||
global article_bottom
|
global article_bottom
|
||||||
|
global author, link, lang, book, date
|
||||||
|
|
||||||
for ln, line in enumerate(article_bottom.rsplit('\n')):
|
for ln, line in enumerate(article_bottom.rsplit('\n')):
|
||||||
if line.startswith('Q64'):
|
if line.startswith('Q64'):
|
||||||
|
@ -291,25 +301,13 @@ 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 = ''
|
||||||
|
|
||||||
for qline in quote:
|
for qline in quote:
|
||||||
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
|
||||||
if qline.startswith('_cite:'):
|
|
||||||
author = qline.rsplit('_cite:')[1].lstrip()
|
if quote_params(qline): continue
|
||||||
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
|
# paragraphs
|
||||||
# Construct quote_html
|
# Construct quote_html
|
||||||
|
@ -333,4 +331,17 @@ def wip_quotes() :
|
||||||
if quote_html: quote_html = '%s\n%s'%(quote_html,qline)
|
if quote_html: quote_html = '%s\n%s'%(quote_html,qline)
|
||||||
else: quote_html = qline
|
else: quote_html = qline
|
||||||
|
|
||||||
print('>>>>', quote_html)
|
if author:
|
||||||
|
quote_html = '<figure class="%s">\n'%set_css + \
|
||||||
|
'<blockquote>\n' + \
|
||||||
|
'%s\n'%quote_html + \
|
||||||
|
'</blockquote>\n' + \
|
||||||
|
'</figure>'
|
||||||
|
else:
|
||||||
|
quote_html = '<blockquote class="%s">\n'%set_css + \
|
||||||
|
'%s\n'%quote_html + \
|
||||||
|
'</blockquote>'
|
||||||
|
|
||||||
|
|
||||||
|
print(quote_html)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue