publish template (ok). lang site updated
This commit is contained in:
parent
99389285b0
commit
576213ecfc
|
@ -35,7 +35,7 @@
|
|||
|
||||
import os, sys, shutil, importlib
|
||||
from pathlib import Path
|
||||
import logs, args, dom, db, wip, html, tyto, form, stats, rss
|
||||
import logs, args, dom, db, wip, html, tyto, form, stats, rss, langs
|
||||
|
||||
#==============================#
|
||||
# Manage action, get post db #
|
||||
|
@ -150,25 +150,10 @@ def replace_lines_pub():
|
|||
# Publish template in www server #
|
||||
#--------------------------------#
|
||||
def publish_template(option):
|
||||
print( \
|
||||
'! Note:\n',
|
||||
' - footer, sidebar, metas, navbar\n',
|
||||
' will be generated and REPLACED from configuration files\n',
|
||||
' in %s\n'%db.navbars_dir,
|
||||
' - ALL other files will be copied\n',
|
||||
' from %s\n'%db.srv_wip_tpl,
|
||||
' to %s\n'%db.srv_www_tpl
|
||||
)
|
||||
|
||||
res = ''
|
||||
try:
|
||||
res = input(' ├ Update template ? ')
|
||||
except KeyboardInterrupt:
|
||||
print('')
|
||||
logs.out("255", '', True)
|
||||
|
||||
if not res in ['y', 'Y']:
|
||||
logs.out("255", '', True)
|
||||
form.asking(' ├ %s%s > %s '%(
|
||||
langs.site.uptpl, langs.site.q,
|
||||
dom.srv_www_tpl_d
|
||||
), True)
|
||||
|
||||
# Copy all file in wip server template, except "nofiles"
|
||||
nofiles = (
|
||||
|
@ -178,18 +163,18 @@ def publish_template(option):
|
|||
'sidebar.html'
|
||||
)
|
||||
|
||||
for item in os.listdir(db.srv_wip_tpl):
|
||||
for item in os.listdir(dom.srv_wip_tpl_d):
|
||||
if item.startswith(nofiles):
|
||||
continue
|
||||
|
||||
item_src = '%s%s'%(db.srv_wip_tpl, item)
|
||||
item_dst = '%s%s'%(db.srv_www_tpl, item)
|
||||
item_src = '%s%s'%(dom.srv_wip_tpl_d, item)
|
||||
item_dst = '%s%s'%(dom.srv_www_tpl_d, item)
|
||||
if os.path.isdir(item_src):
|
||||
shutil.copytree(item_src, item_dst, dirs_exist_ok=True)
|
||||
print(' ├ Create dir :', item_dst)
|
||||
logs.out("33", item_dst, False)
|
||||
else:
|
||||
shutil.copy2(item_src, item_dst)
|
||||
print(' ├ Create file:', item_dst)
|
||||
logs.out("32", item_dst, False)
|
||||
|
||||
# Create new file from _configs/ files
|
||||
html.create_sidebar('pub')
|
||||
|
|
|
@ -131,6 +131,8 @@ form_rep = "Replace HTML file"
|
|||
|
||||
check_a = "Check again this article"
|
||||
|
||||
uptpl = "Update directory"
|
||||
|
||||
# Documentation of configuration files
|
||||
#-------------------------------------
|
||||
metas_doc = \
|
||||
|
|
|
@ -132,6 +132,8 @@ form_rep = "Remplacer le fichier HTML"
|
|||
|
||||
check_a = "Vérifier encore l'article"
|
||||
|
||||
uptpl = "Mettre à jour le dossier"
|
||||
|
||||
# Documentation des fichiers de configuration
|
||||
#--------------------------------------------
|
||||
metas_doc = \
|
||||
|
|
Loading…
Reference in New Issue