[1.9.57] 'All' done !
This commit is contained in:
parent
3bd4ee6bcf
commit
2f760d4d27
13
CHANGELOG.md
13
CHANGELOG.md
|
@ -2,14 +2,19 @@
|
||||||
|
|
||||||
Tyto - Littérateur
|
Tyto - Littérateur
|
||||||
- Repository: https://forge.a-lec.org/echolib/tyto-litterateur/
|
- Repository: https://forge.a-lec.org/echolib/tyto-litterateur/
|
||||||
- Issues: https://forge.a-lec.org/echolib/tyto-litterateur/issues
|
- Issues: https://forge.a-lec.org/echolib/tyto-litterateur/issues
|
||||||
- Changelog:
|
- License: https://forge.a-lec.org/echolib/tyto-litterateur/src/branch/master/LICENSE
|
||||||
- License:
|
|
||||||
- Documentation: https://forge.a-lec.org/echolib/tyto-litterateur/src/branch/master/LICENSE
|
|
||||||
- Development: https://forge.a-lec.org/echolib/tyto-litterateur/src/branch/devel
|
- Development: https://forge.a-lec.org/echolib/tyto-litterateur/src/branch/devel
|
||||||
|
|
||||||
# CURRENTLY IN DEV (in devel branch) !
|
# CURRENTLY IN DEV (in devel branch) !
|
||||||
|
|
||||||
|
## [1.9.57]
|
||||||
|
- new "css" target.
|
||||||
|
- - With [help] : show references styles
|
||||||
|
- - with [show] : show styles.css in wip/ server
|
||||||
|
- fix publish and wip code for multiple articles in command line
|
||||||
|
- added [all] argument for [publish] : publish again all published article
|
||||||
|
|
||||||
## [1.9.56]
|
## [1.9.56]
|
||||||
- update HTML output for bcodes and codes markers
|
- update HTML output for bcodes and codes markers
|
||||||
- update styles.css default references (tpl_files)
|
- update styles.css default references (tpl_files)
|
||||||
|
|
14
README.md
14
README.md
|
@ -18,11 +18,15 @@ tyto help words anchor
|
||||||
|
|
||||||
# Create new domain
|
# Create new domain
|
||||||
- create a domain directory, like www.domain.tld
|
- create a domain directory, like www.domain.tld
|
||||||
- Go to this directory
|
- go to this directory
|
||||||
- type `tyto new domain`
|
- type `tyto new domain`
|
||||||
- type `tyto check domain` and PLEASE, CHECK configuration file
|
- type `tyto check domain` and PLEASE, CHECK configuration file
|
||||||
- create in new directory domain ".../articles/", an articl file [myfile].tyto (see help)
|
|
||||||
- type `wip myfile.tyto`
|
# Create an article
|
||||||
|
- go to domain directory ".../articles/"
|
||||||
|
- create an article file [myfile].tyto (see `tyto help article`)
|
||||||
|
- type `tyto wip myfile.tyto`
|
||||||
|
- [myfile].html is created in wip/ domain server directory
|
||||||
|
|
||||||
|
|
||||||
## Exemple d'article .tyto commenté
|
## Exemple d'article .tyto commenté
|
||||||
|
@ -93,7 +97,7 @@ file: PyF
|
||||||
# Code dans un texte
|
# Code dans un texte
|
||||||
# ! Les marqueurs d'ouverture et de fermeture de code sont sur la MEME LIGNE
|
# ! Les marqueurs d'ouverture et de fermeture de code sont sur la MEME LIGNE
|
||||||
|
|
||||||
{` <li>Une entée de liste</li> `} => <code>
|
{` <li>Une entrée de liste</li> `} => <code>
|
||||||
|
|
||||||
# ! Dans certains cas, il faut ajouter un espace après le 1er marqueur
|
# ! Dans certains cas, il faut ajouter un espace après le 1er marqueur
|
||||||
# et/ou avant le second. Ils seront automatiquement supprimés
|
# et/ou avant le second. Ils seront automatiquement supprimés
|
||||||
|
@ -187,7 +191,7 @@ Citation complète dans un paragraphe
|
||||||
<li class="bcode_item"><code class="bcode_code"># Code dans un texte</code></li>
|
<li class="bcode_item"><code class="bcode_code"># Code dans un texte</code></li>
|
||||||
<li class="bcode_item"><code class="bcode_code"># ! Les marqueurs d'ouverture et de fermeture de code sont sur la MEME LIGNE</code></li>
|
<li class="bcode_item"><code class="bcode_code"># ! Les marqueurs d'ouverture et de fermeture de code sont sur la MEME LIGNE</code></li>
|
||||||
<li class="bcode_item"><code class="bcode_code"></code></li>
|
<li class="bcode_item"><code class="bcode_code"></code></li>
|
||||||
<li class="bcode_item"><code class="bcode_code">{` <li>Une entée de liste</li> `} => <code></code></li>
|
<li class="bcode_item"><code class="bcode_code">{` <li>Une entrée de liste</li> `} => <code></code></li>
|
||||||
<li class="bcode_item"><code class="bcode_code"></code></li>
|
<li class="bcode_item"><code class="bcode_code"></code></li>
|
||||||
<li class="bcode_item"><code class="bcode_code"># ! Dans certains cas, il faut ajouter un espace après le 1er marqueur</code></li>
|
<li class="bcode_item"><code class="bcode_code"># ! Dans certains cas, il faut ajouter un espace après le 1er marqueur</code></li>
|
||||||
<li class="bcode_item"><code class="bcode_code"># et/ou avant le second. Ils seront automatiquement supprimés</code></li>
|
<li class="bcode_item"><code class="bcode_code"># et/ou avant le second. Ils seront automatiquement supprimés</code></li>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
Package: tyto
|
Package: tyto
|
||||||
Version: 1.9.56
|
Version: 1.9.57
|
||||||
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.56
|
# version: 1.9.57
|
||||||
# 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>
|
||||||
|
|
|
@ -49,6 +49,7 @@ def get_arguments():
|
||||||
"all" : False,
|
"all" : False,
|
||||||
"domain" : False,
|
"domain" : False,
|
||||||
"sitemap" : False,
|
"sitemap" : False,
|
||||||
|
"css" : False,
|
||||||
},
|
},
|
||||||
"modules" : {
|
"modules" : {
|
||||||
"modules" : False,
|
"modules" : False,
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import args, langs
|
import args, langs, show
|
||||||
|
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@ -46,6 +46,7 @@ def manage():
|
||||||
"anchor" : langs.logs.help_anc,
|
"anchor" : langs.logs.help_anc,
|
||||||
"raw" : langs.logs.help_raw,
|
"raw" : langs.logs.help_raw,
|
||||||
"article" : langs.logs.help_article,
|
"article" : langs.logs.help_article,
|
||||||
|
"css" : "",
|
||||||
}
|
}
|
||||||
|
|
||||||
norepeat = \
|
norepeat = \
|
||||||
|
@ -73,5 +74,8 @@ def manage():
|
||||||
for arg in range(2, len(sys.argv)):
|
for arg in range(2, len(sys.argv)):
|
||||||
if sys.argv[arg] in helps:
|
if sys.argv[arg] in helps:
|
||||||
print(helps[sys.argv[arg]])
|
print(helps[sys.argv[arg]])
|
||||||
|
|
||||||
|
# CSS references
|
||||||
|
if args.commands["targets"]["css"]:
|
||||||
|
show.contents_file("/var/lib/tyto/tpl_files/styles.css", True)
|
||||||
|
|
||||||
|
|
|
@ -166,9 +166,9 @@ def cf_create():
|
||||||
cf_write()
|
cf_write()
|
||||||
|
|
||||||
|
|
||||||
#
|
#=============================================#
|
||||||
#
|
# Set and reset vars (when multiple articles) #
|
||||||
#
|
#---------------------------------------------#
|
||||||
def set_default_vars():
|
def set_default_vars():
|
||||||
global anchors, block_tags, icodes, options_marks
|
global anchors, block_tags, icodes, options_marks
|
||||||
global needed_tags, option_tags, titles
|
global needed_tags, option_tags, titles
|
||||||
|
|
|
@ -25,7 +25,8 @@
|
||||||
# File: /var/lib/tyto/program/publish.py
|
# File: /var/lib/tyto/program/publish.py
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
import os
|
import os, configparser
|
||||||
|
from pathlib import Path
|
||||||
import domain, args, wip, post, debug, tools, sitemap, feed
|
import domain, args, wip, post, debug, tools, sitemap, feed
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,39 +35,69 @@ import domain, args, wip, post, debug, tools, sitemap, feed
|
||||||
#--------------------------------------------------------#
|
#--------------------------------------------------------#
|
||||||
def manage():
|
def manage():
|
||||||
domain.is_active()
|
domain.is_active()
|
||||||
|
wip.in_dir_articles()
|
||||||
|
|
||||||
global out
|
global out
|
||||||
if args.article:
|
# Multiple targets ("all"): out is False
|
||||||
wip.in_dir_articles()
|
# (out to exit on error at single target)
|
||||||
|
out = not(args.commands["targets"]["all"])
|
||||||
# Multiple targets ("all"): out is False
|
|
||||||
# (out to exit on error at single target)
|
if args.commands["targets"]["all"]:
|
||||||
out = not(args.targets)
|
articles()
|
||||||
article()
|
|
||||||
|
elif args.commands["targets"]["*.tyto"]:
|
||||||
|
for article_item in args.commands["targets"]["*.tyto"]:
|
||||||
|
article(article_item)
|
||||||
|
|
||||||
# Copy sitemap if activated and exists
|
# Copy sitemap if activated and exists
|
||||||
if domain.conf["sitemaps"]:
|
if domain.conf["sitemaps"]:
|
||||||
sitemap.create()
|
sitemap.create()
|
||||||
args.article == "sitemap.tyto"
|
article("sitemap.tyto")
|
||||||
article()
|
|
||||||
|
|
||||||
feed.create()
|
feed.create()
|
||||||
tools.copy_template_dir("www")
|
tools.copy_template_dir("www")
|
||||||
|
|
||||||
|
|
||||||
|
#========================================================#
|
||||||
|
# With "all", publish (again) already published articles #
|
||||||
|
#--------------------------------------------------------#
|
||||||
|
def articles():
|
||||||
|
for db_uri in Path(domain.wrk_dirs["db"]).rglob('*.ini'):
|
||||||
|
db_uri = domain.wrk_dirs["db"] + db_uri.name
|
||||||
|
# TMP load neede datas from DB article
|
||||||
|
cf = configparser.ConfigParser()
|
||||||
|
cf.read(db_uri)
|
||||||
|
|
||||||
|
datas = \
|
||||||
|
{
|
||||||
|
"wrk_tgt" : cf.get("URIS", "wrk").rsplit(domain.wrk_dirs["articles"])[1],
|
||||||
|
"wip_uri" : cf.get("URIS", "wip"),
|
||||||
|
"www_hid" : cf.get("HASHES", "www"),
|
||||||
|
}
|
||||||
|
|
||||||
|
# Filter from DB
|
||||||
|
if datas["wrk_tgt"] == "sitemap.tyto" or \
|
||||||
|
not os.path.exists(datas["wip_uri"]) or \
|
||||||
|
not datas["www_hid"]:
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Publish (again) this article
|
||||||
|
article(datas["wrk_tgt"])
|
||||||
|
|
||||||
|
|
||||||
#==============================#
|
#==============================#
|
||||||
# Set DB, check and copy files #
|
# Set DB, check and copy files #
|
||||||
#------------------------------#
|
#------------------------------#
|
||||||
def article():
|
def article(article_item):
|
||||||
post.set_uri(args.article)
|
post.set_uri(article_item)
|
||||||
post.exists(args.article)
|
post.exists(article_item)
|
||||||
db_uri = domain.wrk_dirs["db"] + post.uid + ".ini"
|
db_uri = domain.wrk_dirs["db"] + post.uid + ".ini"
|
||||||
if not bool(os.path.exists(db_uri)):
|
if not bool(os.path.exists(db_uri)):
|
||||||
debug.out(12, "wip %s"%args.article, post.uid, True, 2, out)
|
debug.out(12, "wip %s"%article_item, post.uid, True, 2, out)
|
||||||
|
|
||||||
post.cf_load()
|
post.cf_load()
|
||||||
if not check_db():
|
if not check_db():
|
||||||
debug.out(12, "wip %s"%args.article, post.uri, True, 2, out)
|
debug.out(12, "wip %s"%article_item, post.uri, True, 2, out)
|
||||||
|
|
||||||
copy_wip_to_www()
|
copy_wip_to_www()
|
||||||
post.cf_set("HASHES", "www", DB["hash_wip"])
|
post.cf_set("HASHES", "www", DB["hash_wip"])
|
||||||
|
|
|
@ -60,6 +60,10 @@ def manage():
|
||||||
if args.commands["targets"]["sitemap"]:
|
if args.commands["targets"]["sitemap"]:
|
||||||
contents_file(domain.wrk_dirs["articles"] + "sitemap.tyto", True)
|
contents_file(domain.wrk_dirs["articles"] + "sitemap.tyto", True)
|
||||||
|
|
||||||
|
# CSS styles in wip/ server
|
||||||
|
if args.commands["targets"]["css"]:
|
||||||
|
contents_file(domain.srv_wip_files["styles"], True)
|
||||||
|
|
||||||
|
|
||||||
#=======================================#
|
#=======================================#
|
||||||
# Read content of file #
|
# Read content of file #
|
||||||
|
|
|
@ -75,8 +75,7 @@ def create():
|
||||||
)
|
)
|
||||||
|
|
||||||
tools.create_file(domain.wrk_dirs["articles"] + "sitemap.tyto", sitemap_tyto)
|
tools.create_file(domain.wrk_dirs["articles"] + "sitemap.tyto", sitemap_tyto)
|
||||||
args.article = "sitemap.tyto"
|
wip.article("sitemap.tyto")
|
||||||
wip.article()
|
|
||||||
|
|
||||||
|
|
||||||
#===============================#
|
#===============================#
|
||||||
|
|
|
@ -232,6 +232,5 @@ def get_articles():
|
||||||
)
|
)
|
||||||
|
|
||||||
for uri in files:
|
for uri in files:
|
||||||
args.article = uri.rsplit(root_dir)[1]
|
wip.article(uri.rsplit(root_dir)[1])
|
||||||
wip.article()
|
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,8 @@ def manage():
|
||||||
|
|
||||||
# Treat target article
|
# Treat target article
|
||||||
elif args.commands["targets"]["*.tyto"]:
|
elif args.commands["targets"]["*.tyto"]:
|
||||||
article()
|
for article_item in args.commands["targets"]["*.tyto"]:
|
||||||
|
article(article_item)
|
||||||
|
|
||||||
|
|
||||||
for mod in args.commands["modules"]:
|
for mod in args.commands["modules"]:
|
||||||
|
@ -73,61 +74,59 @@ def articles():
|
||||||
# Create Full HTML page #
|
# Create Full HTML page #
|
||||||
# Create article DB with values #
|
# Create article DB with values #
|
||||||
#--------------------------------#
|
#--------------------------------#
|
||||||
def article():
|
def article(article_item):
|
||||||
in_dir_articles()
|
in_dir_articles()
|
||||||
for article_item in args.commands["targets"]["*.tyto"]:
|
post.set_uri(article_item)
|
||||||
post.set_uri(article_item)
|
|
||||||
|
|
||||||
# Exit in single article mode if not exists
|
|
||||||
if not args.commands["targets"]["all"]:
|
|
||||||
post.exists(article_item)
|
|
||||||
|
|
||||||
|
# Exit in single article mode if not exists
|
||||||
post.set_datas()
|
if not args.commands["targets"]["all"]:
|
||||||
|
post.exists(article_item)
|
||||||
# Check Tyto file format, create post values
|
|
||||||
if not check.tyto_format():
|
post.set_datas()
|
||||||
return
|
|
||||||
|
|
||||||
# Create server wip/ directories
|
# Check Tyto file format, create post values
|
||||||
domain.create_srv_dirs("wip")
|
if not check.tyto_format():
|
||||||
|
return
|
||||||
|
|
||||||
|
# Create server wip/ directories
|
||||||
|
domain.create_srv_dirs("wip")
|
||||||
|
|
||||||
|
# Convert article
|
||||||
|
convert_article()
|
||||||
|
|
||||||
# Convert article
|
# Create Full HTML Page
|
||||||
convert_article()
|
page.create()
|
||||||
|
|
||||||
# Create Full HTML Page
|
# Create DB article
|
||||||
page.create()
|
create_db()
|
||||||
|
|
||||||
|
# Copy files to server wip/
|
||||||
|
tools.copy_to_srv(page.article)
|
||||||
|
tools.copy_template_dir("wip")
|
||||||
|
|
||||||
# Create DB article
|
# Write values to article DB
|
||||||
create_db()
|
post.cf_set("HASHES", "wip", post.datas["cid"])
|
||||||
|
post.cf_set("DATES", "wip", page.pub_date)
|
||||||
# Copy files to server wip/
|
# Copy stats
|
||||||
tools.copy_to_srv(page.article)
|
for stat in check.stats:
|
||||||
tools.copy_template_dir("wip")
|
for name in check.stats[stat]:
|
||||||
|
post.cf_set("STATS_%s"%stat.upper(),
|
||||||
# Write values to article DB
|
name,
|
||||||
post.cf_set("HASHES", "wip", post.datas["cid"])
|
str(check.stats[stat][name])
|
||||||
post.cf_set("DATES", "wip", page.pub_date)
|
)
|
||||||
# Copy stats
|
|
||||||
for stat in check.stats:
|
|
||||||
for name in check.stats[stat]:
|
|
||||||
post.cf_set("STATS_%s"%stat.upper(),
|
|
||||||
name,
|
|
||||||
str(check.stats[stat][name])
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
post.cf_write()
|
|
||||||
|
|
||||||
# Check/create modules (metas, header, navbar, sidebar, footer)
|
|
||||||
modules.manage("wip")
|
|
||||||
|
|
||||||
# Mainly for sitemap, as created at publish
|
|
||||||
if not args.action == "publish":
|
|
||||||
debug.out(250, post.needed_tags["title"],
|
|
||||||
domain.wip + post.datas["srv_target"], True, 0, False
|
|
||||||
)
|
|
||||||
|
|
||||||
|
post.cf_write()
|
||||||
|
|
||||||
|
# Check/create modules (metas, header, navbar, sidebar, footer)
|
||||||
|
modules.manage("wip")
|
||||||
|
|
||||||
|
# Mainly for sitemap, as created at publish
|
||||||
|
if not args.action == "publish":
|
||||||
|
debug.out(250, post.needed_tags["title"],
|
||||||
|
domain.wip + post.datas["srv_target"], True, 0, False
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
#===========================#
|
#===========================#
|
||||||
# Convert article processes #
|
# Convert article processes #
|
||||||
|
|
|
@ -214,7 +214,7 @@ tyto [ACTION] [ARGUMENTS]
|
||||||
start > activate current domain
|
start > activate current domain
|
||||||
stop > deactivate current domain
|
stop > deactivate current domain
|
||||||
check ? + [domain] : check current domain
|
check ? + [domain] : check current domain
|
||||||
show > show files contents [domain], [MODULES]...
|
show > show files contents [domain], [MODULES], [css]...
|
||||||
wip ? create HTML in "wip/" server
|
wip ? create HTML in "wip/" server
|
||||||
publish ? publish in "www/" server
|
publish ? publish in "www/" server
|
||||||
|
|
||||||
|
@ -222,6 +222,7 @@ tyto [ACTION] [ARGUMENTS]
|
||||||
domain > create new/check domain
|
domain > create new/check domain
|
||||||
[abc].tyto > target [abc].tyto (multiples)
|
[abc].tyto > target [abc].tyto (multiples)
|
||||||
all > [wip] : target all .tyto files in current domain
|
all > [wip] : target all .tyto files in current domain
|
||||||
|
[publish] : publish again all published articles
|
||||||
|
|
||||||
[MODULES] : (Useless with [publish])
|
[MODULES] : (Useless with [publish])
|
||||||
metas > target metas module
|
metas > target metas module
|
||||||
|
@ -237,6 +238,7 @@ tyto [ACTION] [ARGUMENTS]
|
||||||
|
|
||||||
- [help] * : * multiples. Documentation
|
- [help] * : * multiples. Documentation
|
||||||
"?" > see argument name before "?"
|
"?" > see argument name before "?"
|
||||||
|
css > show styles.css default references
|
||||||
all > show all helps
|
all > show all helps
|
||||||
modules > use modules
|
modules > use modules
|
||||||
article > write .tyto article
|
article > write .tyto article
|
||||||
|
|
|
@ -214,7 +214,7 @@ tyto [ACTION] [ARGUMENTS]
|
||||||
start > activer le domain actuel
|
start > activer le domain actuel
|
||||||
stop > désactiver le domaine actuel
|
stop > désactiver le domaine actuel
|
||||||
check ? + [domain] : vérifier le domaine actuel
|
check ? + [domain] : vérifier le domaine actuel
|
||||||
show > montre le contenu des fichiers [domain], [MODULES]...
|
show > montre le contenu des fichiers [domain], [MODULES], [css]...
|
||||||
wip ? créer de l'HTML dans le serveur "wip/"
|
wip ? créer de l'HTML dans le serveur "wip/"
|
||||||
publish ? publier dans le serveur "www/"
|
publish ? publier dans le serveur "www/"
|
||||||
|
|
||||||
|
@ -222,6 +222,7 @@ tyto [ACTION] [ARGUMENTS]
|
||||||
domain > créer/vérifier un domaine
|
domain > créer/vérifier un domaine
|
||||||
[nom].tyto > cible le fichier [nom].tyto (plusieurs possibles)
|
[nom].tyto > cible le fichier [nom].tyto (plusieurs possibles)
|
||||||
all > [wip] : cible tous les fichiers .tyto du domaine courant
|
all > [wip] : cible tous les fichiers .tyto du domaine courant
|
||||||
|
[publish] : publie tous les article déjà publiés
|
||||||
|
|
||||||
[MODULES] : (inutiles avec [publish])
|
[MODULES] : (inutiles avec [publish])
|
||||||
metas > cible le module metas
|
metas > cible le module metas
|
||||||
|
@ -237,6 +238,7 @@ tyto [ACTION] [ARGUMENTS]
|
||||||
|
|
||||||
- [help] * : * multiples. Documentation
|
- [help] * : * multiples. Documentation
|
||||||
"?" > voir le nom de l'argument avant le signe "?"
|
"?" > voir le nom de l'argument avant le signe "?"
|
||||||
|
css > voir les références par défaut de styles.css
|
||||||
all > montre toutes les informations d'aides
|
all > montre toutes les informations d'aides
|
||||||
modules > utiliser les modules
|
modules > utiliser les modules
|
||||||
article > écrire un article .tyto
|
article > écrire un article .tyto
|
||||||
|
|
Loading…
Reference in New Issue