Makefile: fix a bug with making deb (segfault) and adding proper licensing notice #1

Closed
neox wants to merge 6 commits from neox-patch-1 into master
21 changed files with 428 additions and 264 deletions
Showing only changes of commit 8dcbfcdd0a - Show all commits

View File

@ -6,5 +6,27 @@ 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 `<em>` > `;_` + `_;`
- Italique `<i>` > {_:_` + `_:`
## [0.10.1]
- Fix with try in check for static page
## [0.10.0]
- Add full static page option (--static) only with wip
- Add <div> markers: `<<`, `>>`
- Add new container <div> in footer
- Better status display for article
- fix lang setting
- fix for less warnings in HTML validity
## [0.9.1]
- wip: tabulation when using `<hr />`
- wip: inline quote markers `@_myquote_@`
- wip: inline italic marker `:_maybe_:`
- wip: fix data retreive in complete quote
## [0.9.0]
- Last testings before final

View File

@ -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 <div> 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
<h1 class="title_1">Titre 1</h1>
<div class="content_title">
Contenu 1
</div>
<h2 class="title_2">Titre 2</h2>
<h3 class="title_3">Titre 3</h3>
<div class="content_title">
contenu 2
</div>
<h4 class="title_4">Titre 4</h4>
### 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
<a href="id2"></a>
# Source de l'ancre d'appel
# Définir l'identité cible et le texte du lien
((
>_id:Retourner au point d'ancre id_<
))
# HTML
<a class="anchor" href="#id">Retourner au point d'ancre id</a>
```
### Retour à la ligne HTML
@ -135,28 +129,30 @@ 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...
```
*_très gras_* # <strong>
+_gras léger_+ # <b>
/_en italique_/ # <em>
[_en italique_] # <i>
;_en italique_; # <em>
:_en italique_: # <i>
~_texte barré_~ # <del>
:_Citation rapide_: # <cite>
[_Citation rapide_] # <cite>
%_Classe personnalisée_% >>> <span class="custom">
._Souligné_. # <u>
{_Code_} # <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
<figure class="CSS_TEST">
<blockquote class="CSS_TEST" lang="fr" cite="https://tyto.echolib.re" title="echolib - Reference (2022-12-28)">
<time datetime="2022-12-28">
<p class="tyto">
Pfff, vraiment !
</p>
</time>
</blockquote>
<figcaption class="CSS_TEST">
<a class="figc" href="https://tyto.echolib.re">echolib - Reference (2022-12-28)</a>
</figcaption>
</figure>
````
```
# Source: citation basique
[[
Une citation simple, et sans paragraphe
]]
# HTML
<blockquote class="tyto">
Une citation simple, et sans paragraphe
</blockquote>
```

2
debian/control vendored
View File

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

View File

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

View File

@ -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 {
}

View File

@ -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)

View File

@ -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)
@ -873,44 +888,75 @@ 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)
#==============================================#
# 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:
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
#===============================#
# 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)

View File

@ -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',

View File

@ -268,6 +268,27 @@ if not hole:
"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 #
#------------------------------------#

View File

@ -760,10 +760,10 @@ def create_metas(option):
'# <meta property="og:description" ...\n' + \
'# <meta property="og:image" ...\n' + \
'# %s\n\n'%(15 * "-") + \
'<meta charset="UTF-8" />\n' + \
'<meta name="robots" content="all" />\n' + \
'<meta name="medium" content="website" />\n' + \
'<meta name="revisit-after" content="3 days" />'
'<meta charset="UTF-8">\n' + \
'<meta name="robots" content="all">\n' + \
'<meta name="medium" content="website">\n' + \
'<meta name="revisit-after" content="3 days">'
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 = \
' <li class="footer_item">%s%s \n'%(
' <li class="footer_item">%s%s \n'%(
langs.site.read, langs.site.pp
) + \
' %s\n'%footer_laws + \
' </li>\n'
' </li>\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) + \
'<footer id="footer_page">\n' + \
' <div id="footer_infos">\n' + \
' <h1 id="footer_site_title"\n' + \
' title="%s %s">%s %s\n'%(
' <div id="footer_container"> \n' + \
' <div id="footer_infos">\n' + \
' <h1 id="footer_site_title"\n' + \
' title="%s %s">%s %s\n'%(
langs.site.add_inf, dom.title,
langs.site.about, dom.title
) + \
' </h1>\n' + \
' </h1>\n' + \
'%s\n'%(footer_about) + \
' </div>\n' + \
' </div>\n' + \
'\n' + \
' <div id="footer_references">\n' + \
' <ul class="footer_items">\n' + \
' <div id="footer_references">\n' + \
' <ul class="footer_items">\n' + \
'%s'%footer_laws_links + \
' <li class="footer_item">%s%s\n'%(
' <li class="footer_item">%s%s\n'%(
langs.site.licence, langs.site.pp
) + \
' <a href="%s"\n'%dom.license_url + \
' title="%s - %s"\n'%(langs.site.licence, dom. title) + \
' class="footer_item_link">%s</a>\n'%(dom.license) + \
' </li>\n' + \
' <li class="footer_item">%s%s \n'%(
' <a href="%s"\n'%dom.license_url + \
' title="%s - %s"\n'%(langs.site.licence, dom. title) + \
' class="footer_item_link">%s</a>\n'%(dom.license) + \
' </li>\n' + \
' <li class="footer_item">%s%s \n'%(
langs.site.contact, langs.site.pp
) + \
' <a href="mailto:%s"\n'%dom.mail + \
' title="%s %s"\n'%(langs.site.mail_to, dom.title) + \
' class="footer_item_link">%s</a>\n'%(langs.site.mail) + \
' </li>\n' + \
' <li class="footer_item">%s%s \n'%(
' <a href="mailto:%s"\n'%dom.mail + \
' title="%s %s"\n'%(langs.site.mail_to, dom.title) + \
' class="footer_item_link">%s</a>\n'%(langs.site.mail) + \
' </li>\n' + \
' <li class="footer_item">%s%s \n'%(
langs.site.feed, langs.site.pp
) + \
' <a href="%s/%s"\n'%(dom.www_url, dom.rss) + \
' title="RSS 2.0 - %s"\n'%dom.title + \
' class="footer_item_link">RSS 2.0</a>\n' + \
' </li>\n' + \
' </ul>\n' + \
' <a href="%s/%s"\n'%(dom.www_url, dom.rss) + \
' title="RSS 2.0 - %s"\n'%dom.title + \
' class="footer_item_link">RSS 2.0</a>\n' + \
' </li>\n' + \
' </ul>\n' + \
' </div>\n' + \
' </div>\n' + \
' <div id="footer_credits">\n' + \
' <p class="footer_copyright">Copyright%s © %s %s</p>\n'%(

View File

@ -84,29 +84,29 @@ def create_metas_page():
#-----------------------
global metas
metas = \
'<!--# include virtual="/template/metas.html"-->\n' + \
' <meta name="viewport" content="%s" />\n'%scale + \
' <meta name=”url” content=”%s />\n'%dom.www_url + \
' <meta name="language" content="%s" />\n'%dom.lang_site + \
' <meta name="reply-to" content="%s" />\n'%dom.mail + \
' <meta name="copyright" content="%s" />\n'%dom.license + \
' <meta name="generator" content="%s" />\n'%tyto.Tyto + \
' <meta name="title" content="%s" />\n'%db.title + \
' <meta name="author" content="%s" />\n'%db.author + \
' <meta name="description" content="%s" />\n'%db.about + \
' <meta name="keywords" content="%s" />\n'%all_tags + \
tyto.tags_html_mods[dom.wip_metas_f] + '\n' + \
' <meta name="viewport" content="%s">\n'%scale + \
' <meta name=”url” content=”%s>\n'%dom.www_url + \
' <meta name="language" content="%s">\n'%dom.lang_site + \
' <meta name="reply-to" content="%s">\n'%dom.mail + \
' <meta name="copyright" content="%s">\n'%dom.license + \
' <meta name="generator" content="%s">\n'%tyto.Tyto + \
' <meta name="title" content="%s">\n'%db.title + \
' <meta name="author" content="%s">\n'%db.author + \
' <meta name="description" content="%s">\n'%db.about + \
' <meta name="keywords" content="%s">\n'%all_tags + \
'%s'%meta_pub + \
' <link rel="canonical" href="%s" />\n'%db.http_www + \
' <link rel="alternate" %s />\n'%(rss_ref) + \
' <link rel="stylesheet" %s />\n'%css_ref + \
' <link rel="shortcut icon" %s />\n'%icon_ref + \
' <link rel="canonical" href="%s">\n'%db.http_www + \
' <link rel="alternate" %s>\n'%(rss_ref) + \
' <link rel="stylesheet" %s>\n'%css_ref + \
' <link rel="shortcut icon" %s>\n'%icon_ref + \
' <!-- Open Graph data -->\n' + \
' <meta property="og:site_name" content="%s" />\n'%dom.title + \
' <meta property="og:title" content="%s" />\n'%db.title + \
' <meta property="og:type" content="article" />\n' + \
' <meta property="og:url" content="%s" />\n'%db.http_www + \
' <meta property="og:description" content="%s" />\n'%db.about + \
' <meta property="og:image" content="%s" />\n'%db.snpic + \
' <meta property="og:site_name" content="%s">\n'%dom.title + \
' <meta property="og:title" content="%s">\n'%db.title + \
' <meta property="og:type" content="article">\n' + \
' <meta property="og:url" content="%s">\n'%db.http_www + \
' <meta property="og:description" content="%s">\n'%db.about + \
' <meta property="og:image" content="%s">\n'%db.snpic + \
'%s'%relme + \
' <title>%s %s %s</title>'%(db.title, dom.sep, dom.title)
@ -129,7 +129,7 @@ def create_main_page(target, article_bottom):
10 * " ", db.sub_uri, dom.logo
) + \
'%salt="logo: %s"\n'%(15 * " ", dom.title) + \
'%sid="site_logo_image" />\n'%(15 * " ") + \
'%sid="site_logo_image">\n'%(15 * " ") + \
'%s</a>'%(8 * " ")
post_html_code = ''
@ -166,8 +166,7 @@ def create_main_page(target, article_bottom):
' <p id="site_about">%s</p>\n'%dom.about + \
' </div>\n' + \
' </header>\n' + \
'<!--# include virtual="/template/navbar.html"-->\n' + \
'\n' + \
tyto.tags_html_mods[dom.wip_navbar_f] + '\n' + \
' <article id="article_main">\n' + \
' <h1 id="main_title"\n' + \
' title="[%s] %s %s %s %s">%s</h1>\n'%(
@ -176,7 +175,7 @@ def create_main_page(target, article_bottom):
db.title,
) + \
'%s\n'%article_bottom + \
' <section id="article_infos">\n' + \
' <div id="article_infos">\n' + \
' <p>\n' + \
' <span id="article_author"\n' + \
' title="%s %s [%s]">%s</span>, %s\n'%(
@ -186,11 +185,11 @@ def create_main_page(target, article_bottom):
'%s\n'%time_html_pub + \
'%s'%post_html_code + \
' </p>\n' + \
' </section>\n' + \
' </div>\n' + \
' </article>\n' + \
'\n' + \
'<!--# include virtual="/template/sidebar.html"-->\n' + \
'<!--# include virtual="/template/footer.html"-->\n' + \
tyto.tags_html_mods[dom.wip_sidebar_f] + '\n' + \
tyto.tags_html_mods[dom.wip_footer_f] + '\n' + \
' </body>\n' + \
'</html>'
@ -239,7 +238,7 @@ def create_html_time_meta(process):
# meta search_date=
meta_pub = \
'<!--Tyto_Meta--> <meta name="search_date" content="%s" />\n'%(
'<!--Tyto_Meta--> <meta name="search_date" content="%s">\n'%(
date_raw.rsplit(' ')[0]
)
@ -305,7 +304,7 @@ def create_navbar(option):
# Set first HTML line
menu_html = \
'%s<nav id="site_menu">\n'%(4 * ' ') + \
'%s<ul id="site_menu_items">'%(6 * ' ')
'%s<menu id="site_menu_items">'%(6 * ' ')
navbar_lines = open(dom.navbar_f, 'r').read()
@ -382,7 +381,7 @@ def create_navbar(option):
# Create ending HTML file
else:
menu_html = '\n%s\n%s</ul>\n%s</nav>\n'%(menu_html, 8 * ' ', 6 * ' ')
menu_html = '\n%s\n%s</menu>\n%s</nav>\n'%(menu_html, 6 * ' ', 4 * ' ')
tyto.set_file(target, 'New', menu_html)

View File

@ -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)

View File

@ -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
}

View File

@ -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')

View File

@ -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

View File

@ -105,36 +105,45 @@ headers = \
# [6] = Check content differently. 't' = startswith
#-------------------------------------------------------------
words_tags = [
('>_', '_<', '<a class="anchor_link" href="#%s">', '</a>', 'anchors', 'w'),
('>_', '_<',
'<a class="anchor_link" href="#%s">',
'</a>', 'anchors', 'w'
),
('*_', '_*', '<strong class="strong">', '</strong>', 'strongs', 'w'),
('+_', '_+', '<b class="bold">', '</b>', 'bolds', 'w'),
('/_', '_/', '<em class="em">', '</em>', 'emphasis', 'w'),
('[_', '_]', '<i class="italic">', '</i>', 'italics', 'w'),
(';_', '_;', '<em class="em">', '</em>', 'emphasis', 'w'),
(':_', '_:', '<i class="italic">', '</i>', 'italics', 'w'),
('~_', '_~', '<del class="del">', '</del>', 'dels', 'w'),
('._', '_.', '<u class="underline">', '</u>', 'underlines', 'w'),
(':_', '_:', '<cite class="cite">', '</cite>', 'cites', 'w'),
('[_', '_]', '<cite class="cite">', '</cite>', 'cites', 'w'),
('%_', '_%', '<span class="custom">', '</span>', 'customs', 'w'),
('{_', '_}', '<code class="icode">', '</code>', 'codes', 'w'),
('((', '))', '<p class="%s">', '</p>', 'paragraphs', 't'),
('[[', ']]', '[[', ']]', 'quotes', 't'),
('{{', '}}', '{{', '}}', 'bcodes', 't'),
('-(', '-)', '-(', '-)', 'lists', 't')
]
# At begining line, create block contents
block_tags = \
[
('((', '))', '<p class="%s">', '</p>', 'paragraphs'),
('[[', ']]', '[[', ']]', 'quotes'),
('{{', '}}', '{{', '}}', 'bcodes'),
('-(', '-)', '-(', '-)', 'lists'),
('<<', '>>', '<div class="%s">', '</div>', 'div'),
]
# Tags that do not need to be paired
#-----------------------------------
single_tags = [
('|', '<br class="%s" />'), # New Line
('->', '<a class="anchor_target" id="%s"></a>') # Anchors
('->', '<a class="anchor_target" id="%s"></a>'), # Anchors
]
# 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
@ -182,6 +191,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 : '<!--# include virtual="/template/navbar.html"-->',
dom.wip_sidebar_f : '<!--# include virtual="/template/sidebar.html"-->',
dom.wip_metas_f : '<!--# include virtual="/template/metas.html"-->',
dom.wip_footer_f : '<!--# include virtual="/template/footer.html"-->'
}
# Valid characters for some datas
chrs_invalid = \
set('{}[]_()+*=/:%~´')
@ -269,7 +287,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)
@ -318,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":
@ -332,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":
@ -474,32 +492,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)
#===================================#

View File

@ -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,19 +309,31 @@ 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]):
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.block_tags[4][0]):
set_css = tyto.get_css(line)
replace_in_post(post_bottom.rsplit('\n')[ln],
tyto.block_tags[4][2]%set_css
)
# Close paragraph tag
elif line.startswith(tyto.block_tags[4][1]):
replace_in_post(line,
tyto.block_tags[4][3]
)
# Open anchors link
if db.anchors == 0: continue
@ -392,7 +439,7 @@ def wip_images():
'<img class="%s"\n' + \
' src="%s"\n' + \
' alt="%s"\n' + \
' title="%s"%s />'
' title="%s"%s>'
# Check each line
for ln, line in enumerate(post_bottom.rsplit('\n')):
@ -467,7 +514,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)
#==========================#
@ -494,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
@ -503,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
@ -512,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
@ -523,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
@ -647,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 = \
'<code class="%s">\n'%set_css + \
' <pre class="bcode">'
# closed marker
elif line.startswith(tyto.words_tags[12][1]):
elif line.startswith(tyto.block_tags[2][1]):
html_bcode = \
'%s\n </pre>\n'%html_bcode + \
'</code>'
@ -782,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
@ -790,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(
@ -862,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
@ -953,7 +1000,8 @@ def wip_tabs():
elif line.startswith('<h'):
get_tab = line[2]
tab = tabs_hX[get_tab]
try: tab = tabs_hX[get_tab]
except: tab = 8
if not article_temp:
article_temp = '%s%s'%(int(tab) * ' ', line)
else:

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"