From 1113b2da9fb4396f6cc5e41f696ffa9473ae566a Mon Sep 17 00:00:00 2001 From: Cyrille L Date: Fri, 14 Apr 2023 17:15:15 +0200 Subject: [PATCH 1/4] [0.9.1] --- CHANGELOG.md | 6 ++++++ src/usr/bin/tyto | 2 +- src/var/lib/tyto/program/tyto.py | 4 ++-- src/var/lib/tyto/program/wip.py | 5 +++-- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54e5f86..d07dd24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,5 +6,11 @@ Tyto - Littérateur - Changelog: https://git.a-lec.org/echolib/tyto-litterateur/-/blob/master/CHANGELOG.md - License: https://git.a-lec.org/echolib/tyto-litterateur/-/blob/master/LICENSE +## [0.9.1] +- wip: tabulation when using `
` +- wip: inline quote markers `@_myquote_@` +- wip: inline italic marker `:_maybe_:` +- wip: fix data retreive in complete quote + ## [0.9.0] - Last testings before final diff --git a/src/usr/bin/tyto b/src/usr/bin/tyto index 1824ec3..39b0751 100755 --- a/src/usr/bin/tyto +++ b/src/usr/bin/tyto @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# Version: 0.9.0 +# Version: 0.9.1 # Tyto - Littérateur # # Copyright (C) 2023 Cyrille Louarn diff --git a/src/var/lib/tyto/program/tyto.py b/src/var/lib/tyto/program/tyto.py index fc5d422..f9f35b4 100644 --- a/src/var/lib/tyto/program/tyto.py +++ b/src/var/lib/tyto/program/tyto.py @@ -109,10 +109,10 @@ words_tags = [ ('*_', '_*', '', '', 'strongs', 'w'), ('+_', '_+', '', '', 'bolds', 'w'), ('/_', '_/', '', '', 'emphasis', 'w'), -('[_', '_]', '', '', 'italics', 'w'), +(':_', '_:', '', '', 'italics', 'w'), ('~_', '_~', '', '', 'dels', 'w'), ('._', '_.', '', '', 'underlines', 'w'), -(':_', '_:', '', '', 'cites', 'w'), +('@_', '_@', '', '', 'cites', 'w'), ('%_', '_%', '', '', 'customs', 'w'), ('{_', '_}', '', '', 'codes', 'w'), ('((', '))', '

', '

', 'paragraphs', 't'), diff --git a/src/var/lib/tyto/program/wip.py b/src/var/lib/tyto/program/wip.py index a9c0759..d4cf7b7 100644 --- a/src/var/lib/tyto/program/wip.py +++ b/src/var/lib/tyto/program/wip.py @@ -467,7 +467,7 @@ def wip_images(): def quote_params(qline): for tag in tyto.quote_tags: if qline.startswith(tag[0]): - globals()[tag[1]] = qline.rsplit(' ',1)[1].lstrip() + globals()[tag[1]] = qline.rsplit('%s '%tag[0])[1].lstrip() return(True) #==========================# @@ -953,7 +953,8 @@ def wip_tabs(): elif line.startswith(' Date: Sun, 16 Apr 2023 16:42:31 +0200 Subject: [PATCH 2/4] [0.10.0] --- CHANGELOG.md | 8 +++ README.md | 69 ++++++++---------------- debian/control | 2 +- src/usr/bin/tyto | 2 +- src/var/lib/tyto/help/styles.css | 11 +++- src/var/lib/tyto/program/args.py | 28 ++++++---- src/var/lib/tyto/program/check.py | 68 ++++++++++++++++------- src/var/lib/tyto/program/db.py | 2 + src/var/lib/tyto/program/dom.py | 21 ++++++++ src/var/lib/tyto/program/form.py | 60 +++++++++++---------- src/var/lib/tyto/program/html.py | 61 +++++++++++---------- src/var/lib/tyto/program/langs.py | 2 +- src/var/lib/tyto/program/logs.py | 19 ++++--- src/var/lib/tyto/program/publish.py | 8 ++- src/var/lib/tyto/program/status.py | 41 +++++++++----- src/var/lib/tyto/program/tyto.py | 52 +++++++++--------- src/var/lib/tyto/program/wip.py | 57 ++++++++++++++++++-- src/var/lib/tyto/translations/logs_en.py | 16 +++--- src/var/lib/tyto/translations/logs_fr.py | 18 ++++--- src/var/lib/tyto/translations/site_en.py | 1 + src/var/lib/tyto/translations/site_fr.py | 1 + 21 files changed, 335 insertions(+), 212 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d07dd24..f55a244 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,14 @@ Tyto - Littérateur - Changelog: https://git.a-lec.org/echolib/tyto-litterateur/-/blob/master/CHANGELOG.md - License: https://git.a-lec.org/echolib/tyto-litterateur/-/blob/master/LICENSE +## [0.10.0] +- Add full static page option (--static) only with wip +- Add
markers: `<<`, `>>` +- Add new container
in footer +- Better status display for article +- fix lang setting +- fix for less warnings in HTML validity + ## [0.9.1] - wip: tabulation when using `
` - wip: inline quote markers `@_myquote_@` diff --git a/README.md b/README.md index 50bf72d..4838990 100644 --- a/README.md +++ b/README.md @@ -54,30 +54,31 @@ abbr: abbrev # Les titres HTML vont de 1 à 6. # Utiliser #N, où N est entre 1 et 6. # Si du contenu existe entre les titres, une
est ajoutée -# Astuce: on commence en général par #2 dans l'article +# Astuce: on commence en général par #2 dans l'article le titre du site +# étant en #1 # Source -#1 Titre 1 +#2 Titre 1 Contenu 1 -#2 Titre 2 +#3 Titre 2 -#3 Titre 3 +#4 Titre 3 contenu 2 -#4 Titre 4 +#5 Titre 4 +``` -# HTML -

Titre 1

-
-Contenu 1 -
-

Titre 2

-

Titre 3

-
-contenu 2 -
-

Titre 4

