This commit is contained in:
Cyrille L 2023-12-31 12:14:35 +01:00
parent 42bf32c640
commit b6686a0ebd
6 changed files with 82 additions and 41 deletions

View File

@ -10,8 +10,12 @@ Tyto - Littérateur
# CURRENTLY IN DEV (in devel branch) !
## [1.9.54]
- update (work in progress) tpl_files/styles.css default doc references
- fix + updated "code:" and bcode "{{...}}" CSS classes output HTML
## [1.9.53]
- Imroving output HTML
- Improving output HTML
- TOC is now <nav aria-labelledby="navigation-0">
- update (work in progress) tpl_files/styles.css default doc references

View File

@ -41,7 +41,12 @@ link: le site est prêt
https://forge.a-lec.org
La forge libre
code: MyPY
@code1.py
Test d'ajout de code depuis un fichier
-----
! TOC
#1 Titre 1
((
@ -65,7 +70,7 @@ link: le site est prêt
)"
#2 Code (bloc)
{{
{{ wrds_tags
# Écrire les marqueurs de mots
# Chaque marqueur à la classe CSS de la configuration
# Astuce : ** + ← + `` + ← + très gras
@ -107,11 +112,12 @@ link: le site est prêt
= Troisième entrée ...
... non ordonnée
)=
::MyPY
```
## Output HTML
```
<body>
<div id="site_container">
<!--# include virtual="/template/header.html"-->
@ -120,7 +126,7 @@ link: le site est prêt
<main id="article_sidebar"> <!-- Contains <article> and <aside> -->
<article id="article">
<time datetime="2023-12-27 17:45:57">
<time datetime="2023-12-31 12:10:19">
<header id="article_header">
<h1 id="article_title">
<a id="article_title_link" href="https://tyto.echolib.re/test.html" title="Tests -- echolib, 28/02/2023">Tests</a>
@ -129,44 +135,55 @@ link: le site est prêt
echolib, 28/02/2023 [<a id="post_code" class="tyto" href="./test.tyto" title="Code source : Tests">Code source</a>]
</div>
</header>
<h2 id="toc_4" class="tyto">Titre 1</h2>
<h2 class="toc_title">Table des matières</h2>
<nav class="toc" aria-labelledby="navigation-0">
<ul class="toc_items">
<li class="toc_item"><a class="toc_item_link tyto" href="#toc_1">Titre 1</a></li>
<ul>
<li class="toc_item"><a class="toc_item_link tyto" href="#toc_2">Citation</a></li>
<li class="toc_item"><a class="toc_item_link tyto" href="#toc_3">Code (bloc)</a></li>
<li class="toc_item"><a class="toc_item_link tyto" href="#toc_4">Une liste</a></li>
</ul>
</ul>
</nav>
<h2 id="toc_1" class="tyto">Titre 1</h2>
<p class="tyto">
Un peu de <abbr class="tyto" title="Cascading SteelSheet" lang="en">CSS</abbr> et <a class="tyto" href="https://forge.a-lec.org" title="La forge libre">le site est prêt</a>
<p class="note">
Cet article est un test
</p>
</p>
<h3 id="toc_4" class="tyto">Citation</h3>
<h3 id="toc_2" class="tyto">Citation</h3>
<blockquote class="tyto" cite="https://..." lang="fr" title="-- Auteur, Nom du livre, AAAA-MM-JJ"><time datetime="AAAA-MM-JJ">
<p class="tyto">
Citation complète dans un paragraphe
</p>
</time><footer class="tyto"><a class="tyto" href="https://...">-- Auteur, Nom du livre, AAAA-MM-JJ</a></footer></blockquote>
<h3 id="toc_4" class="tyto">Code (bloc)</h3>
<pre class="bcode">
<code class="bcode"><span class="bcode ln">1</span><span class="bcode line"># Écrire les marqueurs de mots</span></code>
<code class="bcode"><span class="bcode ln">2</span><span class="bcode line"># Chaque marqueur à la classe CSS de la configuration</span></code>
<code class="bcode"><span class="bcode ln">3</span><span class="bcode line"># Astuce : ** + ← + `` + ← + très gras</span></code>
<code class="bcode"><span class="bcode ln">4</span><span class="bcode line"></span></code>
<code class="bcode"><span class="bcode ln">5</span><span class="bcode line">*`très gras`* =&gt; &lt;strong&gt;</span></code>
<code class="bcode"><span class="bcode ln">6</span><span class="bcode line">+`gras`+ =&gt; &lt;b&gt;</span></code>
<code class="bcode"><span class="bcode ln">7</span><span class="bcode line">/`italique`/ =&gt; &lt;em&gt;</span></code>
<code class="bcode"><span class="bcode ln">8</span><span class="bcode line">;`italique`; =&gt; &lt;i&gt;</span></code>
<code class="bcode"><span class="bcode ln">9</span><span class="bcode line">_`souligné`_ =&gt; &lt;u&gt;</span></code>
<code class="bcode"><span class="bcode ln">10</span><span class="bcode line">~`effacé`~ =&gt; &lt;del&gt;</span></code>
<code class="bcode"><span class="bcode ln">11</span><span class="bcode line">[`cité`] =&gt; &lt;q&gt; # Contenu</span></code>
<code class="bcode"><span class="bcode ln">12</span><span class="bcode line">:`cité`: =&gt; &lt;cite&gt; # auteur, nom</span></code>
<code class="bcode"><span class="bcode ln">13</span><span class="bcode line">|`perso`| =&gt; &lt;span&gt;</span></code>
<code class="bcode"><span class="bcode ln">14</span><span class="bcode line"></span></code>
<code class="bcode"><span class="bcode ln">15</span><span class="bcode line"># Code dans un texte</span></code>
<code class="bcode"><span class="bcode ln">16</span><span class="bcode line"># ! Les marqueurs d&apos;ouverture et de fermeture de code sont sur la MEME LIGNE</span></code>
<code class="bcode"><span class="bcode ln">17</span><span class="bcode line"></span></code>
<code class="bcode"><span class="bcode ln">18</span><span class="bcode line">{` &lt;li&gt;Une entée de liste&lt;/li&gt; `} =&gt; &lt;code&gt;</span></code>
<code class="bcode"><span class="bcode ln">19</span><span class="bcode line"></span></code>
<code class="bcode"><span class="bcode ln">20</span><span class="bcode line"># ! Dans certains cas, il faut ajouter un espace après le 1er marqueur</span></code>
<code class="bcode"><span class="bcode ln">21</span><span class="bcode line"># et/ou avant le second. Ils seront automatiquement supprimés</span></code>
<code class="bcode"><span class="bcode ln">22</span><span class="bcode line"></span></code>
<code class="bcode"><span class="bcode ln">23</span><span class="bcode line">*`DOMAIN/articles/ `* # évite /` : marqueur italique ouvert</span></code>
<h3 id="toc_3" class="tyto">Code (bloc)</h3>
<pre class="wrds_tags_pre">
<code class="wrds_tags"><span class="wrds_tags_span wrds_tags_ln">1</span><span class="wrds_tags_span wrds_tags_line"># Écrire les marqueurs de mots</span></code>
<code class="wrds_tags"><span class="wrds_tags_span wrds_tags_ln">2</span><span class="wrds_tags_span wrds_tags_line"># Chaque marqueur à la classe CSS de la configuration</span></code>
<code class="wrds_tags"><span class="wrds_tags_span wrds_tags_ln">3</span><span class="wrds_tags_span wrds_tags_line"># Astuce : ** + ← + `` + ← + très gras</span></code>
<code class="wrds_tags"><span class="wrds_tags_span wrds_tags_ln">4</span><span class="wrds_tags_span wrds_tags_line"></span></code>
<code class="wrds_tags"><span class="wrds_tags_span wrds_tags_ln">5</span><span class="wrds_tags_span wrds_tags_line">*`très gras`* =&gt; &lt;strong&gt;</span></code>
<code class="wrds_tags"><span class="wrds_tags_span wrds_tags_ln">6</span><span class="wrds_tags_span wrds_tags_line">+`gras`+ =&gt; &lt;b&gt;</span></code>
<code class="wrds_tags"><span class="wrds_tags_span wrds_tags_ln">7</span><span class="wrds_tags_span wrds_tags_line">/`italique`/ =&gt; &lt;em&gt;</span></code>
<code class="wrds_tags"><span class="wrds_tags_span wrds_tags_ln">8</span><span class="wrds_tags_span wrds_tags_line">;`italique`; =&gt; &lt;i&gt;</span></code>
<code class="wrds_tags"><span class="wrds_tags_span wrds_tags_ln">9</span><span class="wrds_tags_span wrds_tags_line">_`souligné`_ =&gt; &lt;u&gt;</span></code>
<code class="wrds_tags"><span class="wrds_tags_span wrds_tags_ln">10</span><span class="wrds_tags_span wrds_tags_line">~`effacé`~ =&gt; &lt;del&gt;</span></code>
<code class="wrds_tags"><span class="wrds_tags_span wrds_tags_ln">11</span><span class="wrds_tags_span wrds_tags_line">[`cité`] =&gt; &lt;q&gt; # Contenu</span></code>
<code class="wrds_tags"><span class="wrds_tags_span wrds_tags_ln">12</span><span class="wrds_tags_span wrds_tags_line">:`cité`: =&gt; &lt;cite&gt; # auteur, nom</span></code>
<code class="wrds_tags"><span class="wrds_tags_span wrds_tags_ln">13</span><span class="wrds_tags_span wrds_tags_line">|`perso`| =&gt; &lt;span&gt;</span></code>
<code class="wrds_tags"><span class="wrds_tags_span wrds_tags_ln">14</span><span class="wrds_tags_span wrds_tags_line"></span></code>
<code class="wrds_tags"><span class="wrds_tags_span wrds_tags_ln">15</span><span class="wrds_tags_span wrds_tags_line"># Code dans un texte</span></code>
<code class="wrds_tags"><span class="wrds_tags_span wrds_tags_ln">16</span><span class="wrds_tags_span wrds_tags_line"># ! Les marqueurs d&apos;ouverture et de fermeture de code sont sur la MEME LIGNE</span></code>
<code class="wrds_tags"><span class="wrds_tags_span wrds_tags_ln">17</span><span class="wrds_tags_span wrds_tags_line"></span></code>
<code class="wrds_tags"><span class="wrds_tags_span wrds_tags_ln">18</span><span class="wrds_tags_span wrds_tags_line">{` &lt;li&gt;Une entée de liste&lt;/li&gt; `} =&gt; &lt;code&gt;</span></code>
<code class="wrds_tags"><span class="wrds_tags_span wrds_tags_ln">19</span><span class="wrds_tags_span wrds_tags_line"></span></code>
<code class="wrds_tags"><span class="wrds_tags_span wrds_tags_ln">20</span><span class="wrds_tags_span wrds_tags_line"># ! Dans certains cas, il faut ajouter un espace après le 1er marqueur</span></code>
<code class="wrds_tags"><span class="wrds_tags_span wrds_tags_ln">21</span><span class="wrds_tags_span wrds_tags_line"># et/ou avant le second. Ils seront automatiquement supprimés</span></code>
<code class="wrds_tags"><span class="wrds_tags_span wrds_tags_ln">22</span><span class="wrds_tags_span wrds_tags_line"></span></code>
<code class="wrds_tags"><span class="wrds_tags_span wrds_tags_ln">23</span><span class="wrds_tags_span wrds_tags_line">*`DOMAIN/articles/ `* # évite /` : marqueur italique ouvert</span></code>
</pre>
<h3 id="toc_4" class="tyto">Une liste</h3>
<ul class="tyto">
@ -181,6 +198,13 @@ Citation complète dans un paragraphe
<li class="tyto">Seconde entrée non ordonnée</li>
<li class="tyto">Troisième entrée ... ... non ordonnée</li>
</ul>
<!-- Test d'ajout de code depuis un fichier -->
<pre class="bcode_pre">
<code class="bcode"><span class="bcode_span bcode_ln">1</span><span class="bcode_span bcode_line">#</span></code>
<code class="bcode"><span class="bcode_span bcode_ln">2</span><span class="bcode_span bcode_line"># Code 1</span></code>
<code class="bcode"><span class="bcode_span bcode_ln">3</span><span class="bcode_span bcode_line">#</span></code>
<code class="bcode"><span class="bcode_span bcode_ln">4</span><span class="bcode_span bcode_line"></span></code>
</pre>
</time>
</article>

2
debian/control vendored
View File

@ -1,5 +1,5 @@
Package: tyto
Version: 1.9.53
Version: 1.9.54
Section: custom
Priority: optional
Architecture: all

View File

@ -1,5 +1,5 @@
#!/usr/bin/env python3
# version: 1.9.53
# version: 1.9.54
# Tyto - Littérateur
# Copyright (C) 2023 Cyrille Louarn <echolib+tyto@a-lec.org>

View File

@ -693,13 +693,14 @@ def bcodes():
for nbr in post.block_tags["bcodes"]["sources"]:
lines = post.block_tags["bcodes"]["sources"][nbr][0].rsplit("\n")
HTML_bcode = HTMLs["bcodes"]
bcode = ""
for ln, line in enumerate(lines, 0):
# Opened mark : get CSS (if any) and pass line
if ln == 0:
css = tools.get_css(line, post.block_tags["bcodes"]["marks"][0])
if not css == domain.web["css"]:
HTMLs["bcodes"] = HTMLs["bcodes"].replace("bcode", css)
HTML_bcode = HTML_bcode.replace("bcode", css)
else:
css = "bcode"
continue
@ -713,10 +714,10 @@ def bcodes():
continue
line = tools.convert_html_signs(line)[fc:]
if not bcode: bcode = HTMLs["bcodes"]%(ln, line)
else: bcode = "%s\n%s"%(bcode, HTMLs["bcodes"]%(ln, line))
if not bcode: bcode = HTML_bcode%(ln, line)
else: bcode = "%s\n%s"%(bcode, HTML_bcode%(ln, line))
bcode = '<pre class="%s">\n%s\n</pre>'%(css, bcode)
bcode = '<pre class="%s_pre">\n%s\n</pre>'%(css, bcode)
replace_article(post.block_tags["bcodes"]["sources"][nbr][1], bcode)
@ -733,7 +734,7 @@ def codes():
for l in sorted_names:
mark = set_dict[l][1]
uri = domain.wrk_dirs["articles"][:-1] + set_dict[l][3]
code = '<!-- %s -->\n<pre class="bcode">'%set_dict[l][4]
code = '<!-- %s -->\n<pre class="bcode_pre">'%set_dict[l][4]
with open(uri, "r") as f:
for ln, line in enumerate(f.read().rsplit("\n"), 1):
@ -803,8 +804,8 @@ HTMLs = {
"customs" : ('<span class="%s">', "</span>"),
"image" : '<a class="%s image" href="%s">%s</a>',
"bcodes" : '<code class="bcode">' \
'<span class="bcode ln">%s</span>' \
'<span class="bcode line">%s</span>' \
'<span class="bcode_span bcode_ln">%s</span>' \
'<span class="bcode_span bcode_line">%s</span>' \
'</code>',
"hrs" : '<hr class="%s">',
"brs" : '<br class="%s">',

View File

@ -49,8 +49,20 @@ h6.tyto {}
* Class can be set for these markers
*/
p.tyto {}
ul.tyto {}
ol.tyto {}
li.tyto {}
/* - BlockCode "{{...}}"
* defaylt "bcode". If Class set: "bcode" is replaced. i.e pre.MYCSS_pre
* - "code::NAME" (file content) -> "::NAME"
* NO custom CSS
* */
pre.bcode_pre {}
code.bcode {}
span.bcode_span {}
span.bcode_ln {}
span.bcode_line {}
/* ----------------------------------------------------------------------------