[1.9.57] 'All' done !
This commit is contained in:
parent
3bd4ee6bcf
commit
2f760d4d27
11
CHANGELOG.md
11
CHANGELOG.md
|
@ -3,13 +3,18 @@
|
|||
Tyto - Littérateur
|
||||
- Repository: https://forge.a-lec.org/echolib/tyto-litterateur/
|
||||
- Issues: https://forge.a-lec.org/echolib/tyto-litterateur/issues
|
||||
- Changelog:
|
||||
- License:
|
||||
- Documentation: https://forge.a-lec.org/echolib/tyto-litterateur/src/branch/master/LICENSE
|
||||
- License: https://forge.a-lec.org/echolib/tyto-litterateur/src/branch/master/LICENSE
|
||||
- Development: https://forge.a-lec.org/echolib/tyto-litterateur/src/branch/devel
|
||||
|
||||
# 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]
|
||||
- update HTML output for bcodes and codes markers
|
||||
- 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 a domain directory, like www.domain.tld
|
||||
- Go to this directory
|
||||
- go to this directory
|
||||
- type `tyto new domain`
|
||||
- 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é
|
||||
|
@ -93,7 +97,7 @@ file: PyF
|
|||
# Code dans un texte
|
||||
# ! 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
|
||||
# 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"># ! 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">{` <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"># ! 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>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Package: tyto
|
||||
Version: 1.9.56
|
||||
Version: 1.9.57
|
||||
Section: custom
|
||||
Priority: optional
|
||||
Architecture: all
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
# version: 1.9.56
|
||||
# version: 1.9.57
|
||||
# Tyto - Littérateur
|
||||
|
||||
# Copyright (C) 2023 Cyrille Louarn <echolib+tyto@a-lec.org>
|
||||
|
|
|
@ -49,6 +49,7 @@ def get_arguments():
|
|||
"all" : False,
|
||||
"domain" : False,
|
||||
"sitemap" : False,
|
||||
"css" : False,
|
||||
},
|
||||
"modules" : {
|
||||
"modules" : False,
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#----------------------------------------------------------------------
|
||||
|
||||
import sys
|
||||
import args, langs
|
||||
import args, langs, show
|
||||
|
||||
#
|
||||
#
|
||||
|
@ -46,6 +46,7 @@ def manage():
|
|||
"anchor" : langs.logs.help_anc,
|
||||
"raw" : langs.logs.help_raw,
|
||||
"article" : langs.logs.help_article,
|
||||
"css" : "",
|
||||
}
|
||||
|
||||
norepeat = \
|
||||
|
@ -74,4 +75,7 @@ def manage():
|
|||
if sys.argv[arg] in helps:
|
||||
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()
|
||||
|
||||
|
||||
#
|
||||
#
|
||||
#
|
||||
#=============================================#
|
||||
# Set and reset vars (when multiple articles) #
|
||||
#---------------------------------------------#
|
||||
def set_default_vars():
|
||||
global anchors, block_tags, icodes, options_marks
|
||||
global needed_tags, option_tags, titles
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
# 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
|
||||
|
||||
|
||||
|
@ -34,39 +35,69 @@ import domain, args, wip, post, debug, tools, sitemap, feed
|
|||
#--------------------------------------------------------#
|
||||
def manage():
|
||||
domain.is_active()
|
||||
wip.in_dir_articles()
|
||||
|
||||
global out
|
||||
if args.article:
|
||||
wip.in_dir_articles()
|
||||
# Multiple targets ("all"): out is False
|
||||
# (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)
|
||||
out = not(args.targets)
|
||||
article()
|
||||
if args.commands["targets"]["all"]:
|
||||
articles()
|
||||
|
||||
elif args.commands["targets"]["*.tyto"]:
|
||||
for article_item in args.commands["targets"]["*.tyto"]:
|
||||
article(article_item)
|
||||
|
||||
# Copy sitemap if activated and exists
|
||||
if domain.conf["sitemaps"]:
|
||||
sitemap.create()
|
||||
args.article == "sitemap.tyto"
|
||||
article()
|
||||
article("sitemap.tyto")
|
||||
|
||||
feed.create()
|
||||
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 #
|
||||
#------------------------------#
|
||||
def article():
|
||||
post.set_uri(args.article)
|
||||
post.exists(args.article)
|
||||
def article(article_item):
|
||||
post.set_uri(article_item)
|
||||
post.exists(article_item)
|
||||
db_uri = domain.wrk_dirs["db"] + post.uid + ".ini"
|
||||
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()
|
||||
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()
|
||||
post.cf_set("HASHES", "www", DB["hash_wip"])
|
||||
|
|
|
@ -60,6 +60,10 @@ def manage():
|
|||
if args.commands["targets"]["sitemap"]:
|
||||
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 #
|
||||
|
|
|
@ -75,8 +75,7 @@ def create():
|
|||
)
|
||||
|
||||
tools.create_file(domain.wrk_dirs["articles"] + "sitemap.tyto", sitemap_tyto)
|
||||
args.article = "sitemap.tyto"
|
||||
wip.article()
|
||||
wip.article("sitemap.tyto")
|
||||
|
||||
|
||||
#===============================#
|
||||
|
|
|
@ -232,6 +232,5 @@ def get_articles():
|
|||
)
|
||||
|
||||
for uri in files:
|
||||
args.article = uri.rsplit(root_dir)[1]
|
||||
wip.article()
|
||||
wip.article(uri.rsplit(root_dir)[1])
|
||||
|
||||
|
|
|
@ -41,7 +41,8 @@ def manage():
|
|||
|
||||
# Treat target article
|
||||
elif args.commands["targets"]["*.tyto"]:
|
||||
article()
|
||||
for article_item in args.commands["targets"]["*.tyto"]:
|
||||
article(article_item)
|
||||
|
||||
|
||||
for mod in args.commands["modules"]:
|
||||
|
@ -73,60 +74,58 @@ def articles():
|
|||
# Create Full HTML page #
|
||||
# Create article DB with values #
|
||||
#--------------------------------#
|
||||
def article():
|
||||
def article(article_item):
|
||||
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
|
||||
if not args.commands["targets"]["all"]:
|
||||
post.exists(article_item)
|
||||
|
||||
post.set_datas()
|
||||
|
||||
# Check Tyto file format, create post values
|
||||
if not check.tyto_format():
|
||||
return
|
||||
|
||||
# Create server wip/ directories
|
||||
domain.create_srv_dirs("wip")
|
||||
|
||||
# Convert article
|
||||
convert_article()
|
||||
|
||||
# Create Full HTML Page
|
||||
page.create()
|
||||
|
||||
# Create DB article
|
||||
create_db()
|
||||
|
||||
# Copy files to server wip/
|
||||
tools.copy_to_srv(page.article)
|
||||
tools.copy_template_dir("wip")
|
||||
|
||||
# Write values to article DB
|
||||
post.cf_set("HASHES", "wip", post.datas["cid"])
|
||||
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.set_datas()
|
||||
post.cf_write()
|
||||
|
||||
# Check Tyto file format, create post values
|
||||
if not check.tyto_format():
|
||||
return
|
||||
# Check/create modules (metas, header, navbar, sidebar, footer)
|
||||
modules.manage("wip")
|
||||
|
||||
# Create server wip/ directories
|
||||
domain.create_srv_dirs("wip")
|
||||
|
||||
# Convert article
|
||||
convert_article()
|
||||
|
||||
# Create Full HTML Page
|
||||
page.create()
|
||||
|
||||
# Create DB article
|
||||
create_db()
|
||||
|
||||
# Copy files to server wip/
|
||||
tools.copy_to_srv(page.article)
|
||||
tools.copy_template_dir("wip")
|
||||
|
||||
# Write values to article DB
|
||||
post.cf_set("HASHES", "wip", post.datas["cid"])
|
||||
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
|
||||
)
|
||||
# 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
|
||||
)
|
||||
|
||||
|
||||
#===========================#
|
||||
|
|
|
@ -214,7 +214,7 @@ tyto [ACTION] [ARGUMENTS]
|
|||
start > activate current domain
|
||||
stop > deactivate 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
|
||||
publish ? publish in "www/" server
|
||||
|
||||
|
@ -222,6 +222,7 @@ tyto [ACTION] [ARGUMENTS]
|
|||
domain > create new/check domain
|
||||
[abc].tyto > target [abc].tyto (multiples)
|
||||
all > [wip] : target all .tyto files in current domain
|
||||
[publish] : publish again all published articles
|
||||
|
||||
[MODULES] : (Useless with [publish])
|
||||
metas > target metas module
|
||||
|
@ -237,6 +238,7 @@ tyto [ACTION] [ARGUMENTS]
|
|||
|
||||
- [help] * : * multiples. Documentation
|
||||
"?" > see argument name before "?"
|
||||
css > show styles.css default references
|
||||
all > show all helps
|
||||
modules > use modules
|
||||
article > write .tyto article
|
||||
|
|
|
@ -214,7 +214,7 @@ tyto [ACTION] [ARGUMENTS]
|
|||
start > activer le domain actuel
|
||||
stop > désactiver 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/"
|
||||
publish ? publier dans le serveur "www/"
|
||||
|
||||
|
@ -222,6 +222,7 @@ tyto [ACTION] [ARGUMENTS]
|
|||
domain > créer/vérifier un domaine
|
||||
[nom].tyto > cible le fichier [nom].tyto (plusieurs possibles)
|
||||
all > [wip] : cible tous les fichiers .tyto du domaine courant
|
||||
[publish] : publie tous les article déjà publiés
|
||||
|
||||
[MODULES] : (inutiles avec [publish])
|
||||
metas > cible le module metas
|
||||
|
@ -237,6 +238,7 @@ tyto [ACTION] [ARGUMENTS]
|
|||
|
||||
- [help] * : * multiples. Documentation
|
||||
"?" > 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
|
||||
modules > utiliser les modules
|
||||
article > écrire un article .tyto
|
||||
|
|
Loading…
Reference in New Issue