diff --git a/CHANGELOG.md b/CHANGELOG.md index 697b74a..929980e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,11 @@ Tyto - Littérateur # CURRENTLY IN DEV ! +## [1.9.20] +- working on 'check' process +- - updated 'logo:' process +- - added 'abbr:' process + ## [1.9.19] - working on 'check' process - - Added post 'logo: URI' (for social network share + opt show on page) diff --git a/src/usr/bin/tyto b/src/usr/bin/tyto index fe0bf51..62062b9 100755 --- a/src/usr/bin/tyto +++ b/src/usr/bin/tyto @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Version: 1.9.19 -# Updated: 2023-10-05 1696512944 +# Version: 1.9.20 +# Updated: 2023-10-06 1696580458 # 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 813b7d5..8af7c7c 100644 Binary files a/src/var/lib/tyto/program/__pycache__/check.cpython-311.pyc and b/src/var/lib/tyto/program/__pycache__/check.cpython-311.pyc differ diff --git a/src/var/lib/tyto/program/__pycache__/debug.cpython-311.pyc b/src/var/lib/tyto/program/__pycache__/debug.cpython-311.pyc index b13f9ab..f519fad 100644 Binary files a/src/var/lib/tyto/program/__pycache__/debug.cpython-311.pyc and b/src/var/lib/tyto/program/__pycache__/debug.cpython-311.pyc differ diff --git a/src/var/lib/tyto/program/__pycache__/post.cpython-311.pyc b/src/var/lib/tyto/program/__pycache__/post.cpython-311.pyc index 1267ccd..8d00bd1 100644 Binary files a/src/var/lib/tyto/program/__pycache__/post.cpython-311.pyc and b/src/var/lib/tyto/program/__pycache__/post.cpython-311.pyc differ diff --git a/src/var/lib/tyto/program/check.py b/src/var/lib/tyto/program/check.py index 609e76f..db256b4 100644 --- a/src/var/lib/tyto/program/check.py +++ b/src/var/lib/tyto/program/check.py @@ -254,9 +254,11 @@ def is_valid_date(date): # Written using 3 lines # #----------------------------# def ml_tags(): + global value1 + + value1 = "" R_tag = post.ml_tags[3] # raw: C_tag = post.ml_tags[4] # code: - A_tag = post.ml_tags[5] # abbr: c = 0 # Continue for next x lines, as tags are 3 lines values for ln, line in enumerate(headers): @@ -265,7 +267,8 @@ def ml_tags(): continue if not line or line.isspace() or line.startswith("#"): continue - + + # link: if line.startswith(post.ml_tags[0]): post.stats_links += 1 if not ml_tag_values(ln, post.ml_tags[0], post.stats_links): @@ -273,19 +276,39 @@ def ml_tags(): c = 2 ; continue + # file: elif line.startswith(post.ml_tags[2]): - post.stats_files += 1 - if not ml_tag_values(ln, post.ml_tags[2], post.stats_files): - return False # value errors - - c = 2 ; continue - + post.stats_files += 1 + if not ml_tag_values(ln, post.ml_tags[2], post.stats_files): + return False # value errors + + c = 2 ; continue + + # image: elif line.startswith(post.ml_tags[1]): - post.stats_images += 1 - if not ml_tag_values(ln, post.ml_tags[1], post.stats_images): - return False # value errors + post.stats_images += 1 + if not ml_tag_values(ln, post.ml_tags[1], post.stats_images): + return False # value errors + # image: logo is reserved for post logo + if value1 == "logo": + debug.out(56, "%s) 'logo'"%(ln+1), post.uri, True, 2, False) + return False - c = 2 ; continue + c = 2 ; continue + + # ABBRS: + elif line.startswith(post.ml_tags[5]): + post.stats_abbrs += 1 + if not ml_tag_values(ln, post.ml_tags[5], post.stats_abbrs): + return False # value errors + + c = 2 ; continue + + + # value1 must not starts with "_", as used by Tyto + if value1.startswith("_"): + debug.out(56, "%s) '_...'"%(ln+1), post.uri, True, 2, False) + return False return True @@ -298,7 +321,7 @@ def ml_tags(): # Return True/False (if no value) # #----------------------------------------# def ml_tag_values(ln, tag, stats): - global value2 + global value1, value2 # Get 3 lines values value1 = headers[ln].rsplit(":")[1].lstrip() @@ -359,7 +382,14 @@ def ml_tag_values(ln, tag, stats): html_value = '%s'%( value2, "%%s", "%%s", value3, "%%s" ) - + + elif tag == post.ml_tags[5]: + section = "ABBRS" + post.stats_text_abbrs += post.text_contents.count(tyto_value) + html_value = '%s'%( + domain.css, value2, value3 + ) + post.cf.set(section, link_var, tyto_value) post.cf.set(section, html_var, html_value) @@ -376,8 +406,6 @@ def ml_tag_values(ln, tag, stats): def is_value2_file_exists(ln, tag, val2): global value2, src_uri - print("check: val2", tag, val2) - # uri "@..." means generic folders if val2[0].startswith("@"): if val2[1] == "/": val2 = val2[2:] @@ -549,14 +577,15 @@ def titles(): elif line.lstrip().startswith(post.text_comments): post.stats_html_coms += 1 - # Add stat for [] when user wants to show logo in post + # 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.stats_images+1) link_val = "_image:logo" html_var = "html_%s"%(post.stats_images+1) html_val = '%s'%( - post.logo[1], "%%s", "%%s", post.title[1], "%%s") + post.logo[1], "%%s", "%%s", post.title[1], "%%s" + ) post.cf.set("IMAGES", link_var, link_val) post.cf.set("IMAGES", html_var, html_val) @@ -571,46 +600,48 @@ def cf_update_values(): post.cf.set("DOMAIN", "name", domain.name) - post.cf.set("FILE", "id", post.uri_id) - post.cf.set("FILE", "uri", post.uri) - post.cf.set("FILE", "db", post.cf_uri) + post.cf.set("FILE", "id", post.uri_id) + post.cf.set("FILE", "uri", post.uri) + post.cf.set("FILE", "db", post.cf_uri) post.cf.set("FILE", "target", post.wrk_target) - post.cf.set("HEADERS", "title", post.title[1]) - post.cf.set("HEADERS", "about", post.about[1]) - post.cf.set("HEADERS", "date", post.date[1]) - post.cf.set("HEADERS", "tags", post.tags[1]) + post.cf.set("HEADERS", "title", post.title[1]) + post.cf.set("HEADERS", "about", post.about[1]) + post.cf.set("HEADERS", "date", post.date[1]) + post.cf.set("HEADERS", "tags", post.tags[1]) post.cf.set("HEADERS", "authors", post.author[1]) post.cf.set("HEADERS", "sitemap", str(sitemap)) - post.cf.set("CHECK", "hash", post.wrk_id) - post.cf.set("CHECK", "date", chk_date) + post.cf.set("CHECK", "hash", post.wrk_id) + post.cf.set("CHECK", "date", chk_date) post.cf.set("CHECK", "static", str(domain.static)) post.cf.set("WIP", "web", "%s%s"%(domain.wip_url, post.wrk_target)) - post.cf.set("WIP", "uri", "%s%s"%(domain.wip, post.wrk_target)) + post.cf.set("WIP", "uri", "%s%s"%(domain.wip, post.wrk_target)) post.cf.set("WWW", "web", "%s%s"%(domain.www_url, post.wrk_target)) - post.cf.set("WWW", "uri", "%s%s"%(domain.www, post.wrk_target)) + post.cf.set("WWW", "uri", "%s%s"%(domain.www, post.wrk_target)) stats_tyto_all_coms = post.stats_tyto_text_coms + post.stats_tyto_head_coms - post.cf.set("STATS_FILE", "lines", str(post.lines)) + post.cf.set("STATS_FILE", "lines", str(post.lines)) post.cf.set("STATS_FILE", "tyto_coms", str(stats_tyto_all_coms)) - post.cf.set("STATS_FILE", "files", str(post.stats_total_files)) + post.cf.set("STATS_FILE", "files", str(post.stats_total_files)) - post.cf.set("STATS_HEADERS", "lines", str(post.head_lines)) + post.cf.set("STATS_HEADERS", "lines", str(post.head_lines)) post.cf.set("STATS_HEADERS", "tyto_coms", str(post.stats_tyto_head_coms)) - post.cf.set("STATS_HEADERS", "links", str(post.stats_links)) - post.cf.set("STATS_HEADERS", "files", str(post.stats_files)) - post.cf.set("STATS_HEADERS", "images", str(post.stats_images)) + post.cf.set("STATS_HEADERS", "links", str(post.stats_links)) + post.cf.set("STATS_HEADERS", "files", str(post.stats_files)) + post.cf.set("STATS_HEADERS", "images", str(post.stats_images)) + post.cf.set("STATS_HEADERS", "abbrs", str(post.stats_abbrs)) - post.cf.set("STATS_TEXTS", "lines", str(post.text_lines)) + post.cf.set("STATS_TEXTS", "lines", str(post.text_lines)) post.cf.set("STATS_TEXTS", "tyto_coms", str(post.stats_tyto_text_coms)) post.cf.set("STATS_TEXTS", "html_coms", str(post.stats_html_coms)) - post.cf.set("STATS_TEXTS", "titles", str(post.stats_titles)) - post.cf.set("STATS_TEXTS", "links", str(post.stats_text_links)) - post.cf.set("STATS_TEXTS", "files", str(post.stats_text_files)) - post.cf.set("STATS_TEXTS", "images", str(post.stats_text_images)) + post.cf.set("STATS_TEXTS", "titles", str(post.stats_titles)) + post.cf.set("STATS_TEXTS", "links", str(post.stats_text_links)) + post.cf.set("STATS_TEXTS", "files", str(post.stats_text_files)) + post.cf.set("STATS_TEXTS", "images", str(post.stats_text_images)) + post.cf.set("STATS_TEXTS", "abbrs", str(post.stats_text_abbrs)) with open(post.cf_uri, "w") as f: post.cf.write(f) diff --git a/src/var/lib/tyto/program/debug.py b/src/var/lib/tyto/program/debug.py index 6610481..6dedfca 100644 --- a/src/var/lib/tyto/program/debug.py +++ b/src/var/lib/tyto/program/debug.py @@ -94,6 +94,7 @@ def out(nbr, var, val, show, color, stop): 53 : langs.logs.err_post_paired, 54 : langs.logs.err_post_indent, 55 : langs.logs.err_post_in_tag, + 56 : langs.logs.err_post_datatag, # WARNINGS (100-200) 100 : langs.logs.warn_no_dom, 101 : langs.logs.domain_created, diff --git a/src/var/lib/tyto/program/post.py b/src/var/lib/tyto/program/post.py index 138628b..f75cbc6 100644 --- a/src/var/lib/tyto/program/post.py +++ b/src/var/lib/tyto/program/post.py @@ -227,7 +227,7 @@ stats_total_files = 0 stats_text_links = 0 stats_text_files = 0 stats_text_images = 0 - +stats_text_abbrs = 0 #=============================# diff --git a/src/var/lib/tyto/translations/__pycache__/logs_fr.cpython-311.pyc b/src/var/lib/tyto/translations/__pycache__/logs_fr.cpython-311.pyc index 1b0001d..380c9a1 100644 Binary files a/src/var/lib/tyto/translations/__pycache__/logs_fr.cpython-311.pyc and b/src/var/lib/tyto/translations/__pycache__/logs_fr.cpython-311.pyc differ diff --git a/src/var/lib/tyto/translations/logs_fr.py b/src/var/lib/tyto/translations/logs_fr.py index ad48ed9..ea11c38 100644 --- a/src/var/lib/tyto/translations/logs_fr.py +++ b/src/var/lib/tyto/translations/logs_fr.py @@ -65,6 +65,7 @@ err_post_data = "Donnée manquante" err_post_title = "Titre invalide" err_post_paired = "Marqueurs non apairés" err_post_in_tag = "Marqueurs sans contenu" +err_post_datatag= "Donnée réservée" err_post_indent = "Ligne non indentée" # Warnings