This commit is contained in:
Cyrille L 2023-12-31 18:03:39 +01:00
parent b6686a0ebd
commit 33a4c24e47
9 changed files with 97 additions and 71 deletions

View File

@ -10,6 +10,10 @@ Tyto - Littérateur
# CURRENTLY IN DEV (in devel branch) ! # CURRENTLY IN DEV (in devel branch) !
## [1.9.55]
- update (work in progress) tpl_files/styles.css default doc references
- New manage() code in modules.py
## [1.9.54] ## [1.9.54]
- update (work in progress) tpl_files/styles.css default doc references - update (work in progress) tpl_files/styles.css default doc references
- fix + updated "code:" and bcode "{{...}}" CSS classes output HTML - fix + updated "code:" and bcode "{{...}}" CSS classes output HTML

2
debian/control vendored
View File

@ -1,5 +1,5 @@
Package: tyto Package: tyto
Version: 1.9.54 Version: 1.9.55
Section: custom Section: custom
Priority: optional Priority: optional
Architecture: all Architecture: all

View File

@ -1,5 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# version: 1.9.54 # version: 1.9.55
# 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>

View File

@ -91,6 +91,7 @@ def get_arguments():
if commands["modules"]["modules"]: if commands["modules"]["modules"]:
for arg in commands["modules"]: for arg in commands["modules"]:
commands["modules"][arg] = True commands["modules"][arg] = True
commands["modules"]["modules"] = False
# Register options # Register options
for arg in commands["options"]: for arg in commands["options"]:

View File

@ -36,8 +36,8 @@ import args, domain, langs, tools, debug, form
# All are called from file with nginx in web page # # All are called from file with nginx in web page #
#-------------------------------------------------# #-------------------------------------------------#
def manage(module): def manage(module):
global files, wrk_dir, asked, mod_write, wip_dir global files, wrk_dir, wip_dir, www_dir, mod_write
# Set directories # Set directories
wrk_dir = domain.wrk_dirs["modules"] wrk_dir = domain.wrk_dirs["modules"]
wip_dir = domain.wip_dirs["template"] wip_dir = domain.wip_dirs["template"]
@ -78,66 +78,77 @@ def manage(module):
}, },
} }
# Load/Create new modules in DB file # Load/Create new modules in DB file
# ----------------------------------
cf_mod_load() cf_mod_load()
mod_write = False mod_write = False
# Check/Set raw files in modules/ # Force create new raw module if new + [MODULE] is set from command line
for mod in files: # ----------------------------------------------------------------------
# For all modules to reset, confirm once new_mod_raw = False
if os.path.exists(files[mod]["wrk"]): if args.action == "new" and \
if module == "all": module in files and \
try: asked os.path.exists(files[module]["wrk"]):
except: form.ask_reset_modules() ; asked = True raw_cid = tools.get_HID(files[module]["wrk"], True)
try: db_id = cf_mod.get("RAWS", module)
elif mod != module: except: db_id = ""
continue if raw_cid != db_id:
new_mod_raw = True
mod_write = True
files[mod]["set"](mod) # Always check if raw modules exist or create them
tools.create_file(files[mod]["wrk"], files[mod]["usr"]) # ------------------------------------------------
cid = tools.get_HID(files[mod]["wrk"], True) for mod in files:
cf_mod_set("RAWS", mod, cid) if not os.path.exists(files[mod]["wrk"]) or new_mod_raw:
files[mod]["set"](mod)
mod_write = True
tools.create_file(files[mod]["wrk"], files[mod]["usr"])
cid = tools.get_HID(files[mod]["wrk"], True)
cf_mod_set("RAWS", mod, cid)
os.path.exists(files[mod]["wip"]) and os.remove(files[mod]["wip"])
new_mod_raw = False
debug.out(250, mod, files[mod]["wrk"], True, 0, False)
# Reload DB if updated
if mod_write:
cf_mod_write()
cf_mod_load()
mod_write = False
cf_mod_write()
if args.action == "new":
debug.out(250, module, wrk_dir, True, 0, False)
# When an article is "wip" # From wip process, after article convertion
# - create html modules # Create HTML modules in wip§ server
# - - if not already exists # - if not exist or raw file has changed
# - - if raw module has changed # ------------------------------------------
if module == "wip": if module == "wip":
for mod in files: for mod in files:
if os.path.exists(files[mod]["wip"]): if not os.path.exists(files[mod]["wip"]):
raw_cid = tools.get_HID(files[mod]["wrk"], True) create_htmls(mod)
try: db_id = cf_mod.get("RAWS", mod) continue
except: db_id = ""
if raw_cid == db_id:
continue
else:
cf_mod_set("RAWS", mod, raw_cid)
mod_write = True
create_htmls(mod) raw_cid = tools.get_HID(files[mod]["wrk"], True)
try: db_id = cf_mod.get("RAWS", mod)
except: db_id = ""
if raw_cid != db_id:
cf_mod_set("RAWS", mod, raw_cid)
mod_write = True
create_htmls(mod)
cf_mod_write() # Reload DB if updated
if mod_write:
cf_mod_write()
cf_mod_load()
mod_write = False
return
# When user wants to create again HTML module in wip/ server
# ----------------------------------------------------------
if args.action == "wip":
create_htmls(module)
# When user wants to force update HTML modules
# using wip [MODULE] ; called in wip.py
elif module == "update":
# Create again ALL modules in wip/template
if args.commands["modules"]["modules"]:
for mod in files:
if os.path.exists(files[mod]["wip"]):
create_htmls(mod)
# Create again specific module from command line
else:
for mod in args.commands["modules"]:
if args.commands["modules"][mod]:
if os.path.exists(files[mod]["wip"]):
create_htmls(mod)
#=======================================# #=======================================#
# Manage modules configuration ini file #====================================== # Manage modules configuration ini file #======================================
@ -353,7 +364,7 @@ def create_htmls(mod):
html_file = "%s\n%s"%(html_file, line) html_file = "%s\n%s"%(html_file, line)
tools.create_file(files[mod]["wip"], html_file) tools.create_file(files[mod]["wip"], html_file)
debug.out(250, mod, wip_dir, True, 0, False) debug.out(250, mod, files[mod]["wip"], True, 0, False)
#==============================================# #==============================================#

