[1.9.37]
This commit is contained in:
parent
d1bed4c17b
commit
b622ff8b24
|
@ -10,6 +10,12 @@ Tyto - Littérateur
|
||||||
|
|
||||||
# CURRENTLY IN DEV (in devel branch) !
|
# 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]
|
## [1.9.36]
|
||||||
- fix translations modules
|
- fix translations modules
|
||||||
- added metas module
|
- added metas module
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
Package: tyto
|
Package: tyto
|
||||||
Version: 1.9.36
|
Version: 1.9.37
|
||||||
Section: custom
|
Section: custom
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Architecture: all
|
Architecture: all
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# Version: 1.9.36
|
# Version: 1.9.37
|
||||||
# Updated: 2023-11-11 1699742831
|
# Updated: 2023-11-11 1699742831
|
||||||
# Tyto - Littérateur
|
# Tyto - Littérateur
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1115,24 +1115,30 @@ def cf_update_values(part):
|
||||||
post.cf_set("CHECK", "hash", post.wrk_id)
|
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", "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("FILE", "web", web_target)
|
||||||
|
|
||||||
# [WIP]
|
# [WIP]
|
||||||
# -----
|
# -----
|
||||||
post.cf_set("WIP", "hash", post.wip_hash)
|
post.cf_set("WIP", "hash", post.wip_hash)
|
||||||
post.cf_set("WIP", "date", post.wip_date)
|
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", "web", "%s%s"%(domain.wip_url, post.web_target))
|
||||||
post.cf_set("WIP", "uri", "%s%s"%(domain.wip, post.wrk_target))
|
post.cf_set("WIP", "uri", "%s%s"%(domain.wip, post.web_target))
|
||||||
|
|
||||||
# [WWW]
|
# [WWW]
|
||||||
# -----
|
# -----
|
||||||
post.cf_set("WWW", "hash", post.www_hash)
|
post.cf_set("WWW", "hash", post.www_hash)
|
||||||
post.cf_set("WWW", "date", post.www_date)
|
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", "web", "%s%s"%(domain.www_url, post.web_target))
|
||||||
post.cf_set("WWW", "uri", "%s%s"%(domain.www, post.wrk_target))
|
post.cf_set("WWW", "uri", "%s%s"%(domain.www, post.web_target))
|
||||||
|
|
||||||
# Stats (these, cause i want them first)
|
# Stats (these, cause i want them first)
|
||||||
post.cf_set("STATS_FILE", "lines", str(post.lines))
|
post.cf_set("STATS_FILE", "lines", str(post.lines))
|
||||||
|
|
|
@ -71,7 +71,7 @@ def is_article(target):
|
||||||
if not is_tyto_format():
|
if not is_tyto_format():
|
||||||
return False
|
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...
|
# Set post ID from...
|
||||||
uri_id = tools.get_filesum(uri, False) # ...URI
|
uri_id = tools.get_filesum(uri, False) # ...URI
|
||||||
wrk_id = tools.get_filesum(uri, True) # ...CONTENTS
|
wrk_id = tools.get_filesum(uri, True) # ...CONTENTS
|
||||||
|
@ -82,6 +82,9 @@ def is_article(target):
|
||||||
# Set target from articles/
|
# Set target from articles/
|
||||||
wrk_target = uri.rsplit(domain.wrk_articles)[1]
|
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
|
# Load Database, get and compare values
|
||||||
cf_load()
|
cf_load()
|
||||||
cf_datas()
|
cf_datas()
|
||||||
|
@ -131,9 +134,9 @@ def is_tyto_format():
|
||||||
error = debug.out(23, "?", uri, True, 2, False)
|
error = debug.out(23, "?", uri, True, 2, False)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
lines = len(contents.splitlines())
|
|
||||||
head_lines = len(head_contents.splitlines()) + 1 # Count with sep line
|
head_lines = len(head_contents.splitlines()) + 1 # Count with sep line
|
||||||
text_lines = len(text_contents.splitlines())
|
text_lines = len(text_contents.splitlines())
|
||||||
|
lines = head_lines + text_lines
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -245,6 +248,13 @@ def cf_datas():
|
||||||
www_uri = cf_get("WWW", "uri", False)
|
www_uri = cf_get("WWW", "uri", False)
|
||||||
www_static = cf_get("WWW", "static", True)
|
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 #
|
# Do some datas comparisons #
|
||||||
|
@ -372,7 +382,7 @@ nositemap = "! NoSitemap" # Article will not be included in sitemap
|
||||||
# One Line needed
|
# One Line needed
|
||||||
sep = "-----" # Splitter between header and article texts
|
sep = "-----" # Splitter between header and article texts
|
||||||
|
|
||||||
# Will replace "Fals" with data value
|
# Will replace "False" with data value (check process)
|
||||||
title = ("title:", False)
|
title = ("title:", False)
|
||||||
about = ("about:", False)
|
about = ("about:", False)
|
||||||
date = ("date:", False)
|
date = ("date:", False)
|
||||||
|
|
|
@ -76,7 +76,9 @@ def multiple_targets():
|
||||||
|
|
||||||
|
|
||||||
#================================#
|
#================================#
|
||||||
# Check article(S) #
|
# Check article(s) #
|
||||||
|
# - Convert tags #
|
||||||
|
# - Create full page #
|
||||||
# Also used with multiple (loop) #
|
# Also used with multiple (loop) #
|
||||||
#--------------------------------#
|
#--------------------------------#
|
||||||
def is_article(target):
|
def is_article(target):
|
||||||
|
@ -84,10 +86,39 @@ def is_article(target):
|
||||||
if targets: return
|
if targets: return
|
||||||
else: sys.exit(post.error)
|
else: sys.exit(post.error)
|
||||||
|
|
||||||
|
# Create full page
|
||||||
|
page_html_create()
|
||||||
|
|
||||||
print("\n> wip:", target)
|
print("\n> wip:", target)
|
||||||
print(html_post)
|
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) #
|
# Check full article contents (head + text) #
|
||||||
# In error case, exit or return if targetS #
|
# In error case, exit or return if targetS #
|
||||||
|
@ -146,6 +177,7 @@ def convert(target):
|
||||||
value_replace("BCODES", False, True)
|
value_replace("BCODES", False, True)
|
||||||
value_replace("CODES", False, True)
|
value_replace("CODES", False, True)
|
||||||
|
|
||||||
|
footer_post_create()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -590,6 +622,29 @@ def convert_list(markdown_str, mark_b, mark_c):
|
||||||
return work_str
|
return work_str
|
||||||
|
|
||||||
|
|
||||||
|
#===========================================#
|
||||||
|
# Create contents in <footer> for <article> #
|
||||||
|
#-------------------------------------------#
|
||||||
|
def footer_post_create():
|
||||||
|
global footer_post
|
||||||
|
|
||||||
|
link_post_code = ""
|
||||||
|
if domain.article_code:
|
||||||
|
link_post_code = \
|
||||||
|
' <a id="post_code" title="%s%s %s - %s" href="/%s">[%s]</a>'%(
|
||||||
|
langs.site.source_code, langs.logs.pp, post.set_title, domain.title,
|
||||||
|
post.cf.get("FILE", "target"),
|
||||||
|
langs.site.source_code
|
||||||
|
)
|
||||||
|
|
||||||
|
footer_post = \
|
||||||
|
page_time%tools.nowdate() + '\n' + \
|
||||||
|
'<p id="post_metas">%s, %s%s</p>\n'%(
|
||||||
|
post.set_date, post.set_author, link_post_code
|
||||||
|
) + \
|
||||||
|
'</time>'
|
||||||
|
|
||||||
|
|
||||||
#=========#
|
#=========#
|
||||||
# Modules #====================================================================
|
# Modules #====================================================================
|
||||||
#---------#
|
#---------#
|
||||||
|
@ -1174,11 +1229,14 @@ module_footer = """<!-- Website footer-->
|
||||||
</footer>
|
</footer>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
page_tpl = """<!-- %s -->
|
nginx_mods = '<!--# include virtual="/template/%s.html"-->'
|
||||||
<!Doctype html>
|
|
||||||
|
page_tpl = """<!-- %s - %s -->
|
||||||
|
<!DocType html>
|
||||||
<html lang="%s">
|
<html lang="%s">
|
||||||
<head>
|
<head>
|
||||||
%s
|
%s
|
||||||
|
%s
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="site_container">
|
<div id="site_container">
|
||||||
|
@ -1187,11 +1245,13 @@ page_tpl = """<!-- %s -->
|
||||||
|
|
||||||
%s
|
%s
|
||||||
|
|
||||||
<!-- div contains <article> and <aside> -->
|
<!-- main contains <article> and <aside> -->
|
||||||
<main id="site_article_aside">
|
<main id="site_article_aside">
|
||||||
<article id="site_article">
|
<article id="site_article">
|
||||||
<header id="site_article_header">
|
<header id="site_article_header">
|
||||||
<h1 id="site_article_title">%s</h1>
|
<h1 id="site_article_title">
|
||||||
|
<a id="main_title" href="%s" title="%s%s %s - [%s]">%s (%s) - %s</a>
|
||||||
|
</h1>
|
||||||
</header>
|
</header>
|
||||||
%s
|
%s
|
||||||
<footer id="site_article_footer">
|
<footer id="site_article_footer">
|
||||||
|
@ -1199,8 +1259,13 @@ page_tpl = """<!-- %s -->
|
||||||
</footer>
|
</footer>
|
||||||
</article>
|
</article>
|
||||||
%s
|
%s
|
||||||
</main> <!-- site_article_aside -->
|
</main>
|
||||||
|
|
||||||
</div> <!-- #site_container -->
|
</div> <!-- #site_container -->
|
||||||
|
|
||||||
|
%s
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>"""
|
</html>"""
|
||||||
|
|
||||||
|
page_time = '<!-- pagetime --><time datetime="%s">'
|
||||||
|
|
|
@ -37,7 +37,8 @@ a.site_menu_link {}
|
||||||
|
|
||||||
/* div contains <article> and <aside> */
|
/* div contains <article> and <aside> */
|
||||||
main#site_article_aside {}
|
main#site_article_aside {}
|
||||||
|
/* in main > <h1> < No id or class */
|
||||||
|
a#main_title {}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
* Article contents styles
|
* Article contents styles
|
||||||
|
@ -47,6 +48,10 @@ article#site_article {}
|
||||||
header#site_article_header {}
|
header#site_article_header {}
|
||||||
h1#site_article_title {}
|
h1#site_article_title {}
|
||||||
footer#site_article_footer {}
|
footer#site_article_footer {}
|
||||||
|
/* In <footer> for <article> */
|
||||||
|
p#post_metas {}
|
||||||
|
a#post_code {}
|
||||||
|
|
||||||
|
|
||||||
/* Generic for all links <a class="tyto" */
|
/* Generic for all links <a class="tyto" */
|
||||||
a.tyto {}
|
a.tyto {}
|
||||||
|
|
Binary file not shown.
|
@ -32,6 +32,8 @@
|
||||||
|
|
||||||
sidebar_title = "Featured posts"
|
sidebar_title = "Featured posts"
|
||||||
sitemap = "sitemap"
|
sitemap = "sitemap"
|
||||||
|
source_code = "Source code"
|
||||||
|
permalink = "Permalink"
|
||||||
|
|
||||||
license = "License"
|
license = "License"
|
||||||
license_title = "Website %s of"%license
|
license_title = "Website %s of"%license
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
|
|
||||||
sidebar_title = "Articles recommandés"
|
sidebar_title = "Articles recommandés"
|
||||||
sitemap = "Plan du site"
|
sitemap = "Plan du site"
|
||||||
|
source_code = "Code source"
|
||||||
|
permalink = "Permalien"
|
||||||
|
|
||||||
license = "Licence"
|
license = "Licence"
|
||||||
license_title = "%s du site web de"%license
|
license_title = "%s du site web de"%license
|
||||||
|
|
Loading…
Reference in New Issue