From 3406954067dcca08b1f9e165fa4c45430153cfef Mon Sep 17 00:00:00 2001 From: Cyrille LOUARN Date: Wed, 18 Oct 2023 09:14:38 +0200 Subject: [PATCH] [1.9.26] - indented titles, prepared some words marks --- CHANGELOG.md | 4 + src/usr/bin/tyto | 4 +- .../program/__pycache__/check.cpython-311.pyc | Bin 38379 -> 39105 bytes .../program/__pycache__/post.cpython-311.pyc | Bin 9500 -> 9901 bytes .../program/__pycache__/wip.cpython-311.pyc | Bin 9003 -> 9032 bytes src/var/lib/tyto/program/check.py | 171 +++++++++++------- src/var/lib/tyto/program/post.py | 19 +- src/var/lib/tyto/program/wip.py | 2 +- 8 files changed, 129 insertions(+), 71 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bec4f5f..243d2c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ Tyto - Littérateur # CURRENTLY IN DEV ! +## [1.9.26] +- user can indent titles in text +- prepared words markers (strong, bolds) (some to add soon) + ## [1.9.25] - fix typo when creating HTML list - new anchors process (HTML prepared at 'check') diff --git a/src/usr/bin/tyto b/src/usr/bin/tyto index 9371352..595eb11 100755 --- a/src/usr/bin/tyto +++ b/src/usr/bin/tyto @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Version: 1.9.25 -# Updated: 2023-10-15 1697327876 +# Version: 1.9.26 +# Updated: 2023-10-18 1697613100 # Tyto - Littérateur # Copyright (C) 2023 Cyrille Louarn diff --git a/src/var/lib/tyto/program/__pycache__/check.cpython-311.pyc b/src/var/lib/tyto/program/__pycache__/check.cpython-311.pyc index 3c221551e5b0dcc5fb7e1d3d148341db230978ac..8670f26608bf101fb0a46dddd3de2659164fabc6 100644 GIT binary patch delta 7074 zcmb7Jd01Olc7OLhA)zNE)+dB8Mq-zZ*&*IA#@N`{1kB=?cnJ|a*#@)aN#3w1apFlF zhfHveCrcC0DD&A4X`GA_IWsh$lQ3=5Nx$|FEh!!rSm}t*Vwail{5&lMJ z*4*K#;5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311.pyc b/src/var/lib/tyto/program/__pycache__/wip.cpython-311.pyc index 2fc89ada488dfcd9b6b4f9c3ec15b75b88145ec9..e9381e49ab058b11acbcad562546ba2880ae8691 100644 GIT binary patch delta 83 zcmZ4OcEXK!IWI340}!lf(og-dk=KP=Q9(gh!6rGgBvm0fC$YHLR;jQwza&-3PPN!Z kA0%wIIh^|hBjeG{3cOs*oQ@ZyY<7fPlycl`DDX=N04n1eZ~y=R delta 59 zcmX@%w%Uz%IWI340}#ltX{X-Z$m_z*#;TyJpjy1Si2DR1(_!Yx1= 0 and index0 < 0: post.error = \ - debug.out(53, '%s: %s) "%s"...'%( + debug.out(53, '%s: %s) %s...'%( markers[2], tag_ln, markers[0] ), post.uri, True,2, False) return False if index0 >= 0 and index1 < 0: post.error = \ - debug.out(53, '%s: %s) ..."%s"'%( + debug.out(53, '%s: %s) ...%s'%( markers[2], tag_ln, markers[1] ), post.uri, True,2, False) return False if index0 != index1: post.error = \ - debug.out(53, '%s: %s) "%s"..."%s"'%( + debug.out(53, '%s: %s) %s...%s'%( markers[2], tag_ln, markers[0], markers[1] ), post.uri, True,2, False) return False @@ -620,7 +624,7 @@ def icodes(): # First marker is a closed one if m1 < m0: post.error = \ - debug.out(53, '%s) "%s"..."%s"'%( + debug.out(53, '%s) %s..."%s"'%( ln, markers[1][1], markers[1][0] ), post.uri, True,2, False) return False @@ -628,7 +632,7 @@ def icodes(): # First marker but unused closed one if m0 >= 0 and m1 == -1: post.error = \ - debug.out(53, '%s) ..."%s"'%( + debug.out(53, '%s) ...%s'%( ln, markers[1][1] ), post.uri, True,2, False) return False @@ -636,7 +640,7 @@ def icodes(): # Last marker but unused opened one elif m1 >= 0 and m0 == -1: post.error = \ - debug.out(53, '%s) "%s"...'%( + debug.out(53, '%s) %s...'%( ln, markers[1][0] ), post.uri, True,2, False) return False @@ -653,13 +657,17 @@ def icodes(): line = line.replace(icnew, "") # Set HTML [ICODES] to post database - icode_var = "icode_%s"%post.stats_text_icodes - icleg = markers[0][0] + icode + markers[0][1] - html_var = "html_%s"%post.stats_text_icodes html_val = icnew.replace(markers[0][4], markers[0][2]%css) - html_val = html_val.replace(markers[0][5], markers[0][3]) - post.cf_set("ICODES", icode_var, icleg) - post.cf_set("ICODES", html_var, html_val) + post.cf_set( + "ICODES", + "icode_%s"%post.stats_text_icodes, + markers[0][0] + icode + markers[0][1] + ) + post.cf_set( + "ICODES", + "html_%s"%post.stats_text_icodes, + html_val.replace(markers[0][5], markers[0][3]) + ) # Single mark line = line.replace(markers[1][0], markers[1][4]) @@ -672,13 +680,17 @@ def icodes(): line = line.replace(icnew, "") # Set HTML [ICODES] to post database - icode_var = "icode_%s"%post.stats_text_icodes - icleg = markers[1][0] + icode + markers[1][1] - html_var = "html_%s"%post.stats_text_icodes html_val = icnew.replace(markers[1][4], markers[1][2]%css) - html_val = html_val.replace(markers[1][5], markers[1][3]) - post.cf_set("ICODES", icode_var, icleg) - post.cf_set("ICODES", html_var, html_val) + post.cf_set( + "ICODES", + "icode_%s"%post.stats_text_icodes, + markers[1][0] + icode + markers[1][1] + ) + post.cf_set( + "ICODES", + "html_%s"%post.stats_text_icodes, + html_val.replace(markers[1][5], markers[1][3]) + ) texts[ln - 1 - post.head_lines] = line @@ -697,30 +709,34 @@ def sl_stags(): anchors_ids = () # Uniq anchors IDs for ln, line in enumerate(texts, post.head_lines + 1): + linels = line.lstrip() + # legacy Tyto Titles - if line.startswith(post.tyto_titles): - if not line[3:]: + if linels.startswith(post.tyto_titles): + if not linels[3:]: post.error = \ - debug.out(52, "%s. %s ?"%(ln, line), post.uri, True, 2, False) + debug.out(52, "%s) %s ?"%(ln, line), post.uri, True, 2, False) return False # Avoid wanting #6 - #9 (but accept #1x.. #5x.. as comments...) - elif line[1].isdigit() and int(line[1]) >= 6: + elif linels[1].isdigit() and int(linels[1]) >= 6: post.error = \ - debug.out(52, "%s) %s..."%(ln, line[0:10]), post.uri, True, 1, False) + debug.out(52, "%s) %s..."%(ln, linels[0:10]), post.uri, True, 1, False) return False post.stats_titles += 1 # Create html value for this title in database - link_var = "title_%s"%post.stats_titles - post.cf_set("TITLES", link_var, line) - - html_var = "html_%s"%post.stats_titles - mark = line[0:2] - title = line[3:] - html_val = post.html_titles[mark]%(css, title) - post.cf_set("TITLES", html_var, html_val) + post.cf_set( + "TITLES", + "title_%s"%post.stats_titles, + line + ) + post.cf_set( + "TITLES", + "html_%s"%post.stats_titles, + post.html_titles[linels[0:2]]%(css, line[3:]) + ) # Count Tyto Comments @@ -734,24 +750,34 @@ def sl_stags(): # Convert tyto commented marker to HTML if line.lstrip().startswith(post.text_comments[0]): real_com = line.lstrip()[3:] - link_var = "comm_%s"%post.stats_html_coms - post.cf_set("COMMENTS", link_var, line.lstrip()) - html_var = "html_%s"%post.stats_html_coms - post.cf_set("COMMENTS", html_var, ''%real_com) + post.cf_set( + "COMMENTS", + "comm_%s"%post.stats_html_coms, + line.lstrip() + ) + post.cf_set( + "COMMENTS", + "html_%s"%post.stats_html_coms, + ''%real_com + ) # Add stat + html for [IMAGES] when user wants to show logo in post elif line.lstrip().startswith("_image:logo"): post.stats_text_images += 1 - link_var = "image_%s"%(post.ml_tags_stats["image:"] + 1) - link_val = "_image:logo" - html_var = "html_%s"%(post.ml_tags_stats["image:"] + 1) - html_val = tyto.image_link%( - post.logo[1], "post_logo image", "%%s", - post.title[1], post.title[1], "%%s" + post.cf_set( + "IMAGES", + "image_%s"%(post.ml_tags_stats["image:"] + 1), + "_image:logo" + ) + post.cf_set( + "IMAGES", + "html_%s"%(post.ml_tags_stats["image:"] + 1), + tyto.image_link%( + post.logo[1], "post_logo image", "%%s", + post.title[1], post.title[1], "%%s" ) - post.cf_set("IMAGES", link_var, link_val) - post.cf_set("IMAGES", html_var, html_val) + ) # Anchor source @@ -813,6 +839,17 @@ def anchors_links(): return True + +#======================================= +# CHeck paired words marks # +# Count for stats # +# ! No neeed to create HTML in post db # +#--------------------------------------# +def words_tags(): + print("words_tags: soon...") + + + #================================# # Update post configuration file # #--------------------------------# @@ -883,6 +920,8 @@ def cf_update_values(): post.cf_set("STATS_TEXTS", "anc_targets", str(post.stats_text_anc_ids)) post.cf_set("STATS_TEXTS", "anc_links", str(post.stats_text_anc_links)) post.cf_set("STATS_TEXTS", "titles", str(post.stats_titles)) + post.cf_set("STATS_TEXTS", "parags", str(post.ptags_stats["parags"])) + post.cf_set("STATS_TEXTS", "divs", str(post.ptags_stats["divs"])) post.cf_set("STATS_TEXTS", "bcodes", str(post.ptags_stats["bcodes"])) post.cf_set("STATS_TEXTS", "bcodes_lines", str(post.stats_bcodes_lines)) post.cf_set("STATS_TEXTS", "quotes", str(post.ptags_stats["quotes"])) @@ -896,6 +935,8 @@ def cf_update_values(): post.cf_set("STATS_TEXTS", "codes", str(post.stats_text_codes)) post.cf_set("STATS_TEXTS", "raws", str(post.stats_text_raws)) + # ============================ # Write new values in database + # ============================ post.cf_write() diff --git a/src/var/lib/tyto/program/post.py b/src/var/lib/tyto/program/post.py index 559ed72..3b05878 100644 --- a/src/var/lib/tyto/program/post.py +++ b/src/var/lib/tyto/program/post.py @@ -253,6 +253,7 @@ stats_bcodes_lines = 0 stats_quotes = 0 stats_parags = 0 stats_lists = 0 +stats_divs = 0 stats_links = 0 stats_images = 0 stats_files = 0 @@ -317,9 +318,10 @@ value2s_ext_uris = ("http", "ftp") # Paired markers ptags = ( ("{{", "}}", "bcodes"), - ("[[", "]]", "quotes"), + ('["', '"]', "quotes"), ("((", "))", "parags", '

', "

"), - ("<<", ">>", "lists", "=", "+"), + ("<:", ":>", "lists", "=", "+"), + ("[[", "]]", "divs", '
', "
") ) ptags_stats = { @@ -327,6 +329,7 @@ ptags_stats = { "quotes" : stats_quotes, "parags" : stats_parags, "lists" : stats_lists, + "divs" : stats_divs, } # Tyto Titles #1 =

@@ -345,9 +348,19 @@ text_comments = (";;", "