wip: HTML time tag added to quotes (when registred) + base64 in utf8

This commit is contained in:
Cyrille L 2022-12-26 11:39:14 +01:00
parent 1a14dbb2a9
commit a5601062ff
3 changed files with 25 additions and 13 deletions

View File

@ -152,6 +152,7 @@ Avec ce NOM.
# Placer dans un paragraphe pour chaque ou après "|", # Placer dans un paragraphe pour chaque ou après "|",
# sinon, affichage les une à côté des autres # sinon, affichage les une à côté des autres
# ! Si pas d'unité pour w= et h= : défaut "px" # ! Si pas d'unité pour w= et h= : défaut "px"
_image:Nom _image:Nom
_image:Nom c=CSS _image:Nom c=CSS
_image:Nom c=css w=1080 _image:Nom c=css w=1080
@ -168,12 +169,12 @@ _brut:NOM
### Citations ### Citations
Possibilité dans toute citation d'utiliser les marqueurs Possibilité dans toute citation d'utiliser les marqueurs
optionnels _xxx: optionnels _xxx. Pour la date, utilisez le FORMAT INTERNATIONAL
``` ```
# Brut: # Source
[[ CSS_TEST [[ CSS_TEST
_cite: echolib _cite: echolib
_date: 2022 _date: 2022-12-28
_lang: fr _lang: fr
_link: https://tyto.echolib.re _link: https://tyto.echolib.re
_book: Référence _book: Référence
@ -182,24 +183,27 @@ Pfff, vraiment !
)) ))
]] ]]
# Sotie HTML: # HTML:
<figure class="CSS_TEST"> <figure class="CSS_TEST">
<blockquote class="CSS_TEST" lang="fr" cite="https://tyto.echolib.re" title="echolib - Reference (2022)"> <blockquote class="CSS_TEST" lang="fr" cite="https://tyto.echolib.re" title="echolib - Reference (2022-12-28)">
<time datetime="2022-12-28">
<p class="tyto"> <p class="tyto">
Pfff, vraiment ! Pfff, vraiment !
</p> </p>
</time>
</blockquote> </blockquote>
<figcaption class="CSS_TEST"> <figcaption class="CSS_TEST">
<a class="figc" href="https://tyto.echolib.re">echolib - Reference (2022)</a> <a class="figc" href="https://tyto.echolib.re">echolib - Reference (2022-12-28)</a>
</figcaption> </figcaption>
</figure> </figure>
# Brut
# Source
[[ [[
Une citation simple, et sans paragraphe Une citation simple, et sans paragraphe
]] ]]
# Sortie HTML # HTML
<blockquote class="tyto"> <blockquote class="tyto">
Une citation simple, et sans paragraphe Une citation simple, et sans paragraphe
</blockquote> </blockquote>

View File

@ -417,17 +417,17 @@ def b64(action, content, before, after):
if action == 'Encode': if action == 'Encode':
global b64_content global b64_content
b64_base64 = '' b64_base64 = ''
content_bytes = content.encode("ascii") content_bytes = content.encode("utf8")
base64_bytes = base64.b64encode(content_bytes) base64_bytes = base64.b64encode(content_bytes)
b64_content = before + base64_bytes.decode("ascii") + after b64_content = before + base64_bytes.decode("utf8") + after
return b64_content return b64_content
elif action == 'Decode': elif action == 'Decode':
global src_content global src_content
src_content = '' src_content = ''
content_bytes = content.encode("ascii") content_bytes = content.encode("utf8")
base64_bytes = base64.b64decode(content_bytes) base64_bytes = base64.b64decode(content_bytes)
src_content = base64_bytes.decode("ascii") src_content = base64_bytes.decode("utf8")
return src_content return src_content
else: else:

View File

@ -385,13 +385,19 @@ def wip_quotes() :
elif book: title_html = ' title="%s"'%(book) elif book: title_html = ' title="%s"'%(book)
elif date: title_html = ' title="(%s)"'%(date) elif date: title_html = ' title="(%s)"'%(date)
if date:
time_html_o = '<time datetime="%s">\n'%date
time_html_c = '</time>\n'
# Create HTML Quote with datas # Create HTML Quote with datas
if author: if author:
quote_html = '<figure class="%s">\n'%set_css + \ quote_html = '<figure class="%s">\n'%set_css + \
' <blockquote class="%s"%s%s%s>\n'%( ' <blockquote class="%s"%s%s%s>\n'%(
set_css, lang, cite, title_html set_css, lang, cite, title_html
) + \ ) + \
' ' + time_html_o + \
'%s\n'%quote_html + \ '%s\n'%quote_html + \
' ' + time_html_c + \
' </blockquote>\n' + \ ' </blockquote>\n' + \
' <figcaption class="%s">\n'%set_css + \ ' <figcaption class="%s">\n'%set_css + \
' %s\n'%figc + \ ' %s\n'%figc + \
@ -401,7 +407,9 @@ def wip_quotes() :
quote_html ='<blockquote class="%s"%s%s%s>\n'%( quote_html ='<blockquote class="%s"%s%s%s>\n'%(
set_css, lang, cite, title_html set_css, lang, cite, title_html
) + \ ) + \
time_html_o + \
'%s\n'%quote_html + \ '%s\n'%quote_html + \
time_html_c + \
'</blockquote>' '</blockquote>'
# Replace line with final HTML Quote # Replace line with final HTML Quote