From a5601062ff107f47e8cd459b09c87a4d6129f00a Mon Sep 17 00:00:00 2001 From: Cyrille L Date: Mon, 26 Dec 2022 11:39:14 +0100 Subject: [PATCH] wip: HTML time tag added to quotes (when registred) + base64 in utf8 --- README.md | 20 ++++++++++++-------- src/var/lib/tyto/program/tyto.py | 8 ++++---- src/var/lib/tyto/program/wip.py | 10 +++++++++- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 695608c..e39d947 100644 --- a/README.md +++ b/README.md @@ -152,6 +152,7 @@ Avec ce NOM. # Placer dans un paragraphe pour chaque ou après "|", # sinon, affichage les une à côté des autres # ! Si pas d'unité pour w= et h= : défaut "px" + _image:Nom _image:Nom c=CSS _image:Nom c=css w=1080 @@ -168,12 +169,12 @@ _brut:NOM ### Citations Possibilité dans toute citation d'utiliser les marqueurs -optionnels _xxx: +optionnels _xxx. Pour la date, utilisez le FORMAT INTERNATIONAL ``` -# Brut: +# Source [[ CSS_TEST _cite: echolib -_date: 2022 +_date: 2022-12-28 _lang: fr _link: https://tyto.echolib.re _book: Référence @@ -182,24 +183,27 @@ Pfff, vraiment ! )) ]] -# Sotie HTML: +# HTML:
-
+
+
- echolib - Reference (2022) + echolib - Reference (2022-12-28)
-# Brut + +# Source [[ Une citation simple, et sans paragraphe ]] -# Sortie HTML +# HTML
Une citation simple, et sans paragraphe
diff --git a/src/var/lib/tyto/program/tyto.py b/src/var/lib/tyto/program/tyto.py index 654dfa5..57b1da4 100644 --- a/src/var/lib/tyto/program/tyto.py +++ b/src/var/lib/tyto/program/tyto.py @@ -417,17 +417,17 @@ def b64(action, content, before, after): if action == 'Encode': global b64_content b64_base64 = '' - content_bytes = content.encode("ascii") + content_bytes = content.encode("utf8") 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 elif action == 'Decode': global src_content src_content = '' - content_bytes = content.encode("ascii") + content_bytes = content.encode("utf8") base64_bytes = base64.b64decode(content_bytes) - src_content = base64_bytes.decode("ascii") + src_content = base64_bytes.decode("utf8") return src_content else: diff --git a/src/var/lib/tyto/program/wip.py b/src/var/lib/tyto/program/wip.py index 28e0043..2647cfa 100644 --- a/src/var/lib/tyto/program/wip.py +++ b/src/var/lib/tyto/program/wip.py @@ -385,23 +385,31 @@ def wip_quotes() : elif book: title_html = ' title="%s"'%(book) elif date: title_html = ' title="(%s)"'%(date) + if date: + time_html_o = '\n' + # Create HTML Quote with datas if author: quote_html = '
\n'%set_css + \ '
\n'%( set_css, lang, cite, title_html ) + \ + ' ' + time_html_o + \ '%s\n'%quote_html + \ + ' ' + time_html_c + \ '
\n' + \ '
\n'%set_css + \ ' %s\n'%figc + \ '
\n' + \ '
' else: - quote_html = '
\n'%( + quote_html ='
\n'%( set_css, lang, cite, title_html ) + \ + time_html_o + \ '%s\n'%quote_html + \ + time_html_c + \ '
' # Replace line with final HTML Quote