html: in-dev template files

This commit is contained in:
Cyrille L 2022-11-24 00:56:55 +01:00
parent b565238eea
commit f2d1f341dd
1 changed files with 33 additions and 21 deletions

View File

@ -19,15 +19,19 @@
import re, os import re, os
import check, log, domain import check, log, domain
Tyto = 'Tyto - Littérateur'
tytogen = 'https://git.a-lec.org/echolib/tyto-litterateur'
tytourl = 'https://tyto.echolib.re'
trans = [ trans = [
[ 'Licence', 'License' ], # 0 [ 'Licence', 'License' ], # 0
[ 'Générateur', 'Generator' ], # 1 [ 'Générateur', 'Generator' ], # 1
[ 'À propos de', 'About' ], # 2 [ 'À propos de', 'About' ], # 2
[ 'Envoyer un courriel à', 'Send a mail to' ], # 3 [ 'Envoyer un courriel à', 'Send a mail to' ], # 3
[ 'Détails de la licence', 'License\'s details'], # 4 [ 'Détails de la licence', 'License\'s details'], # 4
[ 'Courriel', 'Mail' ], # 5 [ 'Courriel', 'Mail' ], # 5
[ 'Site web généré par', 'Website generated by'], # 6 [ 'Site web généré par %s'%Tyto, 'Website generated by %s'%Tyto ], # 6
[ 'Syndication de', 'Syndication of' ] # 7 [ 'Syndication de', 'Syndication of' ], # 7
[ 'Site officiel de %s'%Tyto, 'Official website of %s'%Tyto ] # 8
] ]
#=======================================# #=======================================#
@ -71,7 +75,6 @@ def html_main_page(wip_html):
# Check here for template files # Check here for template files
files_uri = ( files_uri = (
'%s%s'%(domain.srv_wip, f_rss[1:len(f_rss)]),
'%s%s'%(domain.srv_wip, icon[1:len(icon)]), '%s%s'%(domain.srv_wip, icon[1:len(icon)]),
'%s%s'%(domain.srv_wip, f_css[1:len(f_css)]), '%s%s'%(domain.srv_wip, f_css[1:len(f_css)]),
'%s%s'%(domain.srv_wip, logo[1:len(logo)]) '%s%s'%(domain.srv_wip, logo[1:len(logo)])
@ -100,7 +103,7 @@ def html_main_page(wip_html):
'<meta name="language" content="%s">\n'%domain.domain_lang + \ '<meta name="language" content="%s">\n'%domain.domain_lang + \
'<meta name="reply-to" content="%s">\n'%domain.domain_mail + \ '<meta name="reply-to" content="%s">\n'%domain.domain_mail + \
'<meta name="copyright" content="%s">\n'%domain.domain_license + \ '<meta name="copyright" content="%s">\n'%domain.domain_license + \
'<meta name="generator" content="Tyto - Littérateur">\n' + \ '<meta name="generator" content="%s">\n'%Tyto + \
'<meta name="title" content="%s">\n'%title + \ '<meta name="title" content="%s">\n'%title + \
'<meta name="author" content="%s">\n'%post_author + \ '<meta name="author" content="%s">\n'%post_author + \
'<meta name="description" content="%s">\n'%post_about + \ '<meta name="description" content="%s">\n'%post_about + \
@ -140,7 +143,9 @@ def html_main_page(wip_html):
' </div>\n' + \ ' </div>\n' + \
'</header>\n' '</header>\n'
# Article (in section, including aside) # Article (in section, including aside)
#--------------------------------------
articles = '<section id="page-wrapper">\n' + \ articles = '<section id="page-wrapper">\n' + \
' <article id="article_%s" class="%s">\n'%( ' <article id="article_%s" class="%s">\n'%(
post_ID, domain.domain_css post_ID, domain.domain_css
@ -168,9 +173,9 @@ def html_main_page(wip_html):
' </div>\n' + \ ' </div>\n' + \
'</aside>' '</aside>'
# Footer, and of page # Footer, and of page
#-------------------- #--------------------
tytogen = 'https://git.a-lec.org/echolib/tyto-litterateur'
footers = '<footer id="footer">\n' + \ footers = '<footer id="footer">\n' + \
' <h1 id="footer-title">%s %s</h1>\n'%( ' <h1 id="footer-title">%s %s</h1>\n'%(
trans[2][fl], domain.domain_title) + \ trans[2][fl], domain.domain_title) + \
@ -199,22 +204,27 @@ def html_main_page(wip_html):
domain.domain_license domain.domain_license
) + \ ) + \
' </li>\n' + \ ' </li>\n' + \
' <li class="site-list"><abbr title="Really Simple Syndication">RSS</abbr>: \n' + \ ' <li class="site-list">\n' + \
' <a id="site-rss" href="/rss.xml"\n' +\ ' <abbr title="Really Simple Syndication">RSS</abbr>: \n' + \
' <a id="site-rss" href="/rss.xml"\n' + \
' type="application/rss+xml"' + \
' title="%s %s">/rss.xml</a>\n'%( ' title="%s %s">/rss.xml</a>\n'%(
trans[7][fl], domain.domain_title trans[7][fl], domain.domain_title
) + \ ) + \
' </li>\n' + \ ' </li>\n' + \
' <li class="site-list">%s: \n'%trans[1][fl] + \ ' <li class="site-list">%s: \n'%trans[1][fl] + \
' <a id="tytogen" href="%s"\n'%tytogen +\ ' <a id="tytourl" href="%s"\n'%tytourl + \
' type="application/rss+xml"\n' + \ ' title="%s">%s</a> \n'%(trans[6][fl], Tyto) + \
' title="%s Tyto - Littérateur">Tyto - Littérateur</a>\n'%trans[6][fl] + \ ' <a id="tytogen" href="%s"\n'%tytogen + \
' title="%s">(Code)</a>\n'%(trans[8][fl]) + \
' </li>\n' + \ ' </li>\n' + \
' </ul>\n' + \ ' </ul>\n' + \
' </div>\n' + \ ' </div>\n' + \
'</footer>' '</footer>'
# Create file if not exists # Create file if not exists
#--------------------------
files_tpl = [ files_tpl = [
[ '%smetas.html'%domain.srv_wip_template, metas ], [ '%smetas.html'%domain.srv_wip_template, metas ],
[ '%sheader.html'%domain.srv_wip_template, headers ], [ '%sheader.html'%domain.srv_wip_template, headers ],
@ -240,7 +250,9 @@ def html_main_page(wip_html):
page = '%s\n%s%s'%(page, 6*' ', meta) page = '%s\n%s%s'%(page, 6*' ', meta)
page = '%s\n%s</head>\n'%(page, 4*' ') + \ page = '%s\n%s</head>\n'%(page, 4*' ') + \
'%s\n <body id="%s" class="%s">'%(4*' ', post_ID, domain.domain_css) '\n%s<body id="%s" class="%s">'%(
4*' ', post_ID, domain.domain_css
)
# Add tab header in page # Add tab header in page
for header in headers.rsplit('\n'): for header in headers.rsplit('\n'):
@ -266,5 +278,5 @@ def html_main_page(wip_html):
for footer in footers.rsplit('\n'): for footer in footers.rsplit('\n'):
page = '%s\n%s%s'%(page, 4*' ', footer) page = '%s\n%s%s'%(page, 4*' ', footer)
#print(page) print(page)