From 6983ea89edc47b8f0b536e93d000a3ed97f64dfd Mon Sep 17 00:00:00 2001 From: Cyrille L Date: Sat, 31 Dec 2022 15:47:14 +0100 Subject: [PATCH] wip: fix quotes. Added pre-tabs for html article --- src/var/lib/tyto/program/wip.py | 67 ++++++++++++++++++++++++++++----- 1 file changed, 57 insertions(+), 10 deletions(-) diff --git a/src/var/lib/tyto/program/wip.py b/src/var/lib/tyto/program/wip.py index 06643e5..1d0af86 100644 --- a/src/var/lib/tyto/program/wip.py +++ b/src/var/lib/tyto/program/wip.py @@ -91,6 +91,7 @@ def wip_article(target): wip_icodes() # inline_codes. Decode base64 icode and replace wip_bcodes() # Block-codes. Decode B64 and convert to HTML wip_raws(target) # Read file and convert to HTML + wip_tabs() # make HTML tabulations # Result (temp display) print(article_bottom) @@ -311,6 +312,7 @@ def wip_quotes() : # Read the quote. Get parameters author = date = lang = book = link = quote_html = '' cite = figc = '' + tab_t = '' tab_p = tab_c = 2 # Init 2 tabs after
auth_html = title_html = '' @@ -383,9 +385,13 @@ def wip_quotes() : else: title_html = ' title="%s"'%author auth_html = '%s'%author + if link: figc= '%s'%( link, auth_html ) + else: + figc = '%s'%auth_html + else: if book and date: title_html = ' title="%s (%s)"'%( book, date @@ -395,8 +401,9 @@ def wip_quotes() : time_html_o = time_html_c = '' if date: - time_html_o = '\n' + if author: tab_t = ' ' + time_html_o = '%s\n'%tab_t # Create HTML Quote with datas if author: @@ -404,9 +411,9 @@ def wip_quotes() : '
\n'%( set_css, lang, cite, title_html ) + \ - ' ' + time_html_o + \ + time_html_o + \ '%s\n'%quote_html + \ - ' ' + time_html_c + \ + time_html_c + \ '
\n' + \ '
\n'%set_css + \ ' %s\n'%figc + \ @@ -521,15 +528,17 @@ def wip_titles(): article_tmp2 = article_temp indiv = False for ln, line in enumerate(article_tmp2.rsplit('\n')): + try: article_tmp2.rsplit('\n')[ln + 1] + except: continue + if line.startswith('\n%s'%line ) indiv = False - if line.startswith(' + -# +#==============================================# +# Convert raw file to HTML with
 +  #
+#----------------------------------------------#
 def wip_raws(target):
   if uniq_raws == 0: return
   
@@ -568,3 +577,41 @@ def wip_raws(target):
     article_bottom = article_bottom.replace(
                      eval(raw)[0], raw_html
                      )
+
+#
+# Make HTML tabulations
+#
+def wip_tabs():
+  global article_bottom
+  article_temp = ''
+  tab_start = 8 # From 
tag + indiv = False + + for line in article_bottom.rsplit('\n'): + # Titles + if line.startswith(''): + tab = int(tab) - 2 + article_temp = '%s\n%s%s'%(article_temp, tab * ' ', line) + indiv = False + continue + + # Other contents + else: + article_temp = '%s\n%s%s'%(article_temp, tab * ' ', line) + + article_bottom = article_temp +