diff --git a/src/var/lib/tyto/program/tyto.py b/src/var/lib/tyto/program/tyto.py index 70a5747..2bce32d 100644 --- a/src/var/lib/tyto/program/tyto.py +++ b/src/var/lib/tyto/program/tyto.py @@ -140,9 +140,20 @@ single_tags = [ markers_lists = ('+', '=', ' ') # Tags used for titles +#--------------------- titles_tags = ('#1 ', '#2 ', '#3 ', '#4 ', '#5 ', '#6 ') +# Tags for quote +quote_tags = [ + ('_cite:', 'author'), + ('_date:', 'date'), + ('_link:', 'link'), + ('_book:', 'book'), + ('_lang:', 'lang') +] + + #=======# # TOOLS # #=======#-------------------------------------------------------------- diff --git a/src/var/lib/tyto/program/wip.py b/src/var/lib/tyto/program/wip.py index 58d069d..d3cc65d 100644 --- a/src/var/lib/tyto/program/wip.py +++ b/src/var/lib/tyto/program/wip.py @@ -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 # def wip_quotes() : global article_bottom + global author, link, lang, book, date for ln, line in enumerate(article_bottom.rsplit('\n')): if line.startswith('Q64'): @@ -291,25 +301,13 @@ def wip_quotes() : # Read the quote. Get parameters author = date = lang = book = link = quote_html = '' + for qline in quote: 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 + + if quote_params(qline): continue # paragraphs # Construct quote_html @@ -333,4 +331,17 @@ def wip_quotes() : if quote_html: quote_html = '%s\n%s'%(quote_html,qline) else: quote_html = qline - print('>>>>', quote_html) + if author: + quote_html = '
\n'%set_css + \ + '
\n' + \ + '%s\n'%quote_html + \ + '
\n' + \ + '
' + else: + quote_html = '
\n'%set_css + \ + '%s\n'%quote_html + \ + '
' + + + print(quote_html) +