+### Balise div +``` +<< CSS +(( +1er paragraphes dans une balise div class="CSS" +)) +(( +2e paragraphes dans une balise div class="CSS" +)) +>> ``` ### Paragraphes @@ -111,17 +112,10 @@ def hello_world(): # Source de l'ancre cible. "id" est son identité -> id -# HTML - - # Source de l'ancre d'appel # Définir l'identité cible et le texte du lien -(( >_id:Retourner au point d'ancre id_< -)) -# HTML -Retourner au point d'ancre id ``` ### Retour à la ligne HTML @@ -135,18 +129,20 @@ def hello_world(): ### Lien vers URL ``` +# Placer "_" devant le Nom du lien Voir ce _Nom du lien # Ouverture même fenêtre Voir ce _Nom du lien+ # ouverture nouvelle fenêtre ``` ### Lien vers fichier ``` +# Placer "__" devant le Nom du lien Voir ce __Nom du lien # Ouverture même fenêtre Voir ce __Nom du lien+ # ouverture nouvelle fenêtre ``` Note: -Vous pouvez avoir un Nom identique pour les marqueur `file:` et `link:` +Vous pouvez avoir un Nom identique pour les marqueurs `file:` et `link:` ### Gras, Strong, italique... @@ -154,9 +150,9 @@ Vous pouvez avoir un Nom identique pour les marqueur `file:` et `link:` *_très gras_* # +_gras léger_+ # /_en italique_/ # -[_en italique_] # +:_en italique_: # ~_texte barré_~ # -:_Citation rapide_: # +@_Citation rapide_@ # %_Classe personnalisée_% >>> ._Souligné_. # {_Code_} # @@ -207,7 +203,7 @@ optionnels `_xxx:`. Pour la date, utilisez le FORMAT INTERNATIONAL # Source: citation complète [[ CSS_TEST _cite: echolib -_date: 2022-12-28 +_date: 2022-12-28 (format AAAA ou AAAA-MM ou AAAA-MM-JJ) _lang: fr _link: https://tyto.echolib.re _book: Référence @@ -215,29 +211,10 @@ _book: Référence Pfff, vraiment ! )) ]] - -# HTML -
-
- -
-
- echolib - Reference (2022-12-28) -
-
```` ``` # Source: citation basique [[ Une citation simple, et sans paragraphe ]] - -# HTML -
- Une citation simple, et sans paragraphe -
``` diff --git a/debian/control b/debian/control index 962e249..59ae9da 100644 --- a/debian/control +++ b/debian/control @@ -1,5 +1,5 @@ Package: tyto -Version: 0.9.0 +Version: 0.10.0 Section: custom Priority: optional Architecture: all diff --git a/src/usr/bin/tyto b/src/usr/bin/tyto index 39b0751..c6c2314 100755 --- a/src/usr/bin/tyto +++ b/src/usr/bin/tyto @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# Version: 0.9.1 +# Version: 0.10.0 # Tyto - Littérateur # # Copyright (C) 2023 Cyrille Louarn diff --git a/src/var/lib/tyto/help/styles.css b/src/var/lib/tyto/help/styles.css index 31ccc5c..2dacdf7 100644 --- a/src/var/lib/tyto/help/styles.css +++ b/src/var/lib/tyto/help/styles.css @@ -37,7 +37,7 @@ p#site_about { nav#site_menu { } -ul#site_menu_items { +menu#site_menu_items { } li.site_menu_item { @@ -121,7 +121,7 @@ p.bcode { } /* section for author and date */ -section#article_infos { +div#article_infos { } span#article_author { } @@ -157,6 +157,11 @@ p.sidebar_item_about { */ footer#footer_page { } + +/* container for footer_infos + footer_references */ +div#footer_container { +} + /* Block*/ div#footer_infos { } @@ -164,6 +169,7 @@ h1#footer_site_title { } p#footer_about { } + /* Block */ div#footer_references { } @@ -173,6 +179,7 @@ li.footer_item { } a.footer_item_link { } + /* Block */ div#footer_credits { } diff --git a/src/var/lib/tyto/program/args.py b/src/var/lib/tyto/program/args.py index 102b140..656df18 100644 --- a/src/var/lib/tyto/program/args.py +++ b/src/var/lib/tyto/program/args.py @@ -60,10 +60,12 @@ actions = \ 'publish' ) -pass_actions = ( - 'new' - - ) +option = \ +( +'--static', +) + +pass_actions = ('new') # Actions that needs to check for article's database pass_db = \ @@ -104,24 +106,26 @@ pass_status = \ multi_chk = ('added', 'again', 'updated') +''' action = '' target = '' -noaction = False +option = '' +''' + # action #------- try: action = sys.argv[1] -except: noaction = True +except: action = '' # With no argument, show help -if noaction: +if not action: infos.tyto(target) sys.exit(0) # Unused argument [action] -act_err = False -if not action in actions: - act_err = True +if action in actions: act_err = False +else: act_err = True # target @@ -130,6 +134,10 @@ try: target = sys.argv[2] except: target = '' +# option +try: option = sys.argv[3] +except: option = '' + # Set action and target for binary def set_action(): return(action) diff --git a/src/var/lib/tyto/program/check.py b/src/var/lib/tyto/program/check.py index 8ce9dac..c8ff824 100644 --- a/src/var/lib/tyto/program/check.py +++ b/src/var/lib/tyto/program/check.py @@ -878,39 +878,67 @@ def check_content(post_bottom): ), False) +#==============================================# +# Check if articles in servers are static Page # +#----------------------------------------------# +def check_static_posts(): + global wip_static, www_static + wip_static = www_static = 'False' + + srv_posts = \ + [ + (srv_post_wip_uri, 'wip_static'), + (srv_post_www_uri, 'www_static') + ] + + for srv_post, static in srv_posts: + post_datas = open(srv_post, "r").read() + if not re.findall( + tyto.tags_html_mods[dom.wip_metas_f], + post_datas + ): + globals()[static] = "True" + + #===============================# # Create new article's database # #------------------------------&co-# def create_database(): + # Check if article is in servers + check_static_posts() + + # Post Configurations #-------------------- database = \ - '# Post Configurations\n' + \ - 'post_id = "%s"\n'%db.uri_id + \ - 'post_src = "%s"\n'%db.uri_file + \ - 'post_wip = "%s"\n'%srv_post_wip_uri + \ - 'post_www = "%s"\n'%srv_post_www_uri + \ - '\n' + \ - 'direc_src = "%s"\n'%direc_src + \ - 'short_src = "%s"\n'%src_post_short_uri + \ - 'short_srv = "%s"\n'%srv_post_short_uri + \ - 'sub_uri = "%s"\n'%sub_uri + \ - 'http_wip = "%s"\n'%http_wip + \ - 'http_www = "%s"\n'%http_www + \ - '\n' + \ - 'date_chk = "%s"\n'%tyto.nowdate() + \ - 'hash_chk = "%s"\n'%db.hash_post + \ - 'date_wip = "%s"\n'%date_wip + \ - 'hash_wip = "%s"\n'%hash_wip + \ - 'date_www = "%s"\n'%date_www + \ - 'hash_www = "%s"\n'%hash_www + \ - '\n# Needed tags configurations\n' + \ + '# Writer configurations\n' + \ 'title = "%s"\n'%title + \ 'about = "%s"\n'%about + \ 'author = "%s"\n'%author + \ 'meta_tags = "%s"\n'%tags + \ 'date = "%s"\n'%date_tr + \ 'snpic = "%s"\n'%snpic_url + \ + '\n# Post Configurations\n' + \ + 'post_id = "%s"\n'%db.uri_id + \ + 'post_src = "%s"\n'%db.uri_file + \ + 'direc_src = "%s"\n'%direc_src + \ + 'short_src = "%s"\n'%src_post_short_uri + \ + 'short_srv = "%s"\n'%srv_post_short_uri + \ + 'sub_uri = "%s"\n'%sub_uri + \ + 'date_chk = "%s"\n'%tyto.nowdate() + \ + 'hash_chk = "%s"\n'%db.hash_post + \ + '\n# wip configuration\n' + \ + 'post_wip = "%s"\n'%srv_post_wip_uri + \ + 'http_wip = "%s"\n'%http_wip + \ + 'static_wip = %s\n'%wip_static + \ + 'date_wip = "%s"\n'%date_wip + \ + 'hash_wip = "%s"\n'%hash_wip + \ + '\n# www configuration\n' + \ + 'post_www = "%s"\n'%srv_post_www_uri + \ + 'http_www = "%s"\n'%http_www + \ + 'static_www = %s\n'%www_static + \ + 'date_www = "%s"\n'%date_www + \ + 'hash_www = "%s"\n'%hash_www + \ '\n# Used files\n' + \ 'uris = %s'%str(files_post) diff --git a/src/var/lib/tyto/program/db.py b/src/var/lib/tyto/program/db.py index 5cac1b1..a488d9d 100644 --- a/src/var/lib/tyto/program/db.py +++ b/src/var/lib/tyto/program/db.py @@ -83,7 +83,9 @@ if args.target \ 'post_id', 'post_src', 'post_wip', + 'static_wip', 'post_www', + 'static_www', 'direc_src', 'short_src', 'short_srv', diff --git a/src/var/lib/tyto/program/dom.py b/src/var/lib/tyto/program/dom.py index 21b8eec..df5182d 100644 --- a/src/var/lib/tyto/program/dom.py +++ b/src/var/lib/tyto/program/dom.py @@ -267,6 +267,27 @@ if not hole: "footer" : footers, "template": templates, } + + templates_wip = { + eval(str('wip_logo_f')), + eval(str('wip_css_f')), + eval(str('wip_navbar_f')), + eval(str('wip_sidebar_f')), + eval(str('wip_metas_f')), + eval(str('wip_footer_f')), + eval(str('wip_stats_f')), + } + + templates_www = { + eval(str('www_logo_f')), + eval(str('www_css_f')), + eval(str('www_navbar_f')), + eval(str('www_sidebar_f')), + eval(str('www_metas_f')), + eval(str('www_footer_f')), + eval(str('www_stats_f')), + eval(str('www_rss_f')) + } #====================================# # Check if domain is ready and ready # diff --git a/src/var/lib/tyto/program/form.py b/src/var/lib/tyto/program/form.py index 6316e1d..b11665e 100644 --- a/src/var/lib/tyto/program/form.py +++ b/src/var/lib/tyto/program/form.py @@ -760,10 +760,10 @@ def create_metas(option): '# \n' + \ - '\n' + \ - '\n' + \ - '' + '\n' + \ + '\n' + \ + '\n' + \ + '' tyto.set_file(dom.metas_f, 'New', metas_tags) @@ -966,11 +966,11 @@ def create_footer(option): footer_laws_links = '' if footer_laws: footer_laws_links = \ - ' \n' + ' \n' # Set default content for # navbar config file @@ -1000,41 +1000,43 @@ def create_footer(option): footer = \ '%s\n'%footer_lang%(tyto.Tyto, dom.footer_f) + \ '
\n' + \ - ' \n' + \ + '
\n' + \ '\n' + \ - ' \n' + \ '
\n' + \ ' \n' + \ ' \n' + \ - '\n' + \ - '\n' + \ + tyto.tags_html_mods[dom.wip_navbar_f] + '\n' + \ '
\n' + \ '

