post_db. Changes in html.py

This commit is contained in:
Cyrille L 2023-02-07 15:02:37 +01:00
parent 796a580507
commit fab895ec6b
2 changed files with 19 additions and 19 deletions

View File

@ -52,9 +52,7 @@ def manage_configs(target, option):
# Load article DB # # Load article DB #
# Start HTML page sections # # Start HTML page sections #
#--------------------------# #--------------------------#
def set_page(post_db, target, article_bottom): def set_page(target, article_bottom):
exec(open(post_db).read(),globals())
create_metas_page() # Include metas tags create_metas_page() # Include metas tags
create_main_page(target, article_bottom) # Create main page create_main_page(target, article_bottom) # Create main page
@ -69,20 +67,20 @@ def create_metas_page():
#------------------- #-------------------
metas_page = '' metas_page = ''
scale = 'width=device-width, initial-scale=1.0' scale = 'width=device-width, initial-scale=1.0'
all_tags = db.domain_tags + ',' + tags all_tags = db.domain_tags + ',' + db.tags
css_file = 'template/style.css' css_file = 'template/style.css'
css_ref = 'media="screen" href="%s%s"'%(sub_uri, css_file) css_ref = 'media="screen" href="%s%s"'%(db.sub_uri, css_file)
rss_file = 'rss.xml' rss_file = 'rss.xml'
rss_ref = 'type="application/rss+xml" ' + \ rss_ref = 'type="application/rss+xml" ' + \
'href="%s%s" title="RSS 2.0. %s %s %s'%( 'href="%s%s" title="RSS 2.0. %s %s %s'%(
sub_uri, rss_file, db.sub_uri, rss_file,
db.domain_title, db.domain_sep, db.domain_short db.domain_title, db.domain_sep, db.domain_short
) )
icon_file = 'favicon.png' icon_file = 'favicon.png'
icon_ref = 'type="image/png" href="%stemplate/%s"'%( icon_ref = 'type="image/png" href="%stemplate/%s"'%(
sub_uri, icon_file db.sub_uri, icon_file
) )
en_date = tyto.set_en_date(date[0]) en_date = tyto.set_en_date(db.date[0])
relme = '' # External URL in metas (if exists in config domain) relme = '' # External URL in metas (if exists in config domain)
if db.domain_relme: if db.domain_relme:
relme = '\n <link rel="me" type="text/html" href="%s">'%( relme = '\n <link rel="me" type="text/html" href="%s">'%(
@ -100,25 +98,25 @@ def create_metas_page():
' <meta name="reply-to" content="%s" />\n'%db.domain_mail + \ ' <meta name="reply-to" content="%s" />\n'%db.domain_mail + \
' <meta name="copyright" content="%s" />\n'%db.domain_license + \ ' <meta name="copyright" content="%s" />\n'%db.domain_license + \
' <meta name="generator" content="%s" />\n'%tyto.Tyto + \ ' <meta name="generator" content="%s" />\n'%tyto.Tyto + \
' <meta name="title" content="%s" />\n'%title + \ ' <meta name="title" content="%s" />\n'%db.title + \
' <meta name="author" content="%s" />\n'%author + \ ' <meta name="author" content="%s" />\n'%db.author + \
' <meta name="description" content="%s" />\n'%about + \ ' <meta name="description" content="%s" />\n'%db.about + \
' <meta name="keywords" content="%s" />\n'%all_tags + \ ' <meta name="keywords" content="%s" />\n'%all_tags + \
' <meta name="search_date" content="%s" />\n'%en_date + \ ' <meta name="search_date" content="%s" />\n'%en_date + \
' <link rel="canonical" href="%s" />\n'%http_www + \ ' <link rel="canonical" href="%s" />\n'%db.http_www + \
' <link rel="alternate" %s />\n'%(rss_ref) + \ ' <link rel="alternate" %s />\n'%(rss_ref) + \
' <link rel="stylesheet" %s />\n'%css_ref + \ ' <link rel="stylesheet" %s />\n'%css_ref + \
' <link rel="shortcut icon" %s />\n'%icon_ref + \ ' <link rel="shortcut icon" %s />\n'%icon_ref + \
' <!-- Open Graph data -->\n' + \ ' <!-- Open Graph data -->\n' + \
' <meta property="og:site_name" content="%s" />\n'%db.domain_title + \ ' <meta property="og:site_name" content="%s" />\n'%db.domain_title + \
' <meta property="og:title" content="%s" />\n'%title + \ ' <meta property="og:title" content="%s" />\n'%db.title + \
' <meta property="og:type" content="article" />\n' + \ ' <meta property="og:type" content="article" />\n' + \
' <meta property="og:url" content="%s" />\n'%http_www + \ ' <meta property="og:url" content="%s" />\n'%db.http_www + \
' <meta property="og:description" content="%s" />\n'%about + \ ' <meta property="og:description" content="%s" />\n'%db.about + \
' <meta property="og:image" content="%s" />\n'%snpic + \ ' <meta property="og:image" content="%s" />\n'%db.snpic + \
'%s'%relme + \ '%s'%relme + \
'<!--# include virtual="/template/metas.html"-->\n' + \ '<!--# include virtual="/template/metas.html"-->\n' + \
' <title>%s</title>'%title ' <title>%s</title>'%db.title
#=======================================# #=======================================#
@ -140,7 +138,9 @@ def create_main_page(target, article_bottom):
tyto.trans[1][tyto.n], db.domain_sep, db.domain_title tyto.trans[1][tyto.n], db.domain_sep, db.domain_title
) + \ ) + \
'%sid="site_logo_link">\n'%(11 * " ") + \ '%sid="site_logo_link">\n'%(11 * " ") + \
'%s<img src="%stemplate/%s"\n'%(10 * " ", sub_uri, db.domain_logo) + \ '%s<img src="%stemplate/%s"\n'%(
10 * " ", db.sub_uri, db.domain_logo
) + \
'%salt="logo: %s"\n'%(15 * " ", db.domain_title) + \ '%salt="logo: %s"\n'%(15 * " ", db.domain_title) + \
'%sid="site_logo_image" />\n'%(15 * " ") + \ '%sid="site_logo_image" />\n'%(15 * " ") + \
'%s</a>'%(8 * " ") '%s</a>'%(8 * " ")

View File

@ -115,7 +115,7 @@ def wip_article(target):
tyto.replace_in_db(db.post_db, 'wip', db.hash_post) tyto.replace_in_db(db.post_db, 'wip', db.hash_post)
# Get article DB in html.py # Get article DB in html.py
html.set_page(db.post_db, db.uri_file, article_bottom) html.set_page(db.uri_file, article_bottom)
#print(html.main_page) #print(html.main_page)
# Create wip file # Create wip file