[1.9.20] - 'check', updated logo and added 'abbr:' processes
This commit is contained in:
parent
9393bdc01a
commit
afa2546abb
|
@ -9,6 +9,11 @@ Tyto - Littérateur
|
||||||
|
|
||||||
# CURRENTLY IN DEV !
|
# CURRENTLY IN DEV !
|
||||||
|
|
||||||
|
## [1.9.20]
|
||||||
|
- working on 'check' process
|
||||||
|
- - updated 'logo:' process
|
||||||
|
- - added 'abbr:' process
|
||||||
|
|
||||||
## [1.9.19]
|
## [1.9.19]
|
||||||
- working on 'check' process
|
- working on 'check' process
|
||||||
- - Added post 'logo: URI' (for social network share + opt show on page)
|
- - Added post 'logo: URI' (for social network share + opt show on page)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# Version: 1.9.19
|
# Version: 1.9.20
|
||||||
# Updated: 2023-10-05 1696512944
|
# Updated: 2023-10-06 1696580458
|
||||||
# Tyto - Littérateur
|
# Tyto - Littérateur
|
||||||
|
|
||||||
# Copyright (C) 2023 Cyrille Louarn <echolib+tyto@a-lec.org>
|
# Copyright (C) 2023 Cyrille Louarn <echolib+tyto@a-lec.org>
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -254,9 +254,11 @@ def is_valid_date(date):
|
||||||
# Written using 3 lines #
|
# Written using 3 lines #
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
def ml_tags():
|
def ml_tags():
|
||||||
|
global value1
|
||||||
|
|
||||||
|
value1 = ""
|
||||||
R_tag = post.ml_tags[3] # raw:
|
R_tag = post.ml_tags[3] # raw:
|
||||||
C_tag = post.ml_tags[4] # code:
|
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
|
c = 0 # Continue for next x lines, as tags are 3 lines values
|
||||||
for ln, line in enumerate(headers):
|
for ln, line in enumerate(headers):
|
||||||
|
@ -265,7 +267,8 @@ def ml_tags():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not line or line.isspace() or line.startswith("#"): continue
|
if not line or line.isspace() or line.startswith("#"): continue
|
||||||
|
|
||||||
|
# link:
|
||||||
if line.startswith(post.ml_tags[0]):
|
if line.startswith(post.ml_tags[0]):
|
||||||
post.stats_links += 1
|
post.stats_links += 1
|
||||||
if not ml_tag_values(ln, post.ml_tags[0], post.stats_links):
|
if not ml_tag_values(ln, post.ml_tags[0], post.stats_links):
|
||||||
|
@ -273,19 +276,39 @@ def ml_tags():
|
||||||
|
|
||||||
c = 2 ; continue
|
c = 2 ; continue
|
||||||
|
|
||||||
|
# file:
|
||||||
elif line.startswith(post.ml_tags[2]):
|
elif line.startswith(post.ml_tags[2]):
|
||||||
post.stats_files += 1
|
post.stats_files += 1
|
||||||
if not ml_tag_values(ln, post.ml_tags[2], post.stats_files):
|
if not ml_tag_values(ln, post.ml_tags[2], post.stats_files):
|
||||||
return False # value errors
|
return False # value errors
|
||||||
|
|
||||||
c = 2 ; continue
|
c = 2 ; continue
|
||||||
|
|
||||||
|
# image:
|
||||||
elif line.startswith(post.ml_tags[1]):
|
elif line.startswith(post.ml_tags[1]):
|
||||||
post.stats_images += 1
|
post.stats_images += 1
|
||||||
if not ml_tag_values(ln, post.ml_tags[1], post.stats_images):
|
if not ml_tag_values(ln, post.ml_tags[1], post.stats_images):
|
||||||
return False # value errors
|
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
|
return True
|
||||||
|
|
||||||
|
@ -298,7 +321,7 @@ def ml_tags():
|
||||||
# Return True/False (if no value) #
|
# Return True/False (if no value) #
|
||||||
#----------------------------------------#
|
#----------------------------------------#
|
||||||
def ml_tag_values(ln, tag, stats):
|
def ml_tag_values(ln, tag, stats):
|
||||||
global value2
|
global value1, value2
|
||||||
|
|
||||||
# Get 3 lines values
|
# Get 3 lines values
|
||||||
value1 = headers[ln].rsplit(":")[1].lstrip()
|
value1 = headers[ln].rsplit(":")[1].lstrip()
|
||||||
|
@ -359,7 +382,14 @@ def ml_tag_values(ln, tag, stats):
|
||||||
html_value = '<a href="%s" class="%s" target="%s" alt="%s">%s</a>'%(
|
html_value = '<a href="%s" class="%s" target="%s" alt="%s">%s</a>'%(
|
||||||
value2, "%%s", "%%s", value3, "%%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 = '<abbr class="%s" title="%s">%s</abbr>'%(
|
||||||
|
domain.css, value2, value3
|
||||||
|
)
|
||||||
|
|
||||||
post.cf.set(section, link_var, tyto_value)
|
post.cf.set(section, link_var, tyto_value)
|
||||||
post.cf.set(section, html_var, html_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):
|
def is_value2_file_exists(ln, tag, val2):
|
||||||
global value2, src_uri
|
global value2, src_uri
|
||||||
|
|
||||||
print("check: val2", tag, val2)
|
|
||||||
|
|
||||||
# uri "@..." means generic folders
|
# uri "@..." means generic folders
|
||||||
if val2[0].startswith("@"):
|
if val2[0].startswith("@"):
|
||||||
if val2[1] == "/": val2 = val2[2:]
|
if val2[1] == "/": val2 = val2[2:]
|
||||||
|
@ -549,14 +577,15 @@ def titles():
|
||||||
elif line.lstrip().startswith(post.text_comments):
|
elif line.lstrip().startswith(post.text_comments):
|
||||||
post.stats_html_coms += 1
|
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"):
|
elif line.lstrip().startswith("_image:logo"):
|
||||||
post.stats_text_images += 1
|
post.stats_text_images += 1
|
||||||
link_var = "image_%s"%(post.stats_images+1)
|
link_var = "image_%s"%(post.stats_images+1)
|
||||||
link_val = "_image:logo"
|
link_val = "_image:logo"
|
||||||
html_var = "html_%s"%(post.stats_images+1)
|
html_var = "html_%s"%(post.stats_images+1)
|
||||||
html_val = '<a href="%s" class="%s" target="%s" alt="%s">%s</a>'%(
|
html_val = '<a href="%s" class="%s" target="%s" alt="%s">%s</a>'%(
|
||||||
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", link_var, link_val)
|
||||||
post.cf.set("IMAGES", html_var, html_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("DOMAIN", "name", domain.name)
|
||||||
|
|
||||||
post.cf.set("FILE", "id", post.uri_id)
|
post.cf.set("FILE", "id", post.uri_id)
|
||||||
post.cf.set("FILE", "uri", post.uri)
|
post.cf.set("FILE", "uri", post.uri)
|
||||||
post.cf.set("FILE", "db", post.cf_uri)
|
post.cf.set("FILE", "db", post.cf_uri)
|
||||||
post.cf.set("FILE", "target", post.wrk_target)
|
post.cf.set("FILE", "target", post.wrk_target)
|
||||||
|
|
||||||
post.cf.set("HEADERS", "title", post.title[1])
|
post.cf.set("HEADERS", "title", post.title[1])
|
||||||
post.cf.set("HEADERS", "about", post.about[1])
|
post.cf.set("HEADERS", "about", post.about[1])
|
||||||
post.cf.set("HEADERS", "date", post.date[1])
|
post.cf.set("HEADERS", "date", post.date[1])
|
||||||
post.cf.set("HEADERS", "tags", post.tags[1])
|
post.cf.set("HEADERS", "tags", post.tags[1])
|
||||||
post.cf.set("HEADERS", "authors", post.author[1])
|
post.cf.set("HEADERS", "authors", post.author[1])
|
||||||
post.cf.set("HEADERS", "sitemap", str(sitemap))
|
post.cf.set("HEADERS", "sitemap", str(sitemap))
|
||||||
|
|
||||||
post.cf.set("CHECK", "hash", post.wrk_id)
|
post.cf.set("CHECK", "hash", post.wrk_id)
|
||||||
post.cf.set("CHECK", "date", chk_date)
|
post.cf.set("CHECK", "date", chk_date)
|
||||||
post.cf.set("CHECK", "static", str(domain.static))
|
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", "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", "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
|
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", "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", "tyto_coms", str(post.stats_tyto_head_coms))
|
||||||
post.cf.set("STATS_HEADERS", "links", str(post.stats_links))
|
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", "files", str(post.stats_files))
|
||||||
post.cf.set("STATS_HEADERS", "images", str(post.stats_images))
|
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", "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", "html_coms", str(post.stats_html_coms))
|
||||||
post.cf.set("STATS_TEXTS", "titles", str(post.stats_titles))
|
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", "links", str(post.stats_text_links))
|
||||||
post.cf.set("STATS_TEXTS", "files", str(post.stats_text_files))
|
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", "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:
|
with open(post.cf_uri, "w") as f:
|
||||||
post.cf.write(f)
|
post.cf.write(f)
|
||||||
|
|
|
@ -94,6 +94,7 @@ def out(nbr, var, val, show, color, stop):
|
||||||
53 : langs.logs.err_post_paired,
|
53 : langs.logs.err_post_paired,
|
||||||
54 : langs.logs.err_post_indent,
|
54 : langs.logs.err_post_indent,
|
||||||
55 : langs.logs.err_post_in_tag,
|
55 : langs.logs.err_post_in_tag,
|
||||||
|
56 : langs.logs.err_post_datatag,
|
||||||
# WARNINGS (100-200)
|
# WARNINGS (100-200)
|
||||||
100 : langs.logs.warn_no_dom,
|
100 : langs.logs.warn_no_dom,
|
||||||
101 : langs.logs.domain_created,
|
101 : langs.logs.domain_created,
|
||||||
|
|
|
@ -227,7 +227,7 @@ stats_total_files = 0
|
||||||
stats_text_links = 0
|
stats_text_links = 0
|
||||||
stats_text_files = 0
|
stats_text_files = 0
|
||||||
stats_text_images = 0
|
stats_text_images = 0
|
||||||
|
stats_text_abbrs = 0
|
||||||
|
|
||||||
|
|
||||||
#=============================#
|
#=============================#
|
||||||
|
|
Binary file not shown.
|
@ -65,6 +65,7 @@ err_post_data = "Donnée manquante"
|
||||||
err_post_title = "Titre invalide"
|
err_post_title = "Titre invalide"
|
||||||
err_post_paired = "Marqueurs non apairés"
|
err_post_paired = "Marqueurs non apairés"
|
||||||
err_post_in_tag = "Marqueurs sans contenu"
|
err_post_in_tag = "Marqueurs sans contenu"
|
||||||
|
err_post_datatag= "Donnée réservée"
|
||||||
err_post_indent = "Ligne non indentée"
|
err_post_indent = "Ligne non indentée"
|
||||||
|
|
||||||
# Warnings
|
# Warnings
|
||||||
|
|
Loading…
Reference in New Issue