From 2b2f6c8de23a2706ed9d052e459eb39fc8e1bb99 Mon Sep 17 00:00:00 2001 From: Cyrille L Date: Tue, 7 Mar 2023 17:44:44 +0100 Subject: [PATCH] misc changes + README --- README.md | 14 +++++++++----- src/var/lib/tyto/program/logs.py | 2 +- src/var/lib/tyto/program/publish.py | 16 ++++++++++------ src/var/lib/tyto/program/wip.py | 5 +++-- 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index ce6158b..29bd88a 100644 --- a/README.md +++ b/README.md @@ -126,7 +126,7 @@ Citation simple sans référence un long paragraphe )) (( ->_id:Retourner au point d'ancre_< +>_id:Retourner au point d'ancre id_< )) ``` @@ -157,10 +157,14 @@ Vous pouvez avoir un NAME identique pour file: et link: /_en italique_/ # [_en italique_] # ~_texte barré_~ # -{_Code_} # :_Citation rapide_: # %_Classe personnalisée_% >>> -._Souligné_. # +._Souligné_. # +{_Code_} # + +# Montrer comment écrire du code dans Tyto: +# Bypass avec \ devant {_ et _} +{_\{_Comme ça\_}_} ``` @@ -190,9 +194,9 @@ _image:Nom t=https://...# Donne un lien à l'image _image:Nom c=CSS t=https://... w=320px h=240 ``` -### Code Brut depuis un fichier +### Code brut depuis un fichier ``` -_brut:NOM +_raw:NOM ``` ### Citations diff --git a/src/var/lib/tyto/program/logs.py b/src/var/lib/tyto/program/logs.py index 783ad98..50185ab 100644 --- a/src/var/lib/tyto/program/logs.py +++ b/src/var/lib/tyto/program/logs.py @@ -33,7 +33,7 @@ def out(nbr, value, out): '1' : ':< %sUnused resource%s: %s'%(CR, CS, value), '2' : ':< %sIncomplete data%s: %s'%(CR, CS, value), '3' : ':< %sInvalid data%s: "%s"'%(CR, CS, value), - '4' : ':< %sCannot create file%s: %s'%(CR, CS, value), + '4' : ':< %sUnable to create file%s: %s'%(CR, CS, value), '5' : ':< %sUnused argument%s: [file]'%(CR, CS), '6' : ':< %sUnused "%s"%s in article'%(CR, value, CS), '7' : ':< Article %snot valid yet%s'%(CR, CS), diff --git a/src/var/lib/tyto/program/publish.py b/src/var/lib/tyto/program/publish.py index 6f80842..bebea51 100644 --- a/src/var/lib/tyto/program/publish.py +++ b/src/var/lib/tyto/program/publish.py @@ -68,7 +68,8 @@ def manage_publish(target): elif db.hash_post != db.hash_wip: logs.out("30", db.uri_file, False) err_pub = True - elif not os.path.exists(db.post_wip): + + if not os.path.exists(db.post_wip): logs.out("1", db.post_wip, True) if err_pub: sys.exit(1) @@ -133,10 +134,9 @@ def create_template(option): ' to %s\n'%db.srv_www_tpl ) - ask = ' ├ Update template ? ' res = '' try: - res = input(ask) + res = input(' ├ Update template ? ') except KeyboardInterrupt: print('') logs.out("255", '', True) @@ -177,9 +177,14 @@ def create_template(option): #--------------------------------------------# def create_all(option): ask = '' - ask = input(" ├ Publish again all already published articles ? ") + try: + ask = input(" ├ Publish again all already published articles ? ") + except KeyboardInterrupt: + print('') + logs.out("255", '', True) + if not ask in ['y', 'Y']: - return + logs.out("255", '', True) # Load domain configuration DB published = False @@ -215,4 +220,3 @@ def create_all(option): if not published: logs.out("28", '(publish)', True) - return diff --git a/src/var/lib/tyto/program/wip.py b/src/var/lib/tyto/program/wip.py index 24e3f18..0c3df8b 100644 --- a/src/var/lib/tyto/program/wip.py +++ b/src/var/lib/tyto/program/wip.py @@ -83,7 +83,8 @@ def manage_wip(target): logs.out("9", db.uri_file, True) # Compare and check file - if db.hash_wip != db.hash_chk: # Article has changed + # Article has changed or wip file missing + if db.hash_wip != db.hash_chk or not os.path.exists(db.post_wip): wip_article(db.uri_file) else: logs.out("19", db.date_wip, False) @@ -631,7 +632,7 @@ def wip_raws(target): global article_bottom - for i in range(1, uniq_raws + 1): + for i in range(1, db.uniq_raws + 1): raw = 'db.raw_%s'%i raw_file = open( '%s%s'%(