From 5ddd69cfd3dc4ec2be76368ecef1e33eae00fbec Mon Sep 17 00:00:00 2001 From: Cyrille L Date: Fri, 3 Mar 2023 16:53:12 +0100 Subject: [PATCH] working on publish template command #4 --- src/var/lib/tyto/program/infos.py | 3 ++- src/var/lib/tyto/program/publish.py | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/var/lib/tyto/program/infos.py b/src/var/lib/tyto/program/infos.py index 5e9e3e8..324c59d 100644 --- a/src/var/lib/tyto/program/infos.py +++ b/src/var/lib/tyto/program/infos.py @@ -54,7 +54,8 @@ def tyto(target): ' - Create article\'s file in articles/ directory\n' ' - Use these actions on article\'s file: Check > wip > publish\n' ' ! Config\'s files are in _configs/ directory\n' - ' and used to create HTML file in your template\n\n' + ' and used to create HTML file in your template\n' + ' Your template files (css, logo...) go to wip/template/ server\n\n' '# Usage: tyto [action] [target] \n' ' - [action] according to [target]:\n' ' edit : Edit article\'s file\n' diff --git a/src/var/lib/tyto/program/publish.py b/src/var/lib/tyto/program/publish.py index defd2a1..e5407a8 100644 --- a/src/var/lib/tyto/program/publish.py +++ b/src/var/lib/tyto/program/publish.py @@ -142,10 +142,28 @@ def create_template(option): if not res in ['y', 'Y']: logs.out("255", '', True) + # Create new file from _configs/ files html.create_sidebar('www') html.create_navbar('www') html.create_user_metas('www') html.create_user_footer('www') + + # Copy all file in wip server template, except "nofiles" + nofiles = ( + 'footer.html', + 'metas.html', + 'navbar.html', + 'sidebar.html' + ) + + for item in os.listdir(db.srv_wip_tpl): + if item.startswith(nofiles): + continue + + item_src = '%s%s'%(db.srv_wip_tpl, item) + item_dst = '%s%s'%(db.srv_www_tpl, item) + if shutil.copy2(item_src, item_dst): + print(' ├ Create file:', item_dst) #================================# # Publish template in www server #