From 3bd4ee6bcff485602f56f32e2ded4f4f81f5a071 Mon Sep 17 00:00:00 2001 From: Cyrille LOUARN Date: Mon, 1 Jan 2024 16:44:28 +0100 Subject: [PATCH] [1.9.56] --- CHANGELOG.md | 5 ++ README.md | 74 ++++++++++++++++----------- debian/control | 2 +- src/usr/bin/tyto | 2 +- src/var/lib/tyto/program/args.py | 8 ++- src/var/lib/tyto/program/show.py | 5 ++ src/var/lib/tyto/program/wip.py | 32 +++++++----- src/var/lib/tyto/tpl_files/styles.css | 48 +++++++++++------ 8 files changed, 112 insertions(+), 64 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf478ec..7c1c815 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index 29cbc6d..07243db 100644 --- a/README.md +++ b/README.md @@ -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 ``` +
@@ -126,7 +134,7 @@ code: MyPY
-
diff --git a/debian/control b/debian/control index 4933e7a..e10a6c9 100644 --- a/debian/control +++ b/debian/control @@ -1,5 +1,5 @@ Package: tyto -Version: 1.9.55 +Version: 1.9.56 Section: custom Priority: optional Architecture: all diff --git a/src/usr/bin/tyto b/src/usr/bin/tyto index 4c6f0a6..8160062 100755 --- a/src/usr/bin/tyto +++ b/src/usr/bin/tyto @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# version: 1.9.55 +# version: 1.9.56 # Tyto - Littérateur # Copyright (C) 2023 Cyrille Louarn diff --git a/src/var/lib/tyto/program/args.py b/src/var/lib/tyto/program/args.py index 92b872c..af0b05e 100644 --- a/src/var/lib/tyto/program/args.py +++ b/src/var/lib/tyto/program/args.py @@ -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] \ diff --git a/src/var/lib/tyto/program/show.py b/src/var/lib/tyto/program/show.py index 4808386..3537f81 100644 --- a/src/var/lib/tyto/program/show.py +++ b/src/var/lib/tyto/program/show.py @@ -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) diff --git a/src/var/lib/tyto/program/wip.py b/src/var/lib/tyto/program/wip.py index 9ae892d..fff17bf 100644 --- a/src/var/lib/tyto/program/wip.py +++ b/src/var/lib/tyto/program/wip.py @@ -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 = '
\n%s\n
'%(css, bcode) + bcode = '
\n'%css + \
+              '
    \n'%css + \ + "%s\n"%bcode + \ + "
" + \ + "
"
       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 = '\n
'%set_dict[l][4]
+      code = '\n'%set_dict[l][4] + \
+             '
\n
    ' 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
"%code + code = "%s\n\n
"%code replace_article(mark, code) @@ -803,10 +808,9 @@ HTMLs = { "dels" : ('', ""), "customs" : ('', ""), "image" : '%s', - "bcodes" : '' \ - '%s' \ - '%s' \ - '', + "bcodes" : '
  • ' + \ + '%s' + \ + "
  • ", "hrs" : '
    ', "brs" : '
    ', } diff --git a/src/var/lib/tyto/tpl_files/styles.css b/src/var/lib/tyto/tpl_files/styles.css index 64cfcc2..33f15f7 100644 --- a/src/var/lib/tyto/tpl_files/styles.css +++ b/src/var/lib/tyto/tpl_files/styles.css @@ -47,13 +47,18 @@ h6.tyto {} * ----------------- * "tyto" is default css DOMAIN. * Class can be set for these markers - */ - p.tyto {} - ul.tyto {} - ol.tyto {} - li.tyto {} +*/ +p.tyto {} +ul.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 {} + + +/* + * 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 content) -> "::NAME" - * NO custom CSS - * */ - pre.bcode_pre {} - code.bcode {} - 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 {} /* ----------------------------------------------------------------------------