updated footer HTML source

This commit is contained in:
Cyrille L 2023-02-28 17:26:08 +01:00
parent 2aaa644d0a
commit 30c6b82fd4
4 changed files with 73 additions and 33 deletions

View File

@ -17,6 +17,7 @@
#**********************************************************************
from datetime import datetime
import os, sys, locale, importlib
import logs, db, tyto, html
@ -218,6 +219,26 @@ def create_domain(target):
tyto.set_file(db.domain_conf, False, set_f)
# Get creation date
#------------------
try: domain_date
except: domain_date = datetime.now().year
ask = ''
try:
ask = input(' ├ Domain creation yeay ? {%s} '%domain_date)
except KeyboardInterrupt:
print('')
logs.out("255", '', True)
if ask:
if not ask.isdigit(): logs.out("3", ask, True)
domain_date = ask
set_f = 'domain_date = "%s"'%domain_date
tyto.set_file(db.domain_conf, False, set_f)
# Get Description domain
#-----------------------
try: domain_about = db.domain_about
@ -229,6 +250,7 @@ def create_domain(target):
except KeyboardInterrupt:
print('')
logs.out("255", '', True)
if ask: domain_about = ask
elif not domain_about: logs.out("255", '', True)
if '"' in domain_about:
@ -248,6 +270,7 @@ def create_domain(target):
except KeyboardInterrupt:
print('')
logs.out("255", '', True)
if ask:
if len(ask) == 2: domain_lang = ask
else: logs.out("3", ask, True)
@ -268,6 +291,7 @@ def create_domain(target):
except KeyboardInterrupt:
print('')
logs.out("255", '', True)
if ask:
if not "@" in ask and not "." in ask: logs.out("3", ask, True)
domain_mail = ask
@ -288,6 +312,7 @@ def create_domain(target):
except KeyboardInterrupt:
print('')
logs.out("255", '', True)
if ask: domain_tags = ask
elif not domain_tags: logs.out("255", '', True)
@ -306,6 +331,7 @@ def create_domain(target):
except KeyboardInterrupt:
print('')
logs.out("255", '', True)
if ask: domain_logo = ask
set_f = 'domain_logo = "%s"\n'%domain_logo + \
@ -326,6 +352,7 @@ def create_domain(target):
except KeyboardInterrupt:
print('')
logs.out("255", '', True)
if ask: domain_license = ask
elif not domain_license: logs.out("255", '', True)
if '"' in domain_license:
@ -346,6 +373,7 @@ def create_domain(target):
except KeyboardInterrupt:
print('')
logs.out("255", '', True)
if ask:
if not ask.startswith('http'): logs.out("3", ask, True)
domain_licurl = ask
@ -365,6 +393,7 @@ def create_domain(target):
except KeyboardInterrupt:
print('')
logs.out("255", '', True)
if ask:
if not ask.isalnum(): logs.out("3", ask, True)
domain_css = ask.lower()
@ -384,6 +413,7 @@ def create_domain(target):
except KeyboardInterrupt:
print('')
logs.out("255", '', True)
if ask:
if not len(ask) == 1: logs.out("3", ask, True)
domain_sep = ask
@ -403,6 +433,7 @@ def create_domain(target):
except KeyboardInterrupt:
print('')
logs.out("255", '', True)
if ask:
if not ask.startswith('http'): logs.out("3", ask, True)
domain_relme = ask
@ -422,6 +453,7 @@ def create_domain(target):
except KeyboardInterrupt:
print('')
logs.out("255", '', True)
if ask: sidebar_title = ask
if '"' in sidebar_title:
sidebar_title = sidebar_title.replace('"', '')
@ -441,6 +473,7 @@ def create_domain(target):
except KeyboardInterrupt:
print('')
logs.out("255", '', True)
if ask:
if not ask.isdigit(): logs.out("3", ask, True)
elif int(ask) in range(1,17): sidebar_items = int(ask)
@ -763,6 +796,20 @@ def create_footer(option):
Tytosrc = '(<a href="%s" '%tyto.Tytogit + \
'title="%s" '%tyto.trans[4][tyto.n] + \
'id="footer_item_link">%s</a>)'%tyto.trans[3][tyto.n]
tyto_show = \
'<a href="%s"'%tyto.Tytoweb + \
'title="%s"'%tyto.trans[5][tyto.n] + \
'class="footer_item_link">%s</a> %s'%(tyto.Tyto, Tytosrc)
if db.domain_date == datetime.now().year:
footer_date = db.domain_date
else:
footer_date = '%s - %s'%(db.domain_date, datetime.now().year)
domain_home = \
'<a href="/" ' + \
'title="%s" '%(tyto.trans[1][tyto.n]) + \
'id="footer_title_link">%s</a>'%db.domain_title
footer = \
'<!-- Default <footer> generated by %s\n'%tyto.Tyto + \
@ -776,31 +823,28 @@ def create_footer(option):
'-->\n' + \
'<footer id="footer_page">\n' + \
' <div id="footer_infos">\n' + \
' <a href="/"\n' + \
' title="%s"\n'%(tyto.trans[1][tyto.n]) + \
' id="footer_title_link">\n' + \
' <h1 id="footer_site_title">%s</h1>\n'%(db.domain_title) + \
' </a>\n' + \
' <h1 id="footer_site_title">%s %s</h1>\n'%(
tyto.trans[11][tyto.n], domain_home
) + \
' <p id="footer_site_about">%s</p>\n'%(db.domain_about) + \
' </div>\n' + \
'\n' + \
' <div id="footer_references">\n' + \
' <ul> id="footer_items"\n' + \
' <li id="footer_item">\n' + \
' <ul class="footer_items">\n' + \
' <li class="footer_item">%s \n'%(tyto.trans[2][tyto.n]) + \
' <a href="%s"\n'%db.domain_licurl + \
' title="%s %s %s"\n'%(
tyto.trans[2][tyto.n],
db.domain_sep, db.domain_title) + \
' id="footer_item_link">%s</a>\n'%(
' class="footer_item_link">%s</a>\n'%(
db.domain_license) + \
' </li>\n' + \
' <li id="footer_item">\n' + \
' <a href="%s"\n'%tyto.Tytoweb + \
' title="%s"\n'%tyto.trans[5][tyto.n] + \
' id="footer_item_link">%s</a> %s\n'%(tyto.Tyto, Tytosrc) + \
' </li>\n' + \
' </ul>\n' + \
' </div>\n' + \
' <div id="footer_cr">\n' + \
' <p>Copyright: %s</p>\n'%footer_date + \
' <p>%s %s</p>\n'%(tyto.trans[12][tyto.n], tyto_show) + \
' </div>\n' + \
'</footer>'
# Create new default file, or ask if exists
@ -818,3 +862,12 @@ def create_footer(option):
tyto.set_file(db.footer_load, 'new', footer)
tyto.create_db_load(db.footer_load, db.footer_load_db)
print(log)
#
"""
' <li class="footer_item">\n' + \
' <a href="%s"\n'%tyto.Tytoweb + \
' title="%s"\n'%tyto.trans[5][tyto.n] + \
' class="footer_item_link">%s</a> %s\n'%(tyto.Tyto, Tytosrc) + \
' </li>\n' + \
"""

View File

@ -522,16 +522,3 @@ def create_user_footer(option):
print(log_load)
'''
' <li id="fotter_item">\n' + \
' <a href="%s"\n' + \
' title="%s"\n' + \
' id="footer_item_link">%s</a>\n'% + \
' </li>\n' + \
Copyright © 2021-2022
'''

View File

@ -50,7 +50,9 @@ trans = [
('écrit par', 'written by'),
('Publié le', 'Published the'), #8 date for section HTML (article_infos)
('à', 'at'), #9 time format
('rédigé le', 'created the')
('rédigé le', 'created the'), #10
('À Propos de', 'About'), #11
('Générateur :', 'Generator:')
]

View File

@ -18,7 +18,7 @@
#**********************************************************************
import os, re, shutil
import logs, args, db, tyto, html
import logs, args, db, tyto, html, domain
#=========================================#
@ -28,17 +28,15 @@ def manage_wip(target):
global post_db, hash_post
# Check if can process
if not db.domain_exists \
or db.incomplete_domain \
or not db.domain_active:
return
domain.domain_needed()
# Target is footer, sidebar, navbar, metas
if target in args.pass_targets:
do = {
'sidebar' : html.create_sidebar,
'navbar' : html.create_navbar,
'metas' : html.create_user_metas
'metas' : html.create_user_metas,
'footer' : html.create_user_footer
}
do[target]('wip')