View File

@ -25,6 +25,10 @@
import args, domain, form, modules, sitemap import args, domain, form, modules, sitemap
#========================================#
# Manage new domain and modules creation #
#----------------------------------------#
def manage(): def manage():
if args.commands["targets"]["domain"]: if args.commands["targets"]["domain"]:
domain.set_name() domain.set_name()
@ -37,14 +41,10 @@ def manage():
return return
domain.is_active() domain.is_active()
if args.commands["modules"]["modules"]:
modules.manage("all") # Some modules was set in arguments
return for mod in args.commands["modules"]:
if args.commands["modules"][mod]:
args.commands["modules"]["metas"] and modules.manage("metas") modules.manage(mod)
args.commands["modules"]["header"] and modules.manage("header")
args.commands["modules"]["navbar"] and modules.manage("navbar")
args.commands["modules"]["sidebar"] and modules.manage("sidebar")
args.commands["modules"]["footer"] and modules.manage("footer")
args.commands["targets"]["sitemap"] and sitemap.create() args.commands["targets"]["sitemap"] and sitemap.create()

View File

@ -36,11 +36,7 @@ def manage():
# "all" is not a valid argument here # "all" is not a valid argument here
if args.commands["targets"]["all"]: if args.commands["targets"]["all"]:
debug.out(2, "all ?", "", True, 2, True) debug.out(2, "all ?", "", True, 2, True)
# Avoid error where "modules" is for "all", not a real module
if args.commands["modules"]["modules"]:
args.commands["modules"]["modules"] = False
# User selected modules # User selected modules
for arg in args.commands["modules"]: for arg in args.commands["modules"]:
if args.commands["modules"][arg]: if args.commands["modules"][arg]:

View File

@ -43,10 +43,10 @@ def manage():
elif args.commands["targets"]["*.tyto"]: elif args.commands["targets"]["*.tyto"]:
article() article()
elif args.set_module:
for set_module in args.commands["modules"]: for mod in args.commands["modules"]:
if args.commands["modules"][set_module]: if args.commands["modules"][mod]:
modules.manage("update") modules.manage(mod)
#======================================================================# #======================================================================#

View File

@ -52,6 +52,20 @@ h6.tyto {}
ul.tyto {} ul.tyto {}
ol.tyto {} ol.tyto {}
li.tyto {} li.tyto {}
/* Words tags */
br.tyto {}
hr.tyto {}
strong.tyto {}
bold.tyto {}
q.tyto {}
cite.tyto {}
u.tyto {}
em.tyto {}
i.tyto {}
del.tyto {}
span.tyto {}
/* - BlockCode "{{...}}" /* - BlockCode "{{...}}"
* defaylt "bcode". If Class set: "bcode" is replaced. i.e pre.MYCSS_pre * defaylt "bcode". If Class set: "bcode" is replaced. i.e pre.MYCSS_pre