publish template (ok). lang site updated

This commit is contained in:
Cyrille L 2023-04-04 11:17:37 +02:00
parent 99389285b0
commit 576213ecfc
3 changed files with 14 additions and 25 deletions

View File

@ -35,7 +35,7 @@
import os, sys, shutil, importlib import os, sys, shutil, importlib
from pathlib import Path 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 # # Manage action, get post db #
@ -150,25 +150,10 @@ def replace_lines_pub():
# Publish template in www server # # Publish template in www server #
#--------------------------------# #--------------------------------#
def publish_template(option): def publish_template(option):
print( \ form.asking('%s%s > %s '%(
'! Note:\n', langs.site.uptpl, langs.site.q,
' - footer, sidebar, metas, navbar\n', dom.srv_www_tpl_d
' will be generated and REPLACED from configuration files\n', ), True)
' 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)
# Copy all file in wip server template, except "nofiles" # Copy all file in wip server template, except "nofiles"
nofiles = ( nofiles = (
@ -178,18 +163,18 @@ def publish_template(option):
'sidebar.html' '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): if item.startswith(nofiles):
continue continue
item_src = '%s%s'%(db.srv_wip_tpl, item) item_src = '%s%s'%(dom.srv_wip_tpl_d, item)
item_dst = '%s%s'%(db.srv_www_tpl, item) item_dst = '%s%s'%(dom.srv_www_tpl_d, item)
if os.path.isdir(item_src): if os.path.isdir(item_src):
shutil.copytree(item_src, item_dst, dirs_exist_ok=True) shutil.copytree(item_src, item_dst, dirs_exist_ok=True)
print(' ├ Create dir :', item_dst) logs.out("33", item_dst, False)
else: else:
shutil.copy2(item_src, item_dst) shutil.copy2(item_src, item_dst)
print(' ├ Create file:', item_dst) logs.out("32", item_dst, False)
# Create new file from _configs/ files # Create new file from _configs/ files
html.create_sidebar('pub') html.create_sidebar('pub')

View File

@ -131,6 +131,8 @@ form_rep = "Replace HTML file"
check_a = "Check again this article" check_a = "Check again this article"
uptpl = "Update directory"
# Documentation of configuration files # Documentation of configuration files
#------------------------------------- #-------------------------------------
metas_doc = \ metas_doc = \

View File

@ -132,6 +132,8 @@ form_rep = "Remplacer le fichier HTML"
check_a = "Vérifier encore l'article" check_a = "Vérifier encore l'article"
uptpl = "Mettre à jour le dossier"
# Documentation des fichiers de configuration # Documentation des fichiers de configuration
#-------------------------------------------- #--------------------------------------------
metas_doc = \ metas_doc = \