diff --git a/CHANGELOG.md b/CHANGELOG.md index e75998a..3648880 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,12 @@ Tyto - Littérateur # CURRENTLY IN DEV (in devel branch) ! +## [1.9.37] +- Preparing full HTML Page +- Some fixes +- Added web target (without index.html) in section "FILE" in post DB +- Added article footer contents + ## [1.9.36] - fix translations modules - added metas module diff --git a/debian/control b/debian/control index afce295..8759485 100644 --- a/debian/control +++ b/debian/control @@ -1,5 +1,5 @@ Package: tyto -Version: 1.9.36 +Version: 1.9.37 Section: custom Priority: optional Architecture: all diff --git a/src/usr/bin/tyto b/src/usr/bin/tyto index 3bdd6c8..53ba68a 100755 --- a/src/usr/bin/tyto +++ b/src/usr/bin/tyto @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# Version: 1.9.36 +# Version: 1.9.37 # Updated: 2023-11-11 1699742831 # Tyto - Littérateur 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 73017bf..c0188e5 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__/post.cpython-311.pyc b/src/var/lib/tyto/program/__pycache__/post.cpython-311.pyc index 60ace83..be2fc03 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/__pycache__/wip.cpython-311.pyc b/src/var/lib/tyto/program/__pycache__/wip.cpython-311.pyc index 7258e87..b29415b 100644 Binary files a/src/var/lib/tyto/program/__pycache__/wip.cpython-311.pyc and b/src/var/lib/tyto/program/__pycache__/wip.cpython-311.pyc differ diff --git a/src/var/lib/tyto/program/check.py b/src/var/lib/tyto/program/check.py index d276a4b..285d5a2 100644 --- a/src/var/lib/tyto/program/check.py +++ b/src/var/lib/tyto/program/check.py @@ -1114,25 +1114,31 @@ def cf_update_values(part): post.cf_set("CHECK", "static", str(domain.static)) post.cf_set("CHECK", "hash", post.wrk_id) - # [FILE] + # [FILE] + web_target = post.wrk_target[:-4] + "html" + if web_target.endswith("index.html"): + web_target = web_target[:-10] + if not web_target.startswith("/"): + web_target = "/" + web_target 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("FILE", "web", web_target) # [WIP] # ----- post.cf_set("WIP", "hash", post.wip_hash) post.cf_set("WIP", "date", post.wip_date) - 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", "web", "%s%s"%(domain.wip_url, post.web_target)) + post.cf_set("WIP", "uri", "%s%s"%(domain.wip, post.web_target)) # [WWW] # ----- post.cf_set("WWW", "hash", post.www_hash) post.cf_set("WWW", "date", post.www_date) - 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", "web", "%s%s"%(domain.www_url, post.web_target)) + post.cf_set("WWW", "uri", "%s%s"%(domain.www, post.web_target)) # Stats (these, cause i want them first) post.cf_set("STATS_FILE", "lines", str(post.lines)) diff --git a/src/var/lib/tyto/program/post.py b/src/var/lib/tyto/program/post.py index 88ad2b1..8b9e3ff 100644 --- a/src/var/lib/tyto/program/post.py +++ b/src/var/lib/tyto/program/post.py @@ -71,7 +71,7 @@ def is_article(target): if not is_tyto_format(): return False - global uri_id, wrk_id, cf_uri, wrk_target + global uri_id, wrk_id, cf_uri, wrk_target, web_target # Set post ID from... uri_id = tools.get_filesum(uri, False) # ...URI wrk_id = tools.get_filesum(uri, True) # ...CONTENTS @@ -82,6 +82,9 @@ def is_article(target): # Set target from articles/ wrk_target = uri.rsplit(domain.wrk_articles)[1] + # Set web target, replace last .tyto with .html + web_target= wrk_target[:-4] + "html" + # Load Database, get and compare values cf_load() cf_datas() @@ -130,10 +133,10 @@ def is_tyto_format(): if not text_contents: error = debug.out(23, "?", uri, True, 2, False) return False - - lines = len(contents.splitlines()) + head_lines = len(head_contents.splitlines()) + 1 # Count with sep line text_lines = len(text_contents.splitlines()) + lines = head_lines + text_lines return True @@ -245,6 +248,13 @@ def cf_datas(): www_uri = cf_get("WWW", "uri", False) www_static = cf_get("WWW", "static", True) + global set_title, set_about, set_date, set_author + set_title = cf.get("HEADERS", "title") + set_about = cf.get("HEADERS", "about") + set_date = cf.get("HEADERS", "date") + set_tags = cf.get("HEADERS", "tags") + set_author = cf.get("HEADERS", "authors") + #===============================# # Do some datas comparisons # @@ -372,7 +382,7 @@ nositemap = "! NoSitemap" # Article will not be included in sitemap # One Line needed sep = "-----" # Splitter between header and article texts -# Will replace "Fals" with data value +# Will replace "False" with data value (check process) title = ("title:", False) about = ("about:", False) date = ("date:", False) diff --git a/src/var/lib/tyto/program/wip.py b/src/var/lib/tyto/program/wip.py index 4af9b96..1ffbec9 100644 --- a/src/var/lib/tyto/program/wip.py +++ b/src/var/lib/tyto/program/wip.py @@ -76,7 +76,9 @@ def multiple_targets(): #================================# -# Check article(S) # +# Check article(s) # +# - Convert tags # +# - Create full page # # Also used with multiple (loop) # #--------------------------------# def is_article(target): @@ -84,10 +86,39 @@ def is_article(target): if targets: return else: sys.exit(post.error) + # Create full page + page_html_create() + print("\n> wip:", target) print(html_post) +#=======================# +# Create full page HTML # +#-----------------------# +def page_html_create(): + page_html = \ + page_tpl%( + post.set_title, domain.title, + domain.lang, + nginx_mods%("metas"), + metas_post, + nginx_mods%("header"), + nginx_mods%("navbar"), + post.cf.get("WWW", "web"), + langs.site.permalink, langs.logs.pp, post.set_title, post.cf.get("WWW", "web"), + post.set_title, post.set_author, domain.title, + html_post, + footer_post, + nginx_mods%("sidebar"), + nginx_mods%("footer") + ) + + print() + print(page_html) + + + #===========================================# # Check full article contents (head + text) # # In error case, exit or return if targetS # @@ -146,6 +177,7 @@ def convert(target): value_replace("BCODES", False, True) value_replace("CODES", False, True) + footer_post_create() return True @@ -590,6 +622,29 @@ def convert_list(markdown_str, mark_b, mark_c): return work_str +#===========================================# +# Create contents in """ -page_tpl = """ - +nginx_mods = '' + +page_tpl = """ + %s +%s
@@ -1187,11 +1245,13 @@ page_tpl = """ %s - +
-

%s

+

+%s (%s) - %s +

%s
@@ -1199,8 +1259,13 @@ page_tpl = """
%s -
+
+ +%s + """ + +page_time = '