%s

\n'%( @@ -176,7 +175,7 @@ def create_main_page(target, article_bottom): db.title, ) + \ '%s\n'%article_bottom + \ - '
\n' + \ + '
\n' + \ '

\n' + \ ' %s, %s\n'%( @@ -186,11 +185,11 @@ def create_main_page(target, article_bottom): '%s\n'%time_html_pub + \ '%s'%post_html_code + \ '

\n' + \ - '
\n' + \ + '
\n' + \ ' \n' + \ '\n' + \ - '\n' + \ - '\n' + \ + tyto.tags_html_mods[dom.wip_sidebar_f] + '\n' + \ + tyto.tags_html_mods[dom.wip_footer_f] + '\n' + \ ' \n' + \ '' @@ -239,7 +238,7 @@ def create_html_time_meta(process): # meta search_date= meta_pub = \ - ' \n'%( + ' \n'%( date_raw.rsplit(' ')[0] ) @@ -305,7 +304,7 @@ def create_navbar(option): # Set first HTML line menu_html = \ '%s\n'%(menu_html, 8 * ' ', 6 * ' ') + menu_html = '\n%s\n%s\n%s\n'%(menu_html, 6 * ' ', 4 * ' ') tyto.set_file(target, 'New', menu_html) diff --git a/src/var/lib/tyto/program/langs.py b/src/var/lib/tyto/program/langs.py index 2fc4ffa..d0d9afa 100644 --- a/src/var/lib/tyto/program/langs.py +++ b/src/var/lib/tyto/program/langs.py @@ -56,7 +56,7 @@ try: dom.exists lang_logs = dom.lang_logs os.path.exists('%s/logs_%s.py'%(trans_dir, lang_logs)) - log = importlib.import_module('logs_%s'%lang_logse, package=None) + log = importlib.import_module('logs_%s'%lang_logs, package=None) except: log = importlib.import_module('logs_%s'%lang_sys, package=None) diff --git a/src/var/lib/tyto/program/logs.py b/src/var/lib/tyto/program/logs.py index c23549b..3473a0d 100644 --- a/src/var/lib/tyto/program/logs.py +++ b/src/var/lib/tyto/program/logs.py @@ -66,12 +66,12 @@ def out(nbr, value, out): '17' : ' ╞ %s%s%s "%s ?"'%(CR, langs.log.unused_v, CS, value), '18' : ' ╘ %s%s%s > %s'%(CR, langs.log.unused_p, CS, value), '19' : ' ╞ %s%s%s %s'%(CG, langs.log.was_wip, CS, value), - '20' : ' ╞ %s%s%s %s'%(CG, langs.log.was_chk, CS, value), + '20' : ' ╞═ %s%s%s %s'%(CG, langs.log.was_chk, CS, value), '21' : ' ╘ %s%s%s > %s'%(CG, langs.log.post_val, CS, value), '22' : ' ╞ %s%s%s %s'%(CY, langs.log.symb_np, CS, value), '23' : ' ╞ %s%s%s > %s'%(CY, langs.log.db_inv, CS, value), '24' : ' ╞ %s%s%s > %s'%(CY, langs.log.unused_r, CS, value), - '25' : ' ╞ %s%s%s > %s'%(CY, langs.log.nycheck, CS, value), + '25' : ' ╞═ %s%s%s > %s'%(CY, langs.log.nycheck, CS, value), '26' : ' ╞ %s%s%s %s'%(CY, langs.log.nyfile, CS, value), '27' : ' ╞ %s%s%s %s'%(CY, langs.log.snpic_d, CS, value), '28' : ' ╘ %s (%s)'%(langs.log.ntd, value), @@ -96,16 +96,15 @@ def out(nbr, value, out): '51' : ' ╞ %s%s%s > %s'%(CY, langs.log.data_inc, CS, value), '60' : ' │\n ╞ %s'%langs.log.status_r, '61' : ' ╞ %s%s%s > %s'%(CG, langs.log.file_e, CS, value), - '71' : ' ╞═ %s%s%s > %s'%(CY, langs.log.post_nwi, CS, value), - '72' : ' ╞═ %s%s%s > %s'%(CG, langs.log.post_wip, CS, value), - '73' : ' ╞═ %s%s%s > %s'%(CY, langs.log.st_wip_n, CS, value), - '74' : ' ╞═ %s%s%s > %s'%(CY, langs.log.st_wip_o, CS, value), - '81' : ' ╞═ %s%s%s > %s'%(CY, langs.log.post_nww, CS, value), - '82' : ' ╞═ %s%s%s > %s'%(CG, langs.log.post_www, CS, value), - '83' : ' ╞═ %s%s%s > %s'%(CY, langs.log.st_www_n, CS, value), - '84' : ' ╞═ %s%s%s > %s'%(CY, langs.log.st_www_o, CS, value), '85' : ' ╞═ %s%s%s > %s'%(CY, langs.log.was_pub, CS, value), + '91' : ' ╞═ %s%s%s > %s'%(CY, langs.log.post_nfd, CS, value), + '92' : ' ╞═ %s%s%s > %s'%(CG, langs.log.post_yfd, CS, value), '94' : ' ╞═ %s%s%s > %s'%(CY, langs.log.st_chk_o, CS, value), + '95' : ' ╞═ %s%s%s > %s'%(CG, langs.log.status_s, CS, value), + '96' : ' ╞═ %s%s%s > %s'%(CY, langs.log.static_y, CS, value), + '97' : ' ╞═ %s%s%s > %s'%(CG, langs.log.static_n, CS, value), + '98' : ' ╞═ %s%s%s > %s'%(CY, langs.log.status_n, CS, value), + '99' : ' ╞═ %s%s%s > %s'%(CY, langs.log.status_o, CS, value), '255' : ' ╘ %s'%langs.log.laterout } diff --git a/src/var/lib/tyto/program/publish.py b/src/var/lib/tyto/program/publish.py index 8cd3bf1..bc268fc 100644 --- a/src/var/lib/tyto/program/publish.py +++ b/src/var/lib/tyto/program/publish.py @@ -165,7 +165,13 @@ def publish_article(): logs.out("33", '%s%s'%(dom.srv_www, db.direc_src), False) # Replace in DB hash_wip and date_wip - tyto.replace_in_db(db.config, 'www', db.hash_post) + db_values = \ + [ + ("date_www", '"%s"'%db.date_www, '"%s"'%tyto.nowdate()), + ("hash_www", '"%s"'%db.hash_www, '"%s"'%db.hash_post), + ("static_www", '%s'%db.static_www, '%s'%db.static_wip) + ] + tyto.change_in_db(db.config, db_values) # Copy needed files (Also create sub-folders) tyto.files_to_srv('www') diff --git a/src/var/lib/tyto/program/status.py b/src/var/lib/tyto/program/status.py index fdedd8c..c0d5dea 100644 --- a/src/var/lib/tyto/program/status.py +++ b/src/var/lib/tyto/program/status.py @@ -19,7 +19,7 @@ #---------------------------------------------------------------------- # XMPP: echolib (im@echolib.re) # -# Description: Show statuses for domain +# Description: Show statuses for commands, domain, article # File: /var/lib/tyto/program/status.py #---------------------------------------------------------------------- @@ -37,8 +37,8 @@ import args, dom, logs, tyto, form, db def domain(): if dom.hole: logs.out("13", '', True) - elif args.action == 'new': return - elif args.act_err: logs.out("11", args.action, True) + elif args.action == 'new': return + elif args.act_err: logs.out("11", args.action, True) elif not dom.exists: logs.out("10", '', True) elif dom.corrupt: logs.out("39", dom.shortname, True) @@ -76,6 +76,7 @@ def domain(): if not tyto.exists(file_mods): logs.out("1", file_mods, False) + #==============================# # On demand with status action # #------------------------------# @@ -84,6 +85,7 @@ def check(target): if not target: logs.out("5", '[target]', True) + # Domain statuses elif target == "domain": conf_err = False @@ -101,6 +103,7 @@ def check(target): logs.out("31", '', True) return + # target is an article # Unused file elif not db.post: logs.out("1", db.uri_file, True) @@ -115,16 +118,30 @@ def check(target): else: logs.out("20", db.uri_file, False) # wip - if not db.file_wip: logs.out("71", db.post_wip, False) - else: logs.out("72", db.post_wip, False) - if db.no_wip: logs.out("73", db.post_wip, False) - elif db.old_wip: logs.out("74", db.post_wip, False) - + print(' │ [wip]') + if not db.file_wip: + logs.out("91", db.post_wip, False) + else: + logs.out("92", db.post_wip, False) + # wip static + if db.static_wip: logs.out("96", db.post_wip, False) + else: logs.out("97", db.post_wip, False) + if db.no_wip: logs.out("98", db.post_wip, False) + elif db.old_wip: logs.out("99", db.post_wip, False) + else: logs.out("95", db.post_wip, False) + # www - if not db.file_www: logs.out("81", db.post_www, False) - else: logs.out("82", db.post_www, False) - if db.no_www: logs.out("83", db.post_www, False) - elif db.old_www: logs.out("84", db.post_www, False) + print(' │ [www]') + if not db.file_www: + logs.out("91", db.post_www, False) + else: + logs.out("92", db.post_www, False) + # www static + if db.static_www: logs.out("96", db.post_wip, False) + else: logs.out("97", db.post_wip, False) + if db.no_www: logs.out("98", db.post_www, False) + elif db.old_www: logs.out("99", db.post_www, False) + else: logs.out("95", db.post_www, False) return # Article has NO DB diff --git a/src/var/lib/tyto/program/tyto.py b/src/var/lib/tyto/program/tyto.py index f9f35b4..01b4c57 100644 --- a/src/var/lib/tyto/program/tyto.py +++ b/src/var/lib/tyto/program/tyto.py @@ -118,14 +118,15 @@ words_tags = [ ('((', '))', '

