[1.9.55]
This commit is contained in:
parent
b6686a0ebd
commit
33a4c24e47
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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"]:
|
||||||
|
|
|
@ -36,7 +36,7 @@ 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"]
|
||||||
|
@ -78,65 +78,76 @@ 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
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
new_mod_raw = False
|
||||||
|
if args.action == "new" and \
|
||||||
|
module in files and \
|
||||||
|
os.path.exists(files[module]["wrk"]):
|
||||||
|
raw_cid = tools.get_HID(files[module]["wrk"], True)
|
||||||
|
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
|
||||||
|
# ------------------------------------------------
|
||||||
for mod in files:
|
for mod in files:
|
||||||
# For all modules to reset, confirm once
|
if not os.path.exists(files[mod]["wrk"]) or new_mod_raw:
|
||||||
if os.path.exists(files[mod]["wrk"]):
|
files[mod]["set"](mod)
|
||||||
if module == "all":
|
mod_write = True
|
||||||
try: asked
|
tools.create_file(files[mod]["wrk"], files[mod]["usr"])
|
||||||
except: form.ask_reset_modules() ; asked = True
|
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)
|
||||||
|
|
||||||
elif mod != module:
|
# Reload DB if updated
|
||||||
continue
|
if mod_write:
|
||||||
|
cf_mod_write()
|
||||||
|
cf_mod_load()
|
||||||
|
mod_write = False
|
||||||
|
|
||||||
mod_write = True
|
|
||||||
files[mod]["set"](mod)
|
|
||||||
tools.create_file(files[mod]["wrk"], files[mod]["usr"])
|
|
||||||
cid = tools.get_HID(files[mod]["wrk"], True)
|
|
||||||
cf_mod_set("RAWS", mod, cid)
|
|
||||||
|
|
||||||
cf_mod_write()
|
# From wip process, after article convertion
|
||||||
if args.action == "new":
|
# Create HTML modules in wip§ server
|
||||||
debug.out(250, module, wrk_dir, True, 0, False)
|
# - if not exist or raw file has changed
|
||||||
|
# ------------------------------------------
|
||||||
# When an article is "wip"
|
|
||||||
# - create html modules
|
|
||||||
# - - if not already exists
|
|
||||||
# - - 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 force update HTML modules
|
|
||||||
# using wip [MODULE] ; called in wip.py
|
# When user wants to create again HTML module in wip/ server
|
||||||
elif module == "update":
|
# ----------------------------------------------------------
|
||||||
# Create again ALL modules in wip/template
|
if args.action == "wip":
|
||||||
if args.commands["modules"]["modules"]:
|
create_htmls(module)
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
#=======================================#
|
#=======================================#
|
||||||
|
@ -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)
|
||||||
|
|
||||||
|
|
||||||
#==============================================#
|
#==============================================#
|
||||||
|
|
|
@ -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")
|
|
||||||
return
|
|
||||||
|
|
||||||
args.commands["modules"]["metas"] and modules.manage("metas")
|
# Some modules was set in arguments
|
||||||
args.commands["modules"]["header"] and modules.manage("header")
|
for mod in args.commands["modules"]:
|
||||||
args.commands["modules"]["navbar"] and modules.manage("navbar")
|
if args.commands["modules"][mod]:
|
||||||
args.commands["modules"]["sidebar"] and modules.manage("sidebar")
|
modules.manage(mod)
|
||||||
args.commands["modules"]["footer"] and modules.manage("footer")
|
|
||||||
|
|
||||||
args.commands["targets"]["sitemap"] and sitemap.create()
|
args.commands["targets"]["sitemap"] and sitemap.create()
|
||||||
|
|
|
@ -37,10 +37,6 @@ def manage():
|
||||||
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]:
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|
||||||
#======================================================================#
|
#======================================================================#
|
||||||
|
|
|
@ -53,6 +53,20 @@ h6.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
|
||||||
* - "code::NAME" (file content) -> "::NAME"
|
* - "code::NAME" (file content) -> "::NAME"
|
||||||
|
|
Loading…
Reference in New Issue