This commit is contained in:
Cyrille L 2024-01-01 16:44:28 +01:00
parent 33a4c24e47
commit 3bd4ee6bcf
8 changed files with 112 additions and 64 deletions

View File

@ -10,6 +10,11 @@ Tyto - Littérateur
# CURRENTLY IN DEV (in devel branch) ! # CURRENTLY IN DEV (in devel branch) !
## [1.9.56]
- update HTML output for bcodes and codes markers
- update styles.css default references (tpl_files)
- added to "show" process: "[article].html [...].html" (show wip/ files)
## [1.9.55] ## [1.9.55]
- update (work in progress) tpl_files/styles.css default doc references - update (work in progress) tpl_files/styles.css default doc references
- New manage() code in modules.py - New manage() code in modules.py

View File

@ -45,6 +45,11 @@ code: MyPY
@code1.py @code1.py
Test d'ajout de code depuis un fichier Test d'ajout de code depuis un fichier
file: PyF
@code1.py
Lien vers un fichier
----- -----
! TOC ! TOC
@ -70,7 +75,7 @@ code: MyPY
)" )"
#2 Code (bloc) #2 Code (bloc)
{{ wrds_tags {{
# Écrire les marqueurs de mots # Écrire les marqueurs de mots
# Chaque marqueur à la classe CSS de la configuration # Chaque marqueur à la classe CSS de la configuration
# Astuce : ** + ← + `` + ← + très gras # Astuce : ** + ← + `` + ← + très gras
@ -114,10 +119,13 @@ code: MyPY
)= )=
::MyPY ::MyPY
Télécharger le fichier ::PyF. {` Un iCode `}
``` ```
## Output HTML ## Output HTML
``` ```
<body>
<div id="site_container"> <div id="site_container">
<!--# include virtual="/template/header.html"--> <!--# include virtual="/template/header.html"-->
@ -126,7 +134,7 @@ code: MyPY
<main id="article_sidebar"> <!-- Contains <article> and <aside> --> <main id="article_sidebar"> <!-- Contains <article> and <aside> -->
<article id="article"> <article id="article">
<time datetime="2023-12-31 12:10:19"> <time datetime="2024-01-01 16:12:44">
<header id="article_header"> <header id="article_header">
<h1 id="article_title"> <h1 id="article_title">
<a id="article_title_link" href="https://tyto.echolib.re/test.html" title="Tests -- echolib, 28/02/2023">Tests</a> <a id="article_title_link" href="https://tyto.echolib.re/test.html" title="Tests -- echolib, 28/02/2023">Tests</a>
@ -160,31 +168,32 @@ Citation complète dans un paragraphe
</p> </p>
</time><footer class="tyto"><a class="tyto" href="https://...">-- Auteur, Nom du livre, AAAA-MM-JJ</a></footer></blockquote> </time><footer class="tyto"><a class="tyto" href="https://...">-- Auteur, Nom du livre, AAAA-MM-JJ</a></footer></blockquote>
<h3 id="toc_3" class="tyto">Code (bloc)</h3> <h3 id="toc_3" class="tyto">Code (bloc)</h3>
<pre class="wrds_tags_pre"> <pre class="bcode_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> <ol class="bcode_items">
<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> <li class="bcode_item"><code class="bcode_code"># Écrire les marqueurs de mots</code></li>
<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> <li class="bcode_item"><code class="bcode_code"># Chaque marqueur à la classe CSS de la configuration</code></li>
<code class="wrds_tags"><span class="wrds_tags_span wrds_tags_ln">4</span><span class="wrds_tags_span wrds_tags_line"></span></code> <li class="bcode_item"><code class="bcode_code"># Astuce : ** + ← + `` + ← + très gras</code></li>
<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> <li class="bcode_item"><code class="bcode_code"></code></li>
<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> <li class="bcode_item"><code class="bcode_code">*`très gras`* =&gt; &lt;strong&gt;</code></li>
<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> <li class="bcode_item"><code class="bcode_code">+`gras`+ =&gt; &lt;b&gt;</code></li>
<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> <li class="bcode_item"><code class="bcode_code">/`italique`/ =&gt; &lt;em&gt;</code></li>
<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> <li class="bcode_item"><code class="bcode_code">;`italique`; =&gt; &lt;i&gt;</code></li>
<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> <li class="bcode_item"><code class="bcode_code">_`souligné`_ =&gt; &lt;u&gt;</code></li>
<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> <li class="bcode_item"><code class="bcode_code">~`effacé`~ =&gt; &lt;del&gt;</code></li>
<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> <li class="bcode_item"><code class="bcode_code">[`cité`] =&gt; &lt;q&gt; # Contenu</code></li>
<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> <li class="bcode_item"><code class="bcode_code">:`cité`: =&gt; &lt;cite&gt; # auteur, nom</code></li>
<code class="wrds_tags"><span class="wrds_tags_span wrds_tags_ln">14</span><span class="wrds_tags_span wrds_tags_line"></span></code> <li class="bcode_item"><code class="bcode_code">|`perso`| =&gt; &lt;span&gt;</code></li>
<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> <li class="bcode_item"><code class="bcode_code"></code></li>
<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> <li class="bcode_item"><code class="bcode_code"># Code dans un texte</code></li>
<code class="wrds_tags"><span class="wrds_tags_span wrds_tags_ln">17</span><span class="wrds_tags_span wrds_tags_line"></span></code> <li class="bcode_item"><code class="bcode_code"># ! Les marqueurs d&apos;ouverture et de fermeture de code sont sur la MEME LIGNE</code></li>
<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> <li class="bcode_item"><code class="bcode_code"></code></li>
<code class="wrds_tags"><span class="wrds_tags_span wrds_tags_ln">19</span><span class="wrds_tags_span wrds_tags_line"></span></code> <li class="bcode_item"><code class="bcode_code">{` &lt;li&gt;Une entée de liste&lt;/li&gt; `} =&gt; &lt;code&gt;</code></li>
<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> <li class="bcode_item"><code class="bcode_code"></code></li>
<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> <li class="bcode_item"><code class="bcode_code"># ! Dans certains cas, il faut ajouter un espace après le 1er marqueur</code></li>
<code class="wrds_tags"><span class="wrds_tags_span wrds_tags_ln">22</span><span class="wrds_tags_span wrds_tags_line"></span></code> <li class="bcode_item"><code class="bcode_code"># et/ou avant le second. Ils seront automatiquement supprimés</code></li>
<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> <li class="bcode_item"><code class="bcode_code"></code></li>
</pre> <li class="bcode_item"><code class="bcode_code">*`DOMAIN/articles/ `* # évite /` : marqueur italique ouvert</code></li>
</ol><pre>
<h3 id="toc_4" class="tyto">Une liste</h3> <h3 id="toc_4" class="tyto">Une liste</h3>
<ul class="tyto"> <ul class="tyto">
<li class="tyto">Première entrée non ordonnée (ul)</li> <li class="tyto">Première entrée non ordonnée (ul)</li>
@ -200,11 +209,14 @@ Citation complète dans un paragraphe
</ul> </ul>
<!-- Test d'ajout de code depuis un fichier --> <!-- Test d'ajout de code depuis un fichier -->
<pre class="bcode_pre"> <pre class="bcode_pre">
<code class="bcode"><span class="bcode_span bcode_ln">1</span><span class="bcode_span bcode_line">#</span></code> <ol class="bcode_items">
<code class="bcode"><span class="bcode_span bcode_ln">2</span><span class="bcode_span bcode_line"># Code 1</span></code> <li class="bcode_item"><code class="bcode_code">#</code></li>
<code class="bcode"><span class="bcode_span bcode_ln">3</span><span class="bcode_span bcode_line">#</span></code> <li class="bcode_item"><code class="bcode_code"># Code 1</code></li>
<code class="bcode"><span class="bcode_span bcode_ln">4</span><span class="bcode_span bcode_line"></span></code> <li class="bcode_item"><code class="bcode_code">#</code></li>
<li class="bcode_item"><code class="bcode_code"></code></li>
</ol>
</pre> </pre>
Télécharger le fichier <a class="tyto file" href="/files/code1.py" title="Lien vers un fichier">PyF</a>. <code class="tyto">Un iCode</code>
</time> </time>
</article> </article>

2
debian/control vendored
View File

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

View File

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

View File

@ -45,6 +45,7 @@ def get_arguments():
}, },
"targets" : { "targets" : {
"*.tyto" : (), "*.tyto" : (),
"*.html" : (),
"all" : False, "all" : False,
"domain" : False, "domain" : False,
"sitemap" : False, "sitemap" : False,
@ -68,11 +69,16 @@ def get_arguments():
# --------------------------- # ---------------------------
set_module = False set_module = False
for user_arg in range(2, len(sys.argv)): for user_arg in range(2, len(sys.argv)):
# Register articles # Register articles (.tyto)
if sys.argv[user_arg].endswith(".tyto"): if sys.argv[user_arg].endswith(".tyto"):
commands["targets"]["*.tyto"] = \ commands["targets"]["*.tyto"] = \
commands["targets"]["*.tyto"] + (sys.argv[user_arg],) commands["targets"]["*.tyto"] + (sys.argv[user_arg],)
# Register articles (.html)
if sys.argv[user_arg].endswith(".html"):
commands["targets"]["*.html"] = \
commands["targets"]["*.html"] + (sys.argv[user_arg],)
# Register targets # Register targets
for arg in commands["targets"]: for arg in commands["targets"]:
if not commands["targets"][arg] \ if not commands["targets"][arg] \

View File

@ -51,6 +51,11 @@ def manage():
for post in args.commands["targets"]["*.tyto"]: for post in args.commands["targets"]["*.tyto"]:
contents_file(os.path.join(domain.user_dir, post), True) contents_file(os.path.join(domain.user_dir, post), True)
# Show article(s) contents .html file (only in wip server)
if args.commands["targets"]["*.html"]:
for post in args.commands["targets"]["*.html"]:
contents_file(os.path.join(domain.wip, post), True)
# Sitemap # Sitemap
if args.commands["targets"]["sitemap"]: if args.commands["targets"]["sitemap"]:
contents_file(domain.wrk_dirs["articles"] + "sitemap.tyto", True) contents_file(domain.wrk_dirs["articles"] + "sitemap.tyto", True)

View File

@ -699,10 +699,10 @@ def bcodes():
# Opened mark : get CSS (if any) and pass line # Opened mark : get CSS (if any) and pass line
if ln == 0: if ln == 0:
css = tools.get_css(line, post.block_tags["bcodes"]["marks"][0]) css = tools.get_css(line, post.block_tags["bcodes"]["marks"][0])
if not css == domain.web["css"]: if css == domain.web["css"]:
HTML_bcode = HTML_bcode.replace("bcode", css)
else:
css = "bcode" css = "bcode"
else:
HTML_bcode = HTML_bcode.replace("bcode", css)
continue continue
# Get first character to set indent for bcode # Get first character to set indent for bcode
@ -714,10 +714,14 @@ def bcodes():
continue continue
line = tools.convert_html_signs(line)[fc:] line = tools.convert_html_signs(line)[fc:]
if not bcode: bcode = HTML_bcode%(ln, line) if not bcode: bcode = HTML_bcode%(line)
else: bcode = "%s\n%s"%(bcode, HTML_bcode%(ln, line)) else: bcode = "%s\n%s"%(bcode, HTML_bcode%(line))
bcode = '<pre class="%s_pre">\n%s\n</pre>'%(css, bcode) bcode = '<pre class="%s_pre">\n'%css + \
'<ol class="%s_items">\n'%css + \
"%s\n"%bcode + \
"</ol>" + \
"<pre>"
replace_article(post.block_tags["bcodes"]["sources"][nbr][1], bcode) replace_article(post.block_tags["bcodes"]["sources"][nbr][1], bcode)
@ -734,14 +738,15 @@ def codes():
for l in sorted_names: for l in sorted_names:
mark = set_dict[l][1] mark = set_dict[l][1]
uri = domain.wrk_dirs["articles"][:-1] + set_dict[l][3] uri = domain.wrk_dirs["articles"][:-1] + set_dict[l][3]
code = '<!-- %s -->\n<pre class="bcode_pre">'%set_dict[l][4] code = '<!-- %s -->\n'%set_dict[l][4] + \
'<pre class="bcode_pre">\n<ol class="bcode_items">'
with open(uri, "r") as f: with open(uri, "r") as f:
for ln, line in enumerate(f.read().rsplit("\n"), 1): for line in f.read().rsplit("\n"):
line = tools.convert_html_signs(line) line = tools.convert_html_signs(line)
code = "%s\n%s"%(code, HTMLs["bcodes"]%(ln, line)) code = "%s\n%s"%(code, HTMLs["bcodes"]%(line))
code = "%s\n</pre>"%code code = "%s\n</ol>\n</pre>"%code
replace_article(mark, code) replace_article(mark, code)
@ -803,10 +808,9 @@ HTMLs = {
"dels" : ('<del class="%s">', "</del>"), "dels" : ('<del class="%s">', "</del>"),
"customs" : ('<span class="%s">', "</span>"), "customs" : ('<span class="%s">', "</span>"),
"image" : '<a class="%s image" href="%s">%s</a>', "image" : '<a class="%s image" href="%s">%s</a>',
"bcodes" : '<code class="bcode">' \ "bcodes" : '<li class="bcode_item">' + \
'<span class="bcode_span bcode_ln">%s</span>' \ '<code class="bcode_code">%s</code>' + \
'<span class="bcode_span bcode_line">%s</span>' \ "</li>",
'</code>',
"hrs" : '<hr class="%s">', "hrs" : '<hr class="%s">',
"brs" : '<br class="%s">', "brs" : '<br class="%s">',
} }

View File

@ -47,13 +47,18 @@ h6.tyto {}
* ----------------- * -----------------
* "tyto" is default css DOMAIN. * "tyto" is default css DOMAIN.
* Class can be set for these markers * Class can be set for these markers
*/ */
p.tyto {} p.tyto {}
ul.tyto {} ul.tyto {}
ol.tyto {} ol.tyto {}
li.tyto {} li.tyto {}
/* Words tags */ /*
* Words tags
*/
a.tyto {}
/* link to a file. Also a.tyto */
a.file {}
br.tyto {} br.tyto {}
hr.tyto {} hr.tyto {}
strong.tyto {} strong.tyto {}
@ -66,17 +71,28 @@ i.tyto {}
del.tyto {} del.tyto {}
span.tyto {} span.tyto {}
/* inline code*/
code.tyto {}
/* - BlockCode "{{...}}"
* defaylt "bcode". If Class set: "bcode" is replaced. i.e pre.MYCSS_pre /*
* - "code::NAME" (file content) -> "::NAME" * Blockquotes
* NO custom CSS */
* */ blockquote.tyto {}
pre.bcode_pre {} /* If blockquote has metadatas, footer.tyto also gets new custom CSS */
code.bcode {} footer.tyto {}
span.bcode_span {}
span.bcode_ln {}
span.bcode_line {}
/* BlockCode "{{...}}"
* - defaylt "bcode". If Class set: "bcode" is replaced. i.e pre.MYCSS_pre
* "code::NAME" (file contents) -> "::NAME"
* - NO custom CSS
*/
pre.bcode_pre {}
ol.bcode_items {}
li.bcode_item {}
code.bcode_code {}
/* ---------------------------------------------------------------------------- /* ----------------------------------------------------------------------------