', '

', 'paragraphs', 't'), ('[[', ']]', '[[', ']]', 'quotes', 't'), ('{{', '}}', '{{', '}}', 'bcodes', 't'), -('-(', '-)', '-(', '-)', 'lists', 't') +('-(', '-)', '-(', '-)', 'lists', 't'), +('<<', '>>', '
', '
', 'div', 't') ] # Tags that do not need to be paired #----------------------------------- single_tags = [ ('|', '
'), # New Line -('->', '') # Anchors +('->', ''), # Anchors ] # When counting words, do no count line starting with: @@ -182,6 +183,15 @@ quote_tags = [ # Tags to check in header in content _TAG head_tags = ("image:", "raw:", "code;") +# For static modules +tags_html_mods = \ +{ +dom.wip_navbar_f : '', +dom.wip_sidebar_f : '', +dom.wip_metas_f : '', +dom.wip_footer_f : '' +} + # Valid characters for some datas chrs_invalid = \ set('{}[]_()+*=/:%~´') @@ -269,7 +279,7 @@ def set_file(path, new, text): try: file = open(path, opt) - file.write(text + '\n') + file.write(text) file.close() if opt == 'w': logs.out("32", path, False) @@ -474,32 +484,20 @@ def b64(action, content, before, after): # Used for wip and publish # # to replace hash and date when done # #------------------------------------# -def replace_in_db(post_db, process, hash_post): - try: - file_db = open(post_db, "r") - lines = file_db.readlines() - except: - logs.out("1", post_db, True) +def change_in_db(db_file, db_values): + try: post_db = open(db_file, "r").read() + except: logs.out("1", db_file, True) - new_file = '' + for value in db_values: + old_value = re.findall(r'%s\s+=\s+%s'%( + value[0],value[1] + ), post_db + )[0] + new_value = old_value.replace(value[1], value[2]) + if new_value != old_value: + post_db = post_db.replace(old_value, new_value) - for line in lines: - if line.startswith('hash_%s'%process): - line = line.replace(line, 'hash_%s = "%s"'%(process, hash_post)) - new_file = '%s%s\n'%(new_file, line) - elif line.startswith('date_%s'%process): - line = line.replace(line, 'date_%s = "%s"'%(process, nowdate())) - new_file = '%s%s\n'%(new_file, line) - else: - if new_file: new_file = '%s%s'%(new_file, line) - else: new_file = line - - try: - file = open(post_db, 'w') - file.write(new_file) - file.close() - except: - logs.out("1", post_db, True) + set_file(db_file, 'New', post_db) #===================================# diff --git a/src/var/lib/tyto/program/wip.py b/src/var/lib/tyto/program/wip.py index d4cf7b7..42722c6 100644 --- a/src/var/lib/tyto/program/wip.py +++ b/src/var/lib/tyto/program/wip.py @@ -176,11 +176,15 @@ def wip_article(target): wip_tabs() # make HTML tabulations # Replace in DB hash_wip and date_wip - tyto.replace_in_db(db.config, 'wip', db.hash_post) + db_values = \ + [ + ("date_wip", '"%s"'%db.date_wip, '"%s"'%tyto.nowdate()), + ("hash_wip", '"%s"'%db.hash_wip, '"%s"'%db.hash_post) + ] + tyto.change_in_db(db.config, db_values) # Get article DB in html.py html.set_page(db.uri_file, post_bottom) - #print(html.main_page) # Create wip file if os.makedirs('%s%s'%(dom.srv_wip, db.direc_src), exist_ok=True): @@ -190,6 +194,10 @@ def wip_article(target): # Copy needed files (Also create sub-folders) tyto.files_to_srv('wip') + # Making article static (on demand) + if args.option == "--static": + wip_static() + #=================================# # Create string article from file # @@ -215,6 +223,33 @@ def file_to_string(post_file): else: post_header = '%s\n%s'%(post_header, line) +#=========================================# +# Create real static page, by # +# including modules contents in HTML page # +# (optional) on demande with --static +#-----------------------------------------# +def wip_static(): + importlib.reload(db) + if not db.file_wip: + return + + print(' ├─ %s > %s'%(langs.site.wip_in_mod, db.post_wip)) + + wip_html_post = open(db.post_wip, 'r').read() + for module in dom.wip_html_mods: + wip_module = open(module, 'r').read() + wip_html_post = \ + wip_html_post.replace( + tyto.tags_html_mods[module], + wip_module + ) + tyto.set_file(db.post_wip, "New", wip_html_post) + + # Change status in db + db_values = [("static_wip", '%s'%db.static_wip, 'True')] + tyto.change_in_db(db.config, db_values) + + #===============================================================# # Simple function to replace source text to HTML in post_bottom # #---------------------------------------------------------------# @@ -274,8 +309,7 @@ def wip_words_tags(): for ln, line in enumerate(post_bottom.rsplit('\n')): - # Paragraphs - # Open tag + # Paragraphs Open tag if db.paragraphs > 0: if line.startswith(tyto.words_tags[10][0]): set_css = tyto.get_css(line) @@ -287,6 +321,19 @@ def wip_words_tags(): replace_in_post(line, tyto.words_tags[10][3] ) + + # div Open tag + if line.startswith(tyto.words_tags[14][0]): + set_css = tyto.get_css(line) + replace_in_post(post_bottom.rsplit('\n')[ln], + tyto.words_tags[14][2]%set_css + ) + # Close paragraph tag + elif line.startswith(tyto.words_tags[14][1]): + replace_in_post(line, + tyto.words_tags[14][3] + ) + # Open anchors link if db.anchors == 0: continue @@ -392,7 +439,7 @@ def wip_images(): '%s' + ' title="%s"%s>' # Check each line for ln, line in enumerate(post_bottom.rsplit('\n')): diff --git a/src/var/lib/tyto/translations/logs_en.py b/src/var/lib/tyto/translations/logs_en.py index 88a7436..584b4d0 100644 --- a/src/var/lib/tyto/translations/logs_en.py +++ b/src/var/lib/tyto/translations/logs_en.py @@ -53,19 +53,19 @@ post_val = "Article is valid" # wip nywip = "Article not yet wip" was_wip = "Article was 'wip'" -post_nwi = "Article not in 'wip'" -st_wip_n = "Unused 'wip' status" -st_wip_o = "Old 'wip' status" -post_wip = "Article is in 'wip'" # www was_pub = "Article was published" -post_nww = "Article not in 'www'" -st_www_n = "Unused 'www' status" -st_www_o = "Old 'www' status" -post_www = "Article is in 'www'" # Misc +post_nfd = "Page not found" +post_yfd = "Page found" +static_y = "Page is static" +static_n = "Page not static" +status_n = "Status: unused" +status_o = "Status: old" +status_s = "Status: up to date" + check_m = "Check manually" post_chg = "Article changed: 'check' it first" sep_inv = "Unused separator in article" diff --git a/src/var/lib/tyto/translations/logs_fr.py b/src/var/lib/tyto/translations/logs_fr.py index 26a96eb..ec65f5c 100644 --- a/src/var/lib/tyto/translations/logs_fr.py +++ b/src/var/lib/tyto/translations/logs_fr.py @@ -52,19 +52,21 @@ post_val = "Article valide" # Wip nywip = "Article pas encore 'wip'" was_wip = "Article déjà 'wip'" -post_nwi = "Article non présent dans 'wip'" -st_wip_n = "Statut 'wip' Non présent" -st_wip_o = "Statut 'wip' Ancien" -post_wip = "Article présent dans 'wip'" + # www was_pub = "Article déjà publié" -post_nww = "Article non présent dans 'www'" -st_www_n = "Statut 'www' Non présent" -st_www_o = "Statut 'www' Ancien" -post_www = "Article présent dans 'www'" + # Misc +post_nfd = "Page non présente" +post_yfd = "Page présente" +static_y = "Page statique" +status_n = "Statut : non présent" +status_o = "Statut : ancien" +status_s = "Statut : à jour" + +static_n = "Page non statique" check_m = "Vérifier manuellement" post_chg = "Article modifié : commencer par 'check'" sep_inv = "Séparateur manquant dans l'article" diff --git a/src/var/lib/tyto/translations/site_en.py b/src/var/lib/tyto/translations/site_en.py index 92ce345..113d9a6 100644 --- a/src/var/lib/tyto/translations/site_en.py +++ b/src/var/lib/tyto/translations/site_en.py @@ -79,6 +79,7 @@ wip_new = "Create a new HTML page in 'wip' server again" srv_again = "Create again converted HTMl pages in server" srv_added = "Create missing HTML pages in server" srv_updated = "Update HTMl pages in server" +wip_in_mod = "Include static module" # publish publish_a = "Publish again this article" diff --git a/src/var/lib/tyto/translations/site_fr.py b/src/var/lib/tyto/translations/site_fr.py index 78d7ddc..db92258 100644 --- a/src/var/lib/tyto/translations/site_fr.py +++ b/src/var/lib/tyto/translations/site_fr.py @@ -79,6 +79,7 @@ wip_new = "Créer encore une page HTML dans le serveur 'wip'" srv_again = "Créer encore les pages dans le serveur" srv_added = "Créer les pages HTML manquantes dans le serveur" srv_updated = "Mise à jour des pages HTML dans le serveur" +wip_in_mod = "Intégration statique des modules" # publish publish_a = "Publier encore l'article" From 49adf951ef282acad525a013c7c7037f5f731af1 Mon Sep 17 00:00:00 2001 From: Cyrille L Date: Mon, 17 Apr 2023 01:45:52 +0200 Subject: [PATCH 3/4] [0.10.1] - Fix with try when checking static page --- CHANGELOG.md | 3 +++ debian/control | 2 +- src/usr/bin/tyto | 2 +- src/var/lib/tyto/program/check.py | 19 +++++++++++-------- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f55a244..cc26f21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ Tyto - Littérateur - Changelog: https://git.a-lec.org/echolib/tyto-litterateur/-/blob/master/CHANGELOG.md - License: https://git.a-lec.org/echolib/tyto-litterateur/-/blob/master/LICENSE +## [0.10.1] +- Fix with try in check for static page + ## [0.10.0] - Add full static page option (--static) only with wip - Add
markers: `<<`, `>>` diff --git a/debian/control b/debian/control index 59ae9da..066e25c 100644 --- a/debian/control +++ b/debian/control @@ -1,5 +1,5 @@ Package: tyto -Version: 0.10.0 +Version: 0.10.1 Section: custom Priority: optional Architecture: all diff --git a/src/usr/bin/tyto b/src/usr/bin/tyto index c6c2314..042c35d 100755 --- a/src/usr/bin/tyto +++ b/src/usr/bin/tyto @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# Version: 0.10.0 +# Version: 0.10.1 # Tyto - Littérateur # # Copyright (C) 2023 Cyrille Louarn diff --git a/src/var/lib/tyto/program/check.py b/src/var/lib/tyto/program/check.py index c8ff824..5ecd487 100644 --- a/src/var/lib/tyto/program/check.py +++ b/src/var/lib/tyto/program/check.py @@ -873,8 +873,8 @@ def check_content(post_bottom): tpl2 = post_bottom.count(tag[1]) if tpl1 != tpl2: - logs.out("22", '"%s" + "%s" > %s'%( - tag[0], tag[1], db.uri_file + logs.out("22", '%s*%s + %s*%s > %s'%( + tpl1, tag[0], tpl2, tag[1], db.uri_file ), False) @@ -892,12 +892,15 @@ def check_static_posts(): ] for srv_post, static in srv_posts: - post_datas = open(srv_post, "r").read() - if not re.findall( - tyto.tags_html_mods[dom.wip_metas_f], - post_datas - ): - globals()[static] = "True" + try: + post_datas = open(srv_post, "r").read() + if not re.findall( + tyto.tags_html_mods[dom.wip_metas_f], + post_datas + ): + globals()[static] = "True" + except: + continue #===============================# From 1b13f8e1dfd4416da2db18b8bdd44cc1ba0f8d97 Mon Sep 17 00:00:00 2001 From: Cyrille L Date: Tue, 18 Apr 2023 12:32:14 +0200 Subject: [PATCH 4/4] [0.10.2] --- CHANGELOG.md | 5 ++++ README.md | 4 +-- debian/control | 2 +- src/usr/bin/tyto | 2 +- src/var/lib/tyto/program/check.py | 47 ++++++++++++++++++++----------- src/var/lib/tyto/program/tyto.py | 40 +++++++++++++++----------- src/var/lib/tyto/program/wip.py | 40 +++++++++++++------------- 7 files changed, 84 insertions(+), 56 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc26f21..8ccc2f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ Tyto - Littérateur - Changelog: https://git.a-lec.org/echolib/tyto-litterateur/-/blob/master/CHANGELOG.md - License: https://git.a-lec.org/echolib/tyto-litterateur/-/blob/master/LICENSE +## [0.10.2] +- Citer dans un texte > `[_` + `_]` +- Italique `` > `;_` + `_;` +- Italique `` > {_:_` + `_:` + ## [0.10.1] - Fix with try in check for static page diff --git a/README.md b/README.md index 4838990..c4660b0 100644 --- a/README.md +++ b/README.md @@ -149,10 +149,10 @@ Vous pouvez avoir un Nom identique pour les marqueurs `file:` et `link:` ``` *_très gras_* # +_gras léger_+ # -/_en italique_/ # +;_en italique_; # :_en italique_: # ~_texte barré_~ # -@_Citation rapide_@ # +[_Citation rapide_] # %_Classe personnalisée_% >>> ._Souligné_. # {_Code_} # diff --git a/debian/control b/debian/control index 066e25c..77c6364 100644 --- a/debian/control +++ b/debian/control @@ -1,5 +1,5 @@ Package: tyto -Version: 0.10.1 +Version: 0.10.2 Section: custom Priority: optional Architecture: all diff --git a/src/usr/bin/tyto b/src/usr/bin/tyto index 042c35d..e4e7998 100755 --- a/src/usr/bin/tyto +++ b/src/usr/bin/tyto @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# Version: 0.10.1 +# Version: 0.10.2 # Tyto - Littérateur # # Copyright (C) 2023 Cyrille Louarn diff --git a/src/var/lib/tyto/program/check.py b/src/var/lib/tyto/program/check.py index 5ecd487..144d08b 100644 --- a/src/var/lib/tyto/program/check.py +++ b/src/var/lib/tyto/program/check.py @@ -343,19 +343,19 @@ def if_icodes_bcodes_quotes(post_bottom): continue # quotes - elif line.startswith(tyto.words_tags[11][0]) and not in_bcode: + elif line.startswith(tyto.block_tags[1][0]) and not in_bcode: quote = in_quote = in_bq = True continue - elif line.startswith(tyto.words_tags[11][1]): + elif line.startswith(tyto.block_tags[1][1]): in_quote = False nbr_quotes += 1 continue # bcode - elif line.startswith(tyto.words_tags[12][0]) and not in_quote: + elif line.startswith(tyto.block_tags[2][0]) and not in_quote: bcode = in_bcode = in_bq = True continue - elif line.startswith(tyto.words_tags[12][1]): + elif line.startswith(tyto.block_tags[2][1]): in_bcode = False nbr_bcodes += 1 continue @@ -781,14 +781,29 @@ def check_content(post_bottom): for tag in tyto.words_tags: c_opened = c_closed = 0 - if tag[5] == 'w': - c_opened = post_bottom.count(tag[0]) - c_closed = post_bottom.count(tag[1]) - # Useless tag now, replace - post_bottom = post_bottom.replace(tag[0], '') - post_bottom = post_bottom.replace(tag[1], '') - elif tag[5] == 't': - for line in post_bottom.rsplit('\n'): + c_opened = post_bottom.count(tag[0]) + c_closed = post_bottom.count(tag[1]) + # Useless tag now, replace + post_bottom = post_bottom.replace(tag[0], '') + post_bottom = post_bottom.replace(tag[1], '') + + if c_opened != c_closed: + logs.out("8", '%s "%s" + "%s" > %s'%( + tag[4], tag[0], tag[1], db.uri_file + ), False) + post_err = True + + else: + globals()['post_%s'%tag[4]] = int(c_opened) + + + # Check block tags paragraphs, qyotes...) + # Set stats for each one + #------------------------------------------- + for tag in tyto.block_tags: + c_opened = c_closed = 0 + + for line in post_bottom.rsplit('\n'): if line.startswith(tag[0]): c_opened += 1 if line.startswith(tag[1]): c_closed += 1 @@ -797,7 +812,7 @@ def check_content(post_bottom): tag[4], tag[0], tag[1], db.uri_file ), False) post_err = True - return # Useless and could code errors to check nexts + else: globals()['post_%s'%tag[4]] = int(c_opened) @@ -813,10 +828,10 @@ def check_content(post_bottom): if post_lists > 0: inlist = False for ln, line in enumerate(post_bottom.rsplit('\n'), 1): - if line.startswith(tyto.words_tags[13][0]): + if line.startswith(tyto.block_tags[3][0]): inlist = True continue - elif line.startswith(tyto.words_tags[13][1]): + elif line.startswith(tyto.block_tags[3][1]): inlist = False if not inlist: @@ -825,7 +840,7 @@ def check_content(post_bottom): if inlist and not line or not line[0] in tyto.markers_lists: logs.out("3", 'L=%s. %s %s > %s'%( ln + ln_header, - tyto.words_tags[13][4], + tyto.block_tags[3][4], tyto.markers_lists, db.uri_file ), False) diff --git a/src/var/lib/tyto/program/tyto.py b/src/var/lib/tyto/program/tyto.py index 01b4c57..8a33bb7 100644 --- a/src/var/lib/tyto/program/tyto.py +++ b/src/var/lib/tyto/program/tyto.py @@ -105,21 +105,29 @@ headers = \ # [6] = Check content differently. 't' = startswith #------------------------------------------------------------- words_tags = [ -('>_', '_<', '', '', 'anchors', 'w'), +('>_', '_<', + '', + '', 'anchors', 'w' +), ('*_', '_*', '', '', 'strongs', 'w'), ('+_', '_+', '', '', 'bolds', 'w'), -('/_', '_/', '', '', 'emphasis', 'w'), +(';_', '_;', '', '', 'emphasis', 'w'), (':_', '_:', '', '', 'italics', 'w'), ('~_', '_~', '', '', 'dels', 'w'), ('._', '_.', '', '', 'underlines', 'w'), -('@_', '_@', '', '', 'cites', 'w'), +('[_', '_]', '', '', 'cites', 'w'), ('%_', '_%', '', '', 'customs', 'w'), ('{_', '_}', '', '', 'codes', 'w'), -('((', '))', '

