From 413b6d291210870d04feb00f8cf1d4392f53ffb7 Mon Sep 17 00:00:00 2001 From: Cyrille L Date: Fri, 18 Nov 2022 16:36:46 +0100 Subject: [PATCH] check: stats for links in article ; need more investigating for others --- src/var/lib/tyto/program/check.py | 3 ++- src/var/lib/tyto/program/wip.py | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/var/lib/tyto/program/check.py b/src/var/lib/tyto/program/check.py index e4c4901..db6a651 100644 --- a/src/var/lib/tyto/program/check.py +++ b/src/var/lib/tyto/program/check.py @@ -520,6 +520,7 @@ def check_links(line, ln, stats_links_uniq): log.append_f(post_logs,msg_log,1) Post_Err = True + if Post_Err: return # Set final marker_N link = ( @@ -530,7 +531,7 @@ def check_links(line, ln, stats_links_uniq): globals()[link_nbr] = link # Stats: count occurence - stats_links_p = stats_counter(link_page) + stats_links_p = stats_links_p + stats_counter(link_page) #=================================# # Check every marker "file:" # diff --git a/src/var/lib/tyto/program/wip.py b/src/var/lib/tyto/program/wip.py index 0b956eb..51a4507 100644 --- a/src/var/lib/tyto/program/wip.py +++ b/src/var/lib/tyto/program/wip.py @@ -94,12 +94,12 @@ def manage_wip(file_post, Force): wip_begin_markers(wip_html.rsplit('\n')) wip_titles( wip_html.rsplit('\n')) wip_words_markers(wip_html) - wip_anchors( wip_html) - wip_abbrs( wip_html) + if anchors > 0: wip_anchors( wip_html) + if abbrs_u > 0: wip_abbrs( wip_html) # After all, convert protected contents - wip_links( wip_html) - wip_quotes( wip_html.rsplit('\n')) + if links_u > 0: wip_links( wip_html) + if quotes > 0: wip_quotes( wip_html.rsplit('\n')) print('> Article HTML:') print(wip_html) @@ -132,7 +132,7 @@ def wip_begin_markers(wip_lines): for line in wip_lines: if len(line) == 0: continue - # Find if line hase marker and remplace + # Find if line has marker and remplace for marker in marks_html: if re.match(marker[0], line): if marker[2]: # Has CSS @@ -220,7 +220,7 @@ def wip_anchors(article): # Convert links to HTML # # Each are converted to Base64 # #------------------------------# -def wip_links(article): +def wip_links(article): global wip_html link_fmt = '%s'