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) !
## [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]
- update (work in progress) tpl_files/styles.css default doc references
- New manage() code in modules.py

View File

@ -45,6 +45,11 @@ code: MyPY
@code1.py
Test d'ajout de code depuis un fichier
file: PyF
@code1.py
Lien vers un fichier
-----
! TOC
@ -70,7 +75,7 @@ code: MyPY
)"
#2 Code (bloc)
{{ wrds_tags
{{
# Écrire les marqueurs de mots
# Chaque marqueur à la classe CSS de la configuration
# Astuce : ** + ← + `` + ← + très gras
@ -114,10 +119,13 @@ code: MyPY
)=
::MyPY
Télécharger le fichier ::PyF. {` Un iCode `}
```
## Output HTML
```
<body>
<div id="site_container">
<!--# include virtual="/template/header.html"-->
@ -126,7 +134,7 @@ code: MyPY
<main id="article_sidebar"> <!-- Contains <article> and <aside> -->
<article id="article">
<time datetime="2023-12-31 12:10:19">
<time datetime="2024-01-01 16:12:44">
<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>
@ -160,31 +168,32 @@ 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_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>
<pre class="bcode_pre">
<ol class="bcode_items">
<li class="bcode_item"><code class="bcode_code"># Écrire les marqueurs de mots</code></li>
<li class="bcode_item"><code class="bcode_code"># Chaque marqueur à la classe CSS de la configuration</code></li>
<li class="bcode_item"><code class="bcode_code"># Astuce : ** + ← + `` + ← + très gras</code></li>
<li class="bcode_item"><code class="bcode_code"></code></li>
<li class="bcode_item"><code class="bcode_code">*`très gras`* =&gt; &lt;strong&gt;</code></li>
<li class="bcode_item"><code class="bcode_code">+`gras`+ =&gt; &lt;b&gt;</code></li>
<li class="bcode_item"><code class="bcode_code">/`italique`/ =&gt; &lt;em&gt;</code></li>
<li class="bcode_item"><code class="bcode_code">;`italique`; =&gt; &lt;i&gt;</code></li>
<li class="bcode_item"><code class="bcode_code">_`souligné`_ =&gt; &lt;u&gt;</code></li>
<li class="bcode_item"><code class="bcode_code">~`effacé`~ =&gt; &lt;del&gt;</code></li>
<li class="bcode_item"><code class="bcode_code">[`cité`] =&gt; &lt;q&gt; # Contenu</code></li>
<li class="bcode_item"><code class="bcode_code">:`cité`: =&gt; &lt;cite&gt; # auteur, nom</code></li>
<li class="bcode_item"><code class="bcode_code">|`perso`| =&gt; &lt;span&gt;</code></li>
<li class="bcode_item"><code class="bcode_code"></code></li>
<li class="bcode_item"><code class="bcode_code"># Code dans un texte</code></li>
<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>
<li class="bcode_item"><code class="bcode_code"></code></li>
<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>
<li class="bcode_item"><code class="bcode_code"></code></li>
<li class="bcode_item"><code class="bcode_code"># ! Dans certains cas, il faut ajouter un espace après le 1er marqueur</code></li>
<li class="bcode_item"><code class="bcode_code"># et/ou avant le second. Ils seront automatiquement supprimés</code></li>
<li class="bcode_item"><code class="bcode_code"></code></li>
<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>
<ul class="tyto">
<li class="tyto">Première entrée non ordonnée (ul)</li>
@ -200,11 +209,14 @@ Citation complète dans un paragraphe
</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>
<ol class="bcode_items">
<li class="bcode_item"><code class="bcode_code">#</code></li>
<li class="bcode_item"><code class="bcode_code"># Code 1</code></li>
<li class="bcode_item"><code class="bcode_code">#</code></li>
<li class="bcode_item"><code class="bcode_code"></code></li>
</ol>
</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>
</article>

2
debian/control vendored
View File

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

View File

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

View File

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

View File

@ -51,6 +51,11 @@ def manage():
for post in args.commands["targets"]["*.tyto"]:
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
if args.commands["targets"]["sitemap"]:
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
if ln == 0:
css = tools.get_css(line, post.block_tags["bcodes"]["marks"][0])
if not css == domain.web["css"]:
HTML_bcode = HTML_bcode.replace("bcode", css)
else:
if css == domain.web["css"]:
css = "bcode"
else:
HTML_bcode = HTML_bcode.replace("bcode", css)
continue
# Get first character to set indent for bcode
@ -714,10 +714,14 @@ def bcodes():
continue
line = tools.convert_html_signs(line)[fc:]
if not bcode: bcode = HTML_bcode%(ln, line)
else: bcode = "%s\n%s"%(bcode, HTML_bcode%(ln, line))
if not bcode: bcode = HTML_bcode%(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)
@ -734,14 +738,15 @@ 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_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:
for ln, line in enumerate(f.read().rsplit("\n"), 1):
for line in f.read().rsplit("\n"):
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)
@ -803,10 +808,9 @@ HTMLs = {
"dels" : ('<del class="%s">', "</del>"),
"customs" : ('<span class="%s">', "</span>"),
"image" : '<a class="%s image" href="%s">%s</a>',
"bcodes" : '<code class="bcode">' \
'<span class="bcode_span bcode_ln">%s</span>' \
'<span class="bcode_span bcode_line">%s</span>' \
'</code>',
"bcodes" : '<li class="bcode_item">' + \
'<code class="bcode_code">%s</code>' + \
"</li>",
"hrs" : '<hr class="%s">',
"brs" : '<br class="%s">',
}

View File

@ -53,7 +53,12 @@ h6.tyto {}
ol.tyto {}
li.tyto {}
/* Words tags */
/*
* Words tags
*/
a.tyto {}
/* link to a file. Also a.tyto */
a.file {}
br.tyto {}
hr.tyto {}
strong.tyto {}
@ -66,17 +71,28 @@ i.tyto {}
del.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"
* NO custom CSS
* */
/*
* Blockquotes
*/
blockquote.tyto {}
/* If blockquote has metadatas, footer.tyto also gets new custom CSS */
footer.tyto {}
/* 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 {}
code.bcode {}
span.bcode_span {}
span.bcode_ln {}
span.bcode_line {}
ol.bcode_items {}
li.bcode_item {}
code.bcode_code {}
/* ----------------------------------------------------------------------------