Added: publish [all]. Publish one by one is needed first
This commit is contained in:
parent
8b33b675c9
commit
a1fbf3a1a5
|
@ -8,7 +8,7 @@ Pour obtenir de l'aide, taper juste la commande tyto
|
||||||
# Obligatoires uniques
|
# Obligatoires uniques
|
||||||
title: Titre
|
title: Titre
|
||||||
about: Infos de l'article
|
about: Infos de l'article
|
||||||
author: Autheur
|
author: Auteur
|
||||||
tags: mots-clé-1,mots-clé-2
|
tags: mots-clé-1,mots-clé-2
|
||||||
date: YYYY-MM-DD (AAAA-MM-JJ)
|
date: YYYY-MM-DD (AAAA-MM-JJ)
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,8 @@ def tyto(target):
|
||||||
' publish : Create page in www server\n\n'
|
' publish : Create page in www server\n\n'
|
||||||
' - [target] according to [action]\n'
|
' - [target] according to [action]\n'
|
||||||
' all : Convert again all already converted articles\n'
|
' all : Convert again all already converted articles\n'
|
||||||
|
' template: - Create navbar/sidebar/metas/footer in www server\n'
|
||||||
|
' - Copy wip/template/ files to www server\n'
|
||||||
' domain : Create/Show config file\n'
|
' domain : Create/Show config file\n'
|
||||||
' [file] : URI of an article\'s file (autocompletion is your friend)\n'
|
' [file] : URI of an article\'s file (autocompletion is your friend)\n'
|
||||||
' footer : Create/Show footer HTML config\'s file\n'
|
' footer : Create/Show footer HTML config\'s file\n'
|
||||||
|
|
|
@ -73,8 +73,13 @@ def manage_publish(target):
|
||||||
|
|
||||||
if err_pub: sys.exit(1)
|
if err_pub: sys.exit(1)
|
||||||
|
|
||||||
# Let's publish
|
publish_article()
|
||||||
#--------------
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Let's publish
|
||||||
|
#
|
||||||
|
def publish_article():
|
||||||
# Copy wip page to www page
|
# Copy wip page to www page
|
||||||
shutil.copy2(db.post_wip, db.post_www)
|
shutil.copy2(db.post_wip, db.post_www)
|
||||||
logs.out("33", db.post_www, False)
|
logs.out("33", db.post_www, False)
|
||||||
|
@ -170,8 +175,47 @@ def create_template(option):
|
||||||
html.create_user_footer('pub')
|
html.create_user_footer('pub')
|
||||||
|
|
||||||
|
|
||||||
#================================#
|
#============================================#
|
||||||
# Publish template in www server #
|
# Option 'all' to publish again, based on DB #
|
||||||
#--------------------------------#
|
#--------------------------------------------#
|
||||||
def create_all(option):
|
def create_all(option):
|
||||||
print('> argument all', option)
|
ask = ''
|
||||||
|
ask = input(" ├ Publish again all already published articles ? ")
|
||||||
|
if not ask in ['y', 'Y']:
|
||||||
|
return
|
||||||
|
|
||||||
|
# Load domain configuration DB
|
||||||
|
published = False
|
||||||
|
for post_db in os.listdir(db.articles_db):
|
||||||
|
if post_db.endswith('.conf'):
|
||||||
|
# Load DB
|
||||||
|
post_db = '%s%s'%(db.articles_db, post_db)
|
||||||
|
exec(open(post_db).read(),globals())
|
||||||
|
args.target = post_src.rsplit('%s/'%db.in_dir)[1]
|
||||||
|
importlib.reload(db)
|
||||||
|
|
||||||
|
# Conditions to publish
|
||||||
|
if not db.hash_www:
|
||||||
|
continue
|
||||||
|
|
||||||
|
print(':> [%s] | %s'%(db.title, db.post_src))
|
||||||
|
hash_post = tyto.get_filesum(db.post_src, True) # From content file
|
||||||
|
|
||||||
|
if not db.hash_chk:
|
||||||
|
logs.out("25", db.uri_file, False)
|
||||||
|
continue
|
||||||
|
|
||||||
|
if db.hash_chk != db.hash_post:
|
||||||
|
logs.out("9", db.uri_file, False)
|
||||||
|
continue
|
||||||
|
|
||||||
|
if db.hash_wip != db.hash_chk:
|
||||||
|
logs.out("30", db.uri_file, False)
|
||||||
|
continue
|
||||||
|
|
||||||
|
published = True
|
||||||
|
publish_article()
|
||||||
|
|
||||||
|
if not published:
|
||||||
|
logs.out("28", '(publish)', True)
|
||||||
|
return
|
||||||
|
|
|
@ -35,7 +35,7 @@ def manage_wip(target):
|
||||||
#---------------------------------------
|
#---------------------------------------
|
||||||
if target == 'all':
|
if target == 'all':
|
||||||
ask = ''
|
ask = ''
|
||||||
ask = input(":? wip again all already converted articles ? ")
|
ask = input(" ├ Wip again all already converted articles ? ")
|
||||||
if not ask in ['y', 'Y']:
|
if not ask in ['y', 'Y']:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -47,9 +47,14 @@ def manage_wip(target):
|
||||||
exec(open(post_db).read(),globals())
|
exec(open(post_db).read(),globals())
|
||||||
args.target = post_src.rsplit('%s/'%db.in_dir)[1]
|
args.target = post_src.rsplit('%s/'%db.in_dir)[1]
|
||||||
importlib.reload(db)
|
importlib.reload(db)
|
||||||
|
if not db.hash_wip:
|
||||||
|
continue
|
||||||
|
|
||||||
print(':> [%s] | %s'%(db.title, db.post_src))
|
print(':> [%s] | %s'%(db.title, db.post_src))
|
||||||
if not db.hash_wip: continue
|
|
||||||
hash_post = tyto.get_filesum(db.post_src, True) # From content file
|
hash_post = tyto.get_filesum(db.post_src, True) # From content file
|
||||||
|
if hash_post != db.hash_chk:
|
||||||
|
logs.out("25", db.uri_file, False)
|
||||||
|
ocontinue
|
||||||
wip_article(db.post_src)
|
wip_article(db.post_src)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -77,7 +82,7 @@ def manage_wip(target):
|
||||||
if db.hash_chk != db.hash_post: logs.out("9", target, True)
|
if db.hash_chk != db.hash_post: logs.out("9", target, True)
|
||||||
|
|
||||||
# Compare and check file
|
# Compare and check file
|
||||||
if db.hash_wip != db.hash_chk:
|
if db.hash_wip != db.hash_chk: # Article has changed
|
||||||
wip_article(db.uri_file)
|
wip_article(db.uri_file)
|
||||||
else:
|
else:
|
||||||
if not os.path.exists(db.post_wip):
|
if not os.path.exists(db.post_wip):
|
||||||
|
|
Loading…
Reference in New Issue