footer: user defines custom domain_footer_about in domain configuration file

This commit is contained in:
Cyrille L 2023-03-02 12:15:31 +01:00
parent 58adeed186
commit 0edcd4609b
2 changed files with 37 additions and 21 deletions

View File

@ -100,6 +100,7 @@ domain_values = \
'www_sidebar',
'www_metas',
'www_footer',
'domain_footer_about',
'domain_active',
)

View File

@ -21,16 +21,6 @@ from datetime import datetime
import os, sys, locale, importlib
import logs, db, tyto, html
#----------------------------------------------------------------------
# Optional
# This variable, if not empty, will be used in website footer
# and will replace defaut content of domain_about
# Put in any HTML you want but,
# note: content is already in <p></p>
#----------------------------------------------------------------------
domain_footer_about = \
'Un petit essai'
#==========================#
# Manage Argument 'domain' #
@ -530,6 +520,19 @@ def create_domain(target):
set_f = 'sidebar_items = %d'%sidebar_items
tyto.set_file(db.domain_conf, False, set_f)
# Create domain_footer_about (user custom description in footer)
#---------------------------------------------------------------
try:
domain_footer_about = db.domain_footer_about
set_f = '\n# Custom HTML (ONE Line)\n' + \
"domain_footer_about = '%s'"%domain_footer_about
except:
domain_about = db.domain_about
set_f = '\n# Custom HTML (ONE Line)\n' + \
"domain_footer_about = '<p>%s</p>'"%domain_about
tyto.set_file(db.domain_conf, False, set_f)
# Activate Domain after Resumed configuration ?
#----------------------------------------------
@ -854,11 +857,12 @@ def create_footer(option):
if not res in ['y', 'Y']: return
# Default footer contents
Tytosrc = '(\n%s<a href="%s"\n'%(6 * ' ', tyto.Tytogit) + \
Tytosrc = \
'\n%s(<a href="%s"\n'%(6 * ' ', tyto.Tytogit) + \
'%stitle="%s"\n'%(9 * ' ', tyto.trans[4][tyto.n]) + \
'%sid="footer_item_link">%s</a>)'%(9 * ' ', tyto.trans[3][tyto.n])
tyto_show = \
'\n%s<a href="%s"\n'%(6 * ' ', tyto.Tytoweb) + \
'%s<a href="%s"\n'%(6 * ' ', tyto.Tytoweb) + \
'%stitle="%s"\n'%(9 * ' ', tyto.trans[5][tyto.n]) + \
'%sclass="footer_item_link">%s</a> %s'%(9 * ' ', tyto.Tyto, Tytosrc)
@ -874,8 +878,13 @@ def create_footer(option):
'%stitle="%s"\n'%(9 * ' ',tyto.trans[1][tyto.n]) + \
'%sid="footer_title_link">%s</a>'%(9 * ' ', db.domain_title)
# Show domain_HTML_about (if not empty), else domain_about
if domain_footer_about: db.domain_about = domain_footer_about
# Show domain_footer_about
footer_about = ''
for line in db.domain_footer_about.rsplit('\n'):
if not line: continue
line = '%s%s'%(6 * ' ', line)
if footer_about: footer_about = '%s\n%s'%(footer_about, line)
else: footer_about = line
# License URL
if not db.domain_licurl: db.domain_licurl = '/'
@ -884,8 +893,12 @@ def create_footer(option):
if db.domain_legalurl:
legal_link = \
'<a href="%s"\n'%db.domain_termsurl + \
'%stitle="%s %s"\n'%(11 * ' ', tyto.trans[16][tyto.n], db.domain_title) + \
'%sclass="footer_item_link">%s</a>'%(11 * ' ', tyto.trans[16][tyto.n])
'%stitle="%s %s"\n'%(
11 * ' ', tyto.trans[16][tyto.n], db.domain_title
) + \
'%sclass="footer_item_link">%s</a>'%(
11 * ' ', tyto.trans[16][tyto.n]
)
if db.domain_termsurl:
terms_link = \
@ -925,7 +938,7 @@ def create_footer(option):
tyto.trans[11][tyto.n], domain_home
) + \
' </h1>\n' + \
' <p id="footer_site_about">%s</p>\n'%(db.domain_about) + \
'%s\n'%(footer_about) + \
' </div>\n' + \
'\n' + \
' <div id="footer_references">\n' + \
@ -952,7 +965,9 @@ def create_footer(option):
' </div>\n' + \
' <div id="footer_credits">\n' + \
' <p>Copyright: %s %s</p>\n'%(footer_date, db.domain_title) + \
' <p>%s %s</p>\n'%(tyto.trans[12][tyto.n], tyto_show) + \
' <p>%s \n'%tyto.trans[12][tyto.n] + \
'%s\n'%tyto_show + \
' </p>\n' + \
' </div>\n' + \
'</footer>'