[1.10.0] 5000! 'manage footer_about.html'
This commit is contained in:
parent
bceb629467
commit
83e8f5eab3
|
@ -8,9 +8,12 @@ Tyto - Littérateur
|
||||||
|
|
||||||
# CURRENTLY IN DEV (in devel branch) !
|
# CURRENTLY IN DEV (in devel branch) !
|
||||||
|
|
||||||
|
## [1.10.0]
|
||||||
|
- added management of optional footer_about.html file created by user (see [help modules])
|
||||||
|
|
||||||
## [1.9.58]
|
## [1.9.58]
|
||||||
- added [wip --static] to create static/ website server ('hidden' tool)
|
- added [wip --static] to create static/ website server ('hidden' tool)
|
||||||
- - replace nginx comments modules call with contents modules in articles
|
- - replace nginx comments modules calls with contents modules in articles
|
||||||
|
|
||||||
## [1.9.57]
|
## [1.9.57]
|
||||||
- new "css" target.
|
- new "css" target.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
Package: tyto
|
Package: tyto
|
||||||
Version: 1.9.58
|
Version: 1.10.0
|
||||||
Section: custom
|
Section: custom
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Architecture: all
|
Architecture: all
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# version: 1.9.58
|
# version: 1.10.0
|
||||||
|
# date: 2024/01/04 17:18:36
|
||||||
# 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>
|
||||||
|
@ -35,9 +36,9 @@ def check_install():
|
||||||
# Settings
|
# Settings
|
||||||
error = False
|
error = False
|
||||||
lib_tyto = "/var/lib/tyto/%s"
|
lib_tyto = "/var/lib/tyto/%s"
|
||||||
|
|
||||||
log_m = "! Tyto installation. Unused"
|
log_m = "! Tyto installation. Unused"
|
||||||
|
|
||||||
# Files trees
|
# Files trees
|
||||||
files = {
|
files = {
|
||||||
"program" : (
|
"program" : (
|
||||||
|
@ -66,7 +67,7 @@ def check_install():
|
||||||
"site_en",
|
"site_en",
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
for d in files:
|
for d in files:
|
||||||
tyto_dir = lib_tyto%d
|
tyto_dir = lib_tyto%d
|
||||||
if not os.path.exists(tyto_dir):
|
if not os.path.exists(tyto_dir):
|
||||||
|
@ -96,7 +97,6 @@ if not __name__ == "__main__":
|
||||||
# Check installed files
|
# Check installed files
|
||||||
check_install()
|
check_install()
|
||||||
|
|
||||||
|
|
||||||
# Load some Tyto libs
|
# Load some Tyto libs
|
||||||
import langs, debug, args, domain
|
import langs, debug, args, domain
|
||||||
|
|
||||||
|
@ -134,16 +134,15 @@ import check, help, new, wip, publish, show
|
||||||
|
|
||||||
# From command line [ACTION], do
|
# From command line [ACTION], do
|
||||||
do = {
|
do = {
|
||||||
"check" : check.manage,
|
"check" : check.manage,
|
||||||
"help" : help.manage,
|
"help" : help.manage,
|
||||||
"new" : new.manage,
|
"new" : new.manage,
|
||||||
"publish" : publish.manage,
|
"publish" : publish.manage,
|
||||||
"wip" : wip.manage,
|
"wip" : wip.manage,
|
||||||
"show" : show.manage,
|
"show" : show.manage,
|
||||||
"start" : domain.manage,
|
"start" : domain.manage,
|
||||||
"stop" : domain.manage,
|
"stop" : domain.manage,
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
# Test for errors in python module file (without try)
|
# Test for errors in python module file (without try)
|
||||||
#do[args.action]()
|
#do[args.action]()
|
||||||
|
|
|
@ -75,6 +75,7 @@ def manage(module):
|
||||||
"wip" : wip_dir + "footer.html",
|
"wip" : wip_dir + "footer.html",
|
||||||
"www" : www_dir + "footer.html",
|
"www" : www_dir + "footer.html",
|
||||||
"set" : set_footer_raw,
|
"set" : set_footer_raw,
|
||||||
|
"usr" : wrk_dir + "footer_about.html",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,24 +85,29 @@ def manage(module):
|
||||||
cf_mod_load()
|
cf_mod_load()
|
||||||
mod_write = False
|
mod_write = False
|
||||||
|
|
||||||
|
# Specific for footer_about.html
|
||||||
|
# ------------------------------
|
||||||
|
try: fid = cf_mod.get("RAWS", "footer_usr")
|
||||||
|
except: fid = ""
|
||||||
|
fcid = ""
|
||||||
|
if os.path.exists(files["footer"]["usr"]):
|
||||||
|
fcid = tools.get_HID(files["footer"]["usr"], True)
|
||||||
|
if fcid != fid:
|
||||||
|
os.remove(files["footer"]["wrk"])
|
||||||
|
cf_mod_set("RAWS", "footer_usr", fcid)
|
||||||
|
mod_write = True
|
||||||
|
|
||||||
# Force create new raw module if new + [MODULE] is set from command line
|
# Force create new raw module if new + [MODULE] is set from command line
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
new_mod_raw = False
|
|
||||||
if args.action == "new" and \
|
if args.action == "new" and \
|
||||||
module in files and \
|
module in files and \
|
||||||
os.path.exists(files[module]["wrk"]):
|
os.path.exists(files[module]["wrk"]):
|
||||||
raw_cid = tools.get_HID(files[module]["wrk"], True)
|
os.remove(files[module]["wrk"])
|
||||||
try: db_id = cf_mod.get("RAWS", module)
|
|
||||||
except: db_id = ""
|
|
||||||
if raw_cid != db_id:
|
|
||||||
new_mod_raw = True
|
|
||||||
|
|
||||||
|
|
||||||
# Always check if raw modules exist or create them
|
# Always check if raw modules exist or create them
|
||||||
# ------------------------------------------------
|
# ------------------------------------------------
|
||||||
for mod in files:
|
for mod in files:
|
||||||
if not os.path.exists(files[mod]["wrk"]) or new_mod_raw:
|
if not os.path.exists(files[mod]["wrk"]):
|
||||||
files[mod]["set"](mod)
|
files[mod]["set"](mod)
|
||||||
mod_write = True
|
mod_write = True
|
||||||
tools.create_file(files[mod]["wrk"], files[mod]["usr"])
|
tools.create_file(files[mod]["wrk"], files[mod]["usr"])
|
||||||
|
@ -116,8 +122,7 @@ def manage(module):
|
||||||
cf_mod_write()
|
cf_mod_write()
|
||||||
cf_mod_load()
|
cf_mod_load()
|
||||||
mod_write = False
|
mod_write = False
|
||||||
|
|
||||||
|
|
||||||
# From wip process, after article convertion
|
# From wip process, after article convertion
|
||||||
# Create HTML modules in wip§ server
|
# Create HTML modules in wip§ server
|
||||||
# - if not exist or raw file has changed
|
# - if not exist or raw file has changed
|
||||||
|
@ -143,7 +148,6 @@ def manage(module):
|
||||||
mod_write = False
|
mod_write = False
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
# When user wants to create again HTML module in wip/ server
|
# When user wants to create again HTML module in wip/ server
|
||||||
# ----------------------------------------------------------
|
# ----------------------------------------------------------
|
||||||
if args.action == "wip":
|
if args.action == "wip":
|
||||||
|
@ -235,6 +239,7 @@ def set_header_raw(mod):
|
||||||
files[mod]["www"],
|
files[mod]["www"],
|
||||||
) + header_raw
|
) + header_raw
|
||||||
|
|
||||||
|
|
||||||
#===============================#
|
#===============================#
|
||||||
# Set navbar.raw with help only #
|
# Set navbar.raw with help only #
|
||||||
#-------------------------------#
|
#-------------------------------#
|
||||||
|
@ -317,6 +322,13 @@ def set_footer_raw(mod):
|
||||||
'%s'%langs.site.source_code + \
|
'%s'%langs.site.source_code + \
|
||||||
'</a>]'
|
'</a>]'
|
||||||
|
|
||||||
|
# If footer_about.html exists, insert its contents replacing site about
|
||||||
|
domain.conf["about"] = '<p id="footer_about_p">%s</p>'%domain.conf["about"]
|
||||||
|
footer_about_file = wrk_dir + "footer_about.html"
|
||||||
|
if os.path.exists(footer_about_file):
|
||||||
|
with open(footer_about_file, "r") as fa:
|
||||||
|
domain.conf["about"] = fa.read()
|
||||||
|
|
||||||
# Create full footer_raw contents
|
# Create full footer_raw contents
|
||||||
footer_raw = footer_raw%(
|
footer_raw = footer_raw%(
|
||||||
# <h2>
|
# <h2>
|
||||||
|
@ -381,7 +393,6 @@ def create_navbar_html(html_file):
|
||||||
# Item has a "title" set with # as separator
|
# Item has a "title" set with # as separator
|
||||||
set_dir = line.rstrip()
|
set_dir = line.rstrip()
|
||||||
|
|
||||||
|
|
||||||
# Set_dir begins with "/" ; apply correction
|
# Set_dir begins with "/" ; apply correction
|
||||||
if set_dir.startswith("/"): set_dir = set_dir[1:]
|
if set_dir.startswith("/"): set_dir = set_dir[1:]
|
||||||
if set_dir.endswith("/"): set_dir = set_dir[:-1]
|
if set_dir.endswith("/"): set_dir = set_dir[:-1]
|
||||||
|
@ -609,7 +620,7 @@ footer_raw = """
|
||||||
<h2 id="footer_title">%s %s</h2>
|
<h2 id="footer_title">%s %s</h2>
|
||||||
<div id="footer_about_menu">
|
<div id="footer_about_menu">
|
||||||
<div id="footer_about">
|
<div id="footer_about">
|
||||||
<p id="footer_about_p">%s</p>
|
%s
|
||||||
</div>
|
</div>
|
||||||
<nav id="footer_menu" aria-labelledby="navigation-3">
|
<nav id="footer_menu" aria-labelledby="navigation-3">
|
||||||
<ul id="footer_items">
|
<ul id="footer_items">
|
||||||
|
|
|
@ -312,6 +312,12 @@ help_modules = """
|
||||||
- [wip [MODULE]]
|
- [wip [MODULE]]
|
||||||
Create (again) this [MODULE]
|
Create (again) this [MODULE]
|
||||||
|
|
||||||
|
# Note. "footer_about.html"
|
||||||
|
footer_about.html file in domain "modules/" directory is optional. If
|
||||||
|
created, site description in footer will be replaced with its contents.
|
||||||
|
If this file is updated, footer.html in "wip/" server will be generated
|
||||||
|
again automatically.
|
||||||
|
|
||||||
! For these modules to be shown in website, you must add in the nginx
|
! For these modules to be shown in website, you must add in the nginx
|
||||||
configuration file (/etc/nginx/sites-available/DOMAIN.TLD):
|
configuration file (/etc/nginx/sites-available/DOMAIN.TLD):
|
||||||
|
|
||||||
|
|
|
@ -319,6 +319,12 @@ help_modules = """
|
||||||
- [wip [MODULE]]
|
- [wip [MODULE]]
|
||||||
(re)générer uniquement le [MODULE] concerné
|
(re)générer uniquement le [MODULE] concerné
|
||||||
|
|
||||||
|
# Note. "footer_about.html"
|
||||||
|
Le fichier footer_about.html dans le dossier "modules/" du domaine est
|
||||||
|
optionnel. Si, il est créé, la description du site dans le pied de page
|
||||||
|
sera remplacée par son contenu. Si ce fichier est modifié, le pied de page
|
||||||
|
(footer.html) dans le serveur "wip/" sera généré à nouveau automatiquement.
|
||||||
|
|
||||||
! Pour que ces modules puissent être affichés dans les pages du site, il
|
! Pour que ces modules puissent être affichés dans les pages du site, il
|
||||||
faut ajouter dans le fichier de configuration du serveur nginx
|
faut ajouter dans le fichier de configuration du serveur nginx
|
||||||
(/etc/nginx/sites-available/DOMAINE.TLD) :
|
(/etc/nginx/sites-available/DOMAINE.TLD) :
|
||||||
|
|
Loading…
Reference in New Issue