', '

', 'paragraphs', 't'), -('[[', ']]', '[[', ']]', 'quotes', 't'), -('{{', '}}', '{{', '}}', 'bcodes', 't'), -('-(', '-)', '-(', '-)', 'lists', 't'), -('<<', '>>', '
', '
', 'div', 't') +] + +# At begining line, create block contents +block_tags = \ +[ +('((', '))', '

', '

', 'paragraphs'), +('[[', ']]', '[[', ']]', 'quotes'), +('{{', '}}', '{{', '}}', 'bcodes'), +('-(', '-)', '-(', '-)', 'lists'), +('<<', '>>', '
', '
', 'div'), ] # Tags that do not need to be paired @@ -132,10 +140,10 @@ single_tags = [ # When counting words, do no count line starting with: nolinewords = \ ( -words_tags[10][0], words_tags[10][1], # paragraphs -words_tags[11][0], words_tags[11][1], # quotes -words_tags[12][0], words_tags[12][1], # bcodes -words_tags[13][0], words_tags[13][1], # lists +block_tags[0][0], block_tags[0][1], # paragraphs +block_tags[1][0], block_tags[1][1], # quotes +block_tags[2][0], block_tags[2][1], # bcodes +block_tags[3][0], block_tags[3][1], # lists single_tags[0][0], single_tags[1][0], # New line, anchor '_%s:'%opt_header_tags[1], '_%s:'%opt_header_tags[4], # _image:, _raw: '_%s:'%opt_header_tags[5] # _code @@ -328,10 +336,10 @@ def protect_bcodes_quotes(process, post_bottom): #---------------------- # Bcode (at close, replace with base64) if not in_quote: - if line.startswith(words_tags[12][0]): # Open + if line.startswith(block_tags[2][0]): # Open start_bcode = True in_bcode = True - elif line.startswith(words_tags[12][1]): # Close + elif line.startswith(block_tags[2][1]): # Close close_bcode = True in_bcode = False if process == "wip": @@ -342,10 +350,10 @@ def protect_bcodes_quotes(process, post_bottom): # Quote (at close, replace with base64) if not in_bcode: - if line.startswith(words_tags[11][0]): # Open + if line.startswith(block_tags[1][0]): # Open start_quote = True in_quote = True - elif line.startswith(words_tags[11][1]): # Close + elif line.startswith(block_tags[1][1]): # Close close_quote = True in_quote = False if process == "wip": diff --git a/src/var/lib/tyto/program/wip.py b/src/var/lib/tyto/program/wip.py index 42722c6..47c56da 100644 --- a/src/var/lib/tyto/program/wip.py +++ b/src/var/lib/tyto/program/wip.py @@ -311,27 +311,27 @@ def wip_words_tags(): for ln, line in enumerate(post_bottom.rsplit('\n')): # Paragraphs Open tag if db.paragraphs > 0: - if line.startswith(tyto.words_tags[10][0]): + if line.startswith(tyto.block_tags[0][0]): set_css = tyto.get_css(line) replace_in_post(post_bottom.rsplit('\n')[ln], - tyto.words_tags[10][2]%set_css + tyto.block_tags[0][2]%set_css ) # Close paragraph tag - elif line.startswith(tyto.words_tags[10][1]): + elif line.startswith(tyto.block_tags[0][1]): replace_in_post(line, - tyto.words_tags[10][3] + tyto.block_tags[0][3] ) # div Open tag - if line.startswith(tyto.words_tags[14][0]): + if line.startswith(tyto.block_tags[4][0]): set_css = tyto.get_css(line) replace_in_post(post_bottom.rsplit('\n')[ln], - tyto.words_tags[14][2]%set_css + tyto.block_tags[4][2]%set_css ) # Close paragraph tag - elif line.startswith(tyto.words_tags[14][1]): + elif line.startswith(tyto.block_tags[4][1]): replace_in_post(line, - tyto.words_tags[14][3] + tyto.block_tags[4][3] ) # Open anchors link @@ -541,7 +541,7 @@ def wip_quotes() : for qline in quote: # Begin marker quote [11] - if qline.startswith(tyto.words_tags[11][0]): + if qline.startswith(tyto.block_tags[1][0]): set_css = tyto.get_css(qline) continue @@ -550,7 +550,7 @@ def wip_quotes() : # Paragraph [10] Open # Construct quote_html - if qline.startswith(tyto.words_tags[10][0]): + if qline.startswith(tyto.block_tags[0][0]): par_css = tyto.get_css(qline) # Set tabulation for paragraphs and content @@ -559,7 +559,7 @@ def wip_quotes() : # Replace opened paragrph with html line qline_html = '%s%s'%( - tab_p * ' ', tyto.words_tags[10][2]%par_css + tab_p * ' ', tyto.block_tags[0][2]%par_css ) # Add line to quote_html @@ -570,16 +570,16 @@ def wip_quotes() : continue # Paragraph Close - if qline.startswith(tyto.words_tags[10][1]): + if qline.startswith(tyto.block_tags[0][1]): # Replace closed paragrph with html line - qline_html = tyto.words_tags[10][3] + qline_html = tyto.block_tags[0][3] quote_html = '%s\n%s%s'%( quote_html, int(tab_p) * ' ', qline_html ) continue # End of marker quote - if qline.startswith(tyto.words_tags[11][1]): + if qline.startswith(tyto.block_tags[1][1]): continue # Add other lines @@ -694,14 +694,14 @@ def wip_bcodes(): # Convert src_bcode for line in src_bcode.rsplit('\n'): # CSS + opened marker - if line.startswith(tyto.words_tags[12][0]): + if line.startswith(tyto.block_tags[2][0]): set_css = tyto.get_css(line) html_bcode = \ '\n'%set_css + \ '
'
       
       # closed marker
-      elif line.startswith(tyto.words_tags[12][1]):
+      elif line.startswith(tyto.block_tags[2][1]):
         html_bcode = \
         '%s\n  
\n'%html_bcode + \ '
' @@ -829,7 +829,7 @@ def wip_lists(): for line in post_bottom.rsplit('\n'): # Open list - if line.startswith(tyto.words_tags[13][0]): + if line.startswith(tyto.block_tags[3][0]): block_list = content_list = '' css = tyto.get_css(line) in_list = True @@ -837,7 +837,7 @@ def wip_lists(): continue # Close list - elif line.startswith(tyto.words_tags[13][1]): + elif line.startswith(tyto.block_tags[3][1]): in_list = False block_list = '%s\n%s'%(block_list, line) html_list = convert_list( @@ -909,8 +909,8 @@ def convert_list(markdown_str): work_str = "" for i in range(len(items)): - if tyto.words_tags[13][0] in items[i] or \ - tyto.words_tags[13][1] in items[i]: + if tyto.block_tags[3][0] in items[i] or \ + tyto.block_tags[3][1] in items[i]: continue rank = cur_rank