diff --git a/src/var/lib/tyto/program/domain.py b/src/var/lib/tyto/program/domain.py
index 30c80da..bba8e5b 100644
--- a/src/var/lib/tyto/program/domain.py
+++ b/src/var/lib/tyto/program/domain.py
@@ -429,16 +429,14 @@ def create_domain(target, option):
if not os.makedirs(folder, exist_ok=True):
print(' │ Exists directory: %s'%folder)
- # Create tyto.sidebar and metas.html
+ # Create in _configs files
+ # Force will ask to create in template
print(' │')
- create_sidebar(option)
- html.manage_configs('sidebar', '-n')
- create_navbar(option)
- html.manage_configs('navbar', '-n')
- create_metas_file(option)
- html.manage_configs('metas', '-n')
- html.create_footer(option)
- html.manage_configs('footer', '-n')
+ #create_sidebar(option)
+ #html.manage_configs('sidebar', 'Force')
+ #html.manage_configs('navbar', 'Force')
+ #html.manage_configs('metas', 'Force')
+ html.manage_configs('footer', 'Force')
print(' │')
print(' ├──────────────────────────────────────┐')
diff --git a/src/var/lib/tyto/program/html.py b/src/var/lib/tyto/program/html.py
index f1a0414..a1160fc 100644
--- a/src/var/lib/tyto/program/html.py
+++ b/src/var/lib/tyto/program/html.py
@@ -41,8 +41,8 @@ navbar_file = '%snavbar.html'%srv_wip_tpl
def manage_configs(target, option):
args1 = ('metas', 'sidebar', 'footer', 'navbar')
- args2 = ('-n', '-e', '-R')
- opts = ('New', 'Edit', 'Remove')
+ args2 = ('-n', '-e', '-F', )
+ opts = ('New', 'Edit', 'Force')
if target in args1: sys.argv[1] = target
elif target and not option: option = target
@@ -51,15 +51,15 @@ def manage_configs(target, option):
tyto.exiting('11', '%s'%str(args2), True)
# Getting default file
- if option == 'New':
- actions = {
- 'sidebar' : domain.create_sidebar,
- 'navbar' : domain.create_navbar,
- 'metas' : create_user_metas,
- 'footer' : html.create_footer
- }
- actions[sys.argv[1]](option)
+ actions = {
+ 'sidebar' : domain.create_sidebar,
+ 'navbar' : domain.create_navbar,
+ 'metas' : create_user_metas,
+ 'footer' : create_footer
+ }
+
+ actions[sys.argv[1]](option)
#==========================#
@@ -101,37 +101,36 @@ def create_metas_page():
domain_relme
)
-
# Set all raw HTML metas
#-----------------------
global metas
- metas = ' \n' + \
- ' \n'%scale + \
- ' \n'%domain_url + \
- ' \n'%domain_lang + \
- ' \n'%domain_mail + \
- ' \n'%domain_license + \
- ' \n'%Tyto + \
- ' \n'%title + \
- ' \n'%author + \
- ' \n'%about + \
- ' \n'%all_tags + \
- ' \n'%en_date + \
- ' \n'%post_url + \
- ' \n'%(rss_ref) + \
- ' '%icon_ref + \
- ' \n' + \
- ' \n'%domain_title + \
- ' \n'%title + \
- ' \n' + \
- ' \n'%post_url + \
- ' \n' + \
- ' \n' + \
- '%s'%relme + \
- '\n\n' + \
- '
%s'%title
-
+ metas = \
+ ' \n' + \
+ ' \n'%scale + \
+ ' \n'%domain_url + \
+ ' \n'%domain_lang + \
+ ' \n'%domain_mail + \
+ ' \n'%domain_license + \
+ ' \n'%Tyto + \
+ ' \n'%title + \
+ ' \n'%author + \
+ ' \n'%about + \
+ ' \n'%all_tags + \
+ ' \n'%en_date + \
+ ' \n'%post_url + \
+ ' \n'%(rss_ref) + \
+ ' '%icon_ref + \
+ ' \n' + \
+ ' \n'%domain_title + \
+ ' \n'%title + \
+ ' \n' + \
+ ' \n'%post_url + \
+ ' \n'%about + \
+ ' \n' + \
+ '%s'%relme + \
+ '\n\n' + \
+ ' %s'%title
#=======================================#
@@ -158,35 +157,36 @@ def create_main_page(target, article_bottom):
#-----------------------#
# Create main HTML Page #
#-----------------------#
- main_page = '\n' + \
- '\n'%domain_lang + \
- ' \n' + \
- '%s\n'%metas + \
- ' \n\n' + \
- ' \n' + \
- ' \n' + \
- '\n' + \
- ' \n' + \
- '%s\n'%article_bottom + \
- ' \n' + \
- '\n' + \
- '\n' + \
- ' \n' + \
- ''
+ main_page = \
+ '\n' + \
+ '\n'%domain_lang + \
+ ' \n' + \
+ '%s\n'%metas + \
+ ' \n\n' + \
+ ' \n' + \
+ ' \n' + \
+ '\n' + \
+ ' \n' + \
+ '%s\n'%article_bottom + \
+ ' \n' + \
+ '\n' + \
+ '\n' + \
+ ' \n' + \
+ ''
footer_file = '%sfooter.html'%srv_wip_tpl
if not os.path.exists(footer_file):
@@ -244,9 +244,9 @@ def create_navbar(option, target):
tyto.set_file(navbar_file, 'new', menu_html)
-#
-# Create metas.html from tyto.metas.html
-#
+#========================================#
+# Create metas.html from tyto.metas.html #
+#----------------------------------------#
def create_user_metas(option):
domain.create_metas_file("-i") # Ensure config file exists
@@ -279,50 +279,90 @@ def create_footer(option):
domain_licurl = "/"
# Default footer contents
- footer = '\n'
+ footer = \
+ '\n'%Tyto + \
+ ''
# Create new file, or ask if exists
- ask = ' ├ Use default footer.html ? '
- log = ' ├ Create file: %s'%footer_load
+ ask_load = ' ├ Use default _configs/tyto.footer.html ? '
+ log_load = ' ├ Create file: %s'%footer_load
+ create_load = True
+
+ footer_html = '%sfooter.html'%srv_wip_tpl
+ ask_html = ' ├ Replace template/footer.html ' + \
+ 'from _configs/tyto.footer.html ? '
+ log_html = ' ├ Create file: %s'%footer_html
+ create_html = True
+ user_footer = ''
+
+
+ # Auto create if not tyto.footer.html in _configs
+ # Pass if exists, user not wants, option is 'New' (only footer.html)
+ res = ''
+ if os.path.exists(footer_load):
+ if option == 'New':
+ create_load = False
+ else:
+ res = input(ask_load)
+ if not res in ['y', 'Y']: create_load = False
+
+ if create_load:
+ tyto.set_file(footer_load, 'new', footer)
+ print(log_load)
- if os.path.exists(footer_load):
- if option == '-i': return
- res = input(ask)
- if not res in ['y', 'Y']: return
- tyto.set_file(footer_load, 'new', footer)
- print(log)
+ # Auto create if not footer.html in template/
+ # Create if option is 'New'
+ res = ''
+ if os.path.exists(footer_html):
+ if option == 'New':
+ create_html = True
+ else:
+ res = input(ask_html)
+ if not res in ['y', 'Y']: create_html = False
+ if create_html:
+ user_file = open(footer_load, 'r').read()
+
+ for line in user_file.rsplit('\n'):
+ if not line: continue
+ if user_footer: user_footer = "%s\n %s"%(user_footer, line)
+ else: user_footer = ' %s'%line
+
+ tyto.set_file(footer_html, 'new', user_footer)
+ print(log_html)
+
+
+
+
'''
' \n' + \
'