[0.10.3]
This commit is contained in:
parent
1b13f8e1df
commit
4825c25f63
|
@ -6,6 +6,9 @@ Tyto - Littérateur
|
||||||
- Changelog: https://git.a-lec.org/echolib/tyto-litterateur/-/blob/master/CHANGELOG.md
|
- 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
|
- License: https://git.a-lec.org/echolib/tyto-litterateur/-/blob/master/LICENSE
|
||||||
|
|
||||||
|
## {0.10.3]
|
||||||
|
- pre 1.0
|
||||||
|
|
||||||
## [0.10.2]
|
## [0.10.2]
|
||||||
- Citer dans un texte > `[_` + `_]`
|
- Citer dans un texte > `[_` + `_]`
|
||||||
- Italique `<em>` > `;_` + `_;`
|
- Italique `<em>` > `;_` + `_;`
|
||||||
|
|
10
README.md
10
README.md
|
@ -54,19 +54,17 @@ abbr: abbrev
|
||||||
# Les titres HTML vont de 1 à 6.
|
# Les titres HTML vont de 1 à 6.
|
||||||
# Utiliser #N, où N est entre 1 et 6.
|
# Utiliser #N, où N est entre 1 et 6.
|
||||||
# Si du contenu existe entre les titres, une <div> est ajoutée
|
# Si du contenu existe entre les titres, une <div> est ajoutée
|
||||||
# Astuce: on commence en général par #2 dans l'article le titre du site
|
|
||||||
# étant en #1
|
|
||||||
|
|
||||||
# Source
|
# Source
|
||||||
#2 Titre 1
|
#1 Titre 1
|
||||||
Contenu 1
|
Contenu 1
|
||||||
|
|
||||||
#3 Titre 2
|
#2 Titre 2
|
||||||
|
|
||||||
#4 Titre 3
|
#3 Titre 3
|
||||||
contenu 2
|
contenu 2
|
||||||
|
|
||||||
#5 Titre 4
|
#4 Titre 4
|
||||||
```
|
```
|
||||||
|
|
||||||
### Balise div
|
### Balise div
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
Package: tyto
|
Package: tyto
|
||||||
Version: 0.10.2
|
Version: 0.10.3
|
||||||
Section: custom
|
Section: custom
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Architecture: all
|
Architecture: all
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# Version: 0.10.2
|
# Version: 0.10.3
|
||||||
# Tyto - Littérateur
|
# Tyto - Littérateur
|
||||||
#
|
#
|
||||||
# Copyright (C) 2023 Cyrille Louarn <echolib+tyto@a-lec.org>
|
# Copyright (C) 2023 Cyrille Louarn <echolib+tyto@a-lec.org>
|
||||||
|
|
|
@ -52,10 +52,11 @@ a.site_menu_link {
|
||||||
article#article_main {
|
article#article_main {
|
||||||
}
|
}
|
||||||
|
|
||||||
h1#main_title {
|
/* article title */
|
||||||
}
|
h2#main_title {
|
||||||
h2.title_2 {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Writer titles*/
|
||||||
h3.title_3 {
|
h3.title_3 {
|
||||||
}
|
}
|
||||||
h4.title_4 {
|
h4.title_4 {
|
||||||
|
@ -65,9 +66,17 @@ h5.title_5 {
|
||||||
h6.title_6 {
|
h6.title_6 {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Between every <h2-6> IF CONTENTS */
|
/* Between every <h3-6> IF CONTENTS */
|
||||||
div.contents {
|
div.contents {
|
||||||
}
|
}
|
||||||
|
div.contents_3 {
|
||||||
|
}
|
||||||
|
div.contents_4 {
|
||||||
|
}
|
||||||
|
div.contents_5 {
|
||||||
|
}
|
||||||
|
div.contents_6 {
|
||||||
|
}
|
||||||
|
|
||||||
/* Default if not set in post */
|
/* Default if not set in post */
|
||||||
p.DOMAIN {
|
p.DOMAIN {
|
||||||
|
@ -138,7 +147,7 @@ a#article_code_link {
|
||||||
|
|
||||||
aside#sidebar {
|
aside#sidebar {
|
||||||
}
|
}
|
||||||
h1#sidebar_title {
|
h2#sidebar_title {
|
||||||
}
|
}
|
||||||
ul#sidebar_list {
|
ul#sidebar_list {
|
||||||
}
|
}
|
||||||
|
@ -146,7 +155,7 @@ li.sidebar_item {
|
||||||
}
|
}
|
||||||
a.sidebar_item_link {
|
a.sidebar_item_link {
|
||||||
}
|
}
|
||||||
h2.sidebar_item_title {
|
h3.sidebar_item_title {
|
||||||
}
|
}
|
||||||
p.sidebar_item_about {
|
p.sidebar_item_about {
|
||||||
}
|
}
|
||||||
|
@ -165,7 +174,7 @@ div#footer_container {
|
||||||
/* Block*/
|
/* Block*/
|
||||||
div#footer_infos {
|
div#footer_infos {
|
||||||
}
|
}
|
||||||
h1#footer_site_title {
|
h2#footer_site_title {
|
||||||
}
|
}
|
||||||
p#footer_about {
|
p#footer_about {
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,15 +166,25 @@ def check_all(option):
|
||||||
# Check articles process #
|
# Check articles process #
|
||||||
#------------------------#
|
#------------------------#
|
||||||
def check_process(target):
|
def check_process(target):
|
||||||
|
global post_err
|
||||||
|
|
||||||
if not db.post:
|
if not db.post:
|
||||||
logs.out("1", db.post, True)
|
logs.out("1", db.post, False)
|
||||||
|
post_err = True
|
||||||
|
return
|
||||||
|
|
||||||
|
# Start checking processes
|
||||||
|
#-------------------------
|
||||||
|
# Convert file to string
|
||||||
|
# Also check for separator and empty article
|
||||||
|
file_to_string()
|
||||||
|
if post_err:
|
||||||
|
return
|
||||||
|
|
||||||
global post_bottom, article_bottom
|
global post_bottom, article_bottom
|
||||||
global date_wip, hash_wip, date_www, hash_www, post_bottom
|
global date_wip, hash_wip, date_www, hash_www, post_bottom
|
||||||
global post_err
|
|
||||||
|
|
||||||
date_wip = hash_wip = date_www = hash_www = ''
|
date_wip = hash_wip = date_www = hash_www = ''
|
||||||
post_err = False
|
|
||||||
|
|
||||||
# Set values for wip and www from DB
|
# Set values for wip and www from DB
|
||||||
if db.exists:
|
if db.exists:
|
||||||
|
@ -213,12 +223,6 @@ def check_process(target):
|
||||||
http_www = "%s/%s"%(dom.www_url, srv_post_short_uri)
|
http_www = "%s/%s"%(dom.www_url, srv_post_short_uri)
|
||||||
http_wip = '%s/%s'%(dom.wip_url, srv_post_short_uri)
|
http_wip = '%s/%s'%(dom.wip_url, srv_post_short_uri)
|
||||||
|
|
||||||
# Start checking processes
|
|
||||||
#-------------------------
|
|
||||||
# Convert file to string
|
|
||||||
# Also check for separator and empty article
|
|
||||||
file_to_string()
|
|
||||||
|
|
||||||
# Check for icodes, bcodes, quotes
|
# Check for icodes, bcodes, quotes
|
||||||
# check icodes marks on same line
|
# check icodes marks on same line
|
||||||
if_icodes_bcodes_quotes(post_bottom)
|
if_icodes_bcodes_quotes(post_bottom)
|
||||||
|
@ -269,14 +273,21 @@ def check_process(target):
|
||||||
# Check if separator or exit #
|
# Check if separator or exit #
|
||||||
#---------------------------------#
|
#---------------------------------#
|
||||||
def file_to_string():
|
def file_to_string():
|
||||||
|
global post_err
|
||||||
global article, post_header, post_bottom
|
global article, post_header, post_bottom
|
||||||
global ln_header, ln_bottom, ln_article
|
global ln_header, ln_bottom, ln_article
|
||||||
|
|
||||||
|
post_err = False
|
||||||
post_header = post_bottom = ''
|
post_header = post_bottom = ''
|
||||||
sep = content = False
|
sep = content = False
|
||||||
article = open(db.uri_file, 'r').read()
|
article = open(db.uri_file, 'r').read()
|
||||||
|
|
||||||
for line in article.rsplit('\n'):
|
for line in article.rsplit('\n'):
|
||||||
|
if line.startswith(logs.shebang):
|
||||||
|
logs.out("82", db.uri_file, False)
|
||||||
|
post_err = True
|
||||||
|
return
|
||||||
|
|
||||||
if line.startswith('-----'):
|
if line.startswith('-----'):
|
||||||
if not sep:
|
if not sep:
|
||||||
sep = True
|
sep = True
|
||||||
|
@ -292,12 +303,16 @@ def file_to_string():
|
||||||
|
|
||||||
# Check if separator or exit
|
# Check if separator or exit
|
||||||
if not sep:
|
if not sep:
|
||||||
logs.out("6", '"-----" > %s'%db.uri_file, True)
|
logs.out("6", '"-----" > %s'%db.uri_file, False)
|
||||||
|
post_err = True
|
||||||
|
return
|
||||||
|
|
||||||
if not content:
|
if not content:
|
||||||
if db.exists and tyto.exists(db.config):
|
if db.exists and tyto.exists(db.config):
|
||||||
os.remove(db.config)
|
os.remove(db.config)
|
||||||
logs.out("18", db.uri_file, True)
|
logs.out("18", db.uri_file, False)
|
||||||
|
post_err = True
|
||||||
|
return
|
||||||
|
|
||||||
# +2 > (start at 0 + separator line)
|
# +2 > (start at 0 + separator line)
|
||||||
ln_article = len(article.splitlines()) + 1
|
ln_article = len(article.splitlines()) + 1
|
||||||
|
@ -313,11 +328,11 @@ def file_to_string():
|
||||||
def count_words(post_bottom):
|
def count_words(post_bottom):
|
||||||
global post_words
|
global post_words
|
||||||
post_words = 0
|
post_words = 0
|
||||||
|
|
||||||
for line in post_bottom:
|
for line in post_bottom:
|
||||||
if not line \
|
if not line \
|
||||||
or line.startswith(tyto.nolinewords) \
|
or line.startswith(tyto.nolinewords) \
|
||||||
or line.startswith("#") and \
|
or line.startswith("#") and not line.startswith(tyto.titles_user):
|
||||||
not line.startswith(tyto.titles_tags):
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
post_words = post_words + len(line.strip().split(" "))
|
post_words = post_words + len(line.strip().split(" "))
|
||||||
|
@ -330,11 +345,11 @@ def count_words(post_bottom):
|
||||||
#---------------------------------------------#
|
#---------------------------------------------#
|
||||||
def if_icodes_bcodes_quotes(post_bottom):
|
def if_icodes_bcodes_quotes(post_bottom):
|
||||||
global icode, quote, bcode, post_err
|
global icode, quote, bcode, post_err
|
||||||
global post_titles, nbr_quotes, nbr_bcodes, nbr_ancs, post_comments
|
global nbr_quotes, nbr_bcodes, nbr_ancs, post_comments
|
||||||
global post_images, post_raws, fcodes
|
global post_images, post_raws, fcodes
|
||||||
|
|
||||||
icode = quote = in_quote = bcode = in_bcode = in_bq = False
|
icode = quote = in_quote = bcode = in_bcode = in_bq = False
|
||||||
post_titles = nbr_quotes = nbr_bcodes = nbr_ancs = 0
|
nbr_quotes = nbr_bcodes = nbr_ancs = 0
|
||||||
post_images = post_comments = post_raws = fcodes = 0
|
post_images = post_comments = post_raws = fcodes = 0
|
||||||
|
|
||||||
for ln, line in enumerate(post_bottom.rsplit('\n'), 1):
|
for ln, line in enumerate(post_bottom.rsplit('\n'), 1):
|
||||||
|
@ -363,10 +378,7 @@ def if_icodes_bcodes_quotes(post_bottom):
|
||||||
if in_bq:
|
if in_bq:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
elif line.startswith(tyto.titles_tags):
|
elif line.startswith('#') and not line.startswith(tyto.titles_user):
|
||||||
post_titles += 1
|
|
||||||
continue
|
|
||||||
elif line.startswith('#'):
|
|
||||||
post_comments += 1
|
post_comments += 1
|
||||||
continue
|
continue
|
||||||
elif line.startswith(tyto.single_tags[1][0]):
|
elif line.startswith(tyto.single_tags[1][0]):
|
||||||
|
@ -769,12 +781,36 @@ def check_anchors():
|
||||||
post_err = True
|
post_err = True
|
||||||
|
|
||||||
|
|
||||||
|
#==========================#
|
||||||
|
# Check titles and content #
|
||||||
|
#--------------------------#
|
||||||
|
def check_titles():
|
||||||
|
global post_err, post_titles
|
||||||
|
post_titles = 0
|
||||||
|
|
||||||
|
for ln, line in enumerate(post_bottom.rsplit('\n'), 1):
|
||||||
|
ln = ln + ln_header + 1
|
||||||
|
|
||||||
|
if line.startswith(tyto.titles_user):
|
||||||
|
title_name = line[2: len(line)].lstrip()
|
||||||
|
if not title_name:
|
||||||
|
post_err = True
|
||||||
|
logs.out("84", 'L=%s > %s'%(ln, db.uri_file), False)
|
||||||
|
continue
|
||||||
|
|
||||||
|
post_titles += 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#===========================#
|
#===========================#
|
||||||
# Check tags in post_bottom #
|
# Check tags in post_bottom #
|
||||||
#---------------------------#
|
#---------------------------#
|
||||||
def check_content(post_bottom):
|
def check_content(post_bottom):
|
||||||
global post_err
|
global post_err
|
||||||
|
|
||||||
|
check_titles()
|
||||||
|
|
||||||
# Check tags for words (strongs, italics...)
|
# Check tags for words (strongs, italics...)
|
||||||
# Set stats for each one
|
# Set stats for each one
|
||||||
#-------------------------------------------
|
#-------------------------------------------
|
||||||
|
|
|
@ -50,83 +50,93 @@ except:
|
||||||
except:
|
except:
|
||||||
hole = True
|
hole = True
|
||||||
|
|
||||||
|
# Set current user name
|
||||||
|
try:
|
||||||
|
user
|
||||||
|
except:
|
||||||
|
try:
|
||||||
|
user = os.environ.get('USER')
|
||||||
|
except:
|
||||||
|
user = ''
|
||||||
|
|
||||||
|
|
||||||
# Settings for domain, check if db is not corrupted
|
# Settings for domain, check if db is not corrupted
|
||||||
dom_values = \
|
dom_values = \
|
||||||
(
|
(
|
||||||
'directory',
|
'directory',
|
||||||
'database',
|
'database',
|
||||||
'local_user',
|
'local_user',
|
||||||
'lang_sys',
|
'lang_sys',
|
||||||
'lang_logs',
|
'lang_logs',
|
||||||
'articles_db_d',
|
'articles_db_d',
|
||||||
'articles_d',
|
'articles_d',
|
||||||
'files_d',
|
'files_d',
|
||||||
'images_d',
|
'images_d',
|
||||||
'modules_d',
|
'modules_d',
|
||||||
'navbar_f',
|
'navbar_f',
|
||||||
'sidebar_f',
|
'sidebar_f',
|
||||||
'metas_f',
|
'metas_f',
|
||||||
'footer_f',
|
'footer_f',
|
||||||
'footer_about_f',
|
'footer_about_f',
|
||||||
'shortname',
|
'shortname',
|
||||||
'www_url',
|
'www_url',
|
||||||
'wip_url',
|
'wip_url',
|
||||||
'srv_root',
|
'srv_root',
|
||||||
'srv_domain',
|
'srv_domain',
|
||||||
'srv_wip',
|
'srv_wip',
|
||||||
'srv_wip_tpl_d',
|
'srv_wip_tpl_d',
|
||||||
'srv_wip_images_d',
|
'srv_wip_images_d',
|
||||||
'srv_wip_files_d',
|
'srv_wip_files_d',
|
||||||
'srv_www',
|
'srv_www',
|
||||||
'srv_www_tpl_d',
|
'srv_www_tpl_d',
|
||||||
'srv_www_images_d',
|
'srv_www_images_d',
|
||||||
'srv_www_files_d',
|
'srv_www_files_d',
|
||||||
'wip_css_f',
|
'wip_css_f',
|
||||||
'wip_logo_f',
|
'wip_logo_f',
|
||||||
'wip_navbar_f',
|
'wip_navbar_f',
|
||||||
'wip_sidebar_f',
|
'wip_sidebar_f',
|
||||||
'wip_metas_f',
|
'wip_metas_f',
|
||||||
'wip_footer_f',
|
'wip_footer_f',
|
||||||
'wip_stats_f',
|
'wip_stats_f',
|
||||||
'www_css_f',
|
'www_css_f',
|
||||||
'www_navbar_f',
|
'www_navbar_f',
|
||||||
'www_sidebar_f',
|
'www_sidebar_f',
|
||||||
'www_metas_f',
|
'www_metas_f',
|
||||||
'www_footer_f',
|
'www_footer_f',
|
||||||
'www_stats_f',
|
'www_stats_f',
|
||||||
'www_logo_f',
|
'www_logo_f',
|
||||||
'www_rss_f',
|
'www_rss_f',
|
||||||
'logo',
|
'logo',
|
||||||
'styles',
|
'styles',
|
||||||
'rss',
|
'rss',
|
||||||
'rss_items',
|
'rss_items',
|
||||||
'title',
|
'title',
|
||||||
'date',
|
'date',
|
||||||
'about',
|
'about',
|
||||||
'lang_site',
|
'lang_site',
|
||||||
'mail',
|
'mail',
|
||||||
'tags',
|
'tags',
|
||||||
'license',
|
'license',
|
||||||
'license_url',
|
'license_url',
|
||||||
'legal_url',
|
'legal_url',
|
||||||
'terms_url',
|
'terms_url',
|
||||||
'css',
|
'css',
|
||||||
'sep',
|
'sep',
|
||||||
'article_code',
|
'article_code',
|
||||||
'relme',
|
'relme',
|
||||||
'sidebar_title',
|
'sidebar_title',
|
||||||
'sidebar_items',
|
'sidebar_items',
|
||||||
'activated'
|
'activated'
|
||||||
)
|
)
|
||||||
|
|
||||||
create_files = \
|
create_files = \
|
||||||
(
|
(
|
||||||
'navbar_f',
|
'navbar_f',
|
||||||
'sidebar_f',
|
'sidebar_f',
|
||||||
'metas_f',
|
'metas_f',
|
||||||
'footer_f',
|
'footer_f',
|
||||||
'footer_about_f'
|
'footer_about_f'
|
||||||
)
|
)
|
||||||
|
|
||||||
wip_html_mods = ()
|
wip_html_mods = ()
|
||||||
err_val = (()) # Make a list from values error
|
err_val = (()) # Make a list from values error
|
||||||
|
@ -186,18 +196,8 @@ if not hole:
|
||||||
value_set = False
|
value_set = False
|
||||||
incomplete = True
|
incomplete = True
|
||||||
active = False
|
active = False
|
||||||
|
|
||||||
|
if value.endswith('_f'):
|
||||||
if value.endswith('_d'):
|
|
||||||
if value_set:
|
|
||||||
if not os.path.exists(eval(str(value))):
|
|
||||||
try:
|
|
||||||
os.makedirs(eval(str(value)), exist_ok=True)
|
|
||||||
dir_new = dir_new + ((eval(str(value))),)
|
|
||||||
except:
|
|
||||||
dir_unu = dir_unu + ((eval(str(value))),)
|
|
||||||
|
|
||||||
elif value.endswith('_f'):
|
|
||||||
if value_set:
|
if value_set:
|
||||||
if not os.path.exists(eval(str(value))):
|
if not os.path.exists(eval(str(value))):
|
||||||
if value in create_files:
|
if value in create_files:
|
||||||
|
@ -210,84 +210,99 @@ if not hole:
|
||||||
# When an active and complete domain is needed #
|
# When an active and complete domain is needed #
|
||||||
#----------------------------------------------#
|
#----------------------------------------------#
|
||||||
if exists and not incomplete and not corrupt:
|
if exists and not incomplete and not corrupt:
|
||||||
wip_html_mods = \
|
|
||||||
(
|
|
||||||
eval(str('wip_navbar_f')),
|
|
||||||
eval(str('wip_sidebar_f')),
|
|
||||||
eval(str('wip_metas_f')),
|
|
||||||
eval(str('wip_footer_f'))
|
|
||||||
)
|
|
||||||
if active:
|
if active:
|
||||||
ready = True
|
ready = True
|
||||||
|
|
||||||
metas = (
|
wip_html_mods = \
|
||||||
eval(str('metas_f')),
|
(
|
||||||
eval(str('wip_metas_f')),
|
eval(str('wip_navbar_f')),
|
||||||
eval(str('www_metas_f'))
|
eval(str('wip_sidebar_f')),
|
||||||
)
|
eval(str('wip_metas_f')),
|
||||||
navbars = (
|
eval(str('wip_footer_f'))
|
||||||
eval(str('navbar_f')),
|
)
|
||||||
eval(str('wip_navbar_f')),
|
www_html_mods = \
|
||||||
eval(str('www_navbar_f'))
|
(
|
||||||
)
|
eval(str('www_navbar_f')),
|
||||||
sidebars = (
|
eval(str('www_sidebar_f')),
|
||||||
eval(str('sidebar_f')),
|
eval(str('www_metas_f')),
|
||||||
eval(str('wip_sidebar_f')),
|
eval(str('www_footer_f'))
|
||||||
eval(str('www_sidebar_f'))
|
)
|
||||||
)
|
metas = \
|
||||||
footers = (
|
(
|
||||||
eval(str('footer_f')),
|
eval(str('metas_f')),
|
||||||
eval(str('wip_footer_f')),
|
eval(str('wip_metas_f')),
|
||||||
eval(str('www_footer_f')),
|
eval(str('www_metas_f'))
|
||||||
eval(str('footer_about_f'))
|
)
|
||||||
)
|
navbars = \
|
||||||
|
(
|
||||||
|
eval(str('navbar_f')),
|
||||||
|
eval(str('wip_navbar_f')),
|
||||||
|
eval(str('www_navbar_f'))
|
||||||
|
)
|
||||||
|
sidebars = \
|
||||||
|
(
|
||||||
|
eval(str('sidebar_f')),
|
||||||
|
eval(str('wip_sidebar_f')),
|
||||||
|
eval(str('www_sidebar_f'))
|
||||||
|
)
|
||||||
|
footers = \
|
||||||
|
(
|
||||||
|
eval(str('footer_f')),
|
||||||
|
eval(str('wip_footer_f')),
|
||||||
|
eval(str('www_footer_f')),
|
||||||
|
eval(str('footer_about_f'))
|
||||||
|
)
|
||||||
|
|
||||||
templates = (
|
templates = \
|
||||||
eval(str('wip_logo_f')),
|
(
|
||||||
eval(str('wip_css_f')),
|
eval(str('wip_logo_f')),
|
||||||
eval(str('wip_navbar_f')),
|
eval(str('wip_css_f')),
|
||||||
eval(str('wip_sidebar_f')),
|
eval(str('wip_navbar_f')),
|
||||||
eval(str('wip_metas_f')),
|
eval(str('wip_sidebar_f')),
|
||||||
eval(str('wip_footer_f')),
|
eval(str('wip_metas_f')),
|
||||||
eval(str('wip_stats_f')),
|
eval(str('wip_footer_f')),
|
||||||
eval(str('www_logo_f')),
|
eval(str('wip_stats_f')),
|
||||||
eval(str('www_css_f')),
|
eval(str('www_logo_f')),
|
||||||
eval(str('www_navbar_f')),
|
eval(str('www_css_f')),
|
||||||
eval(str('www_sidebar_f')),
|
eval(str('www_navbar_f')),
|
||||||
eval(str('www_metas_f')),
|
eval(str('www_sidebar_f')),
|
||||||
eval(str('www_footer_f')),
|
eval(str('www_metas_f')),
|
||||||
eval(str('www_stats_f')),
|
eval(str('www_footer_f')),
|
||||||
eval(str('www_rss_f')),
|
eval(str('www_stats_f')),
|
||||||
)
|
eval(str('www_rss_f')),
|
||||||
|
)
|
||||||
modules = {
|
|
||||||
"metas" : metas,
|
modules = \
|
||||||
"navbar" : navbars,
|
{
|
||||||
"sidebar" : sidebars,
|
"metas" : metas,
|
||||||
"footer" : footers,
|
"navbar" : navbars,
|
||||||
"template": templates,
|
"sidebar" : sidebars,
|
||||||
}
|
"footer" : footers,
|
||||||
|
"template": templates,
|
||||||
|
}
|
||||||
|
|
||||||
|
templates_files_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_wip = {
|
templates_files_www = \
|
||||||
eval(str('wip_logo_f')),
|
(
|
||||||
eval(str('wip_css_f')),
|
eval(str('www_logo_f')),
|
||||||
eval(str('wip_navbar_f')),
|
eval(str('www_css_f')),
|
||||||
eval(str('wip_sidebar_f')),
|
eval(str('www_navbar_f')),
|
||||||
eval(str('wip_metas_f')),
|
eval(str('www_sidebar_f')),
|
||||||
eval(str('wip_footer_f')),
|
eval(str('www_metas_f')),
|
||||||
eval(str('wip_stats_f')),
|
eval(str('www_footer_f')),
|
||||||
}
|
eval(str('www_stats_f')),
|
||||||
|
eval(str('www_rss_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 #
|
# Check if domain is ready and ready #
|
||||||
|
|
|
@ -681,11 +681,20 @@ def create_domain(target):
|
||||||
|
|
||||||
# Create in _configs/ modules files
|
# Create in _configs/ modules files
|
||||||
#----------------------------------
|
#----------------------------------
|
||||||
|
|
||||||
|
html.create_user_metass('new')
|
||||||
|
html.create_navbar('new')
|
||||||
|
html.create_sidebar('new')
|
||||||
|
html.create_user_footer('new')
|
||||||
|
create_footer_about('new')
|
||||||
|
|
||||||
|
'''
|
||||||
create_metas('form')
|
create_metas('form')
|
||||||
create_navbar('form')
|
create_navbar('form')
|
||||||
create_sidebar('form')
|
create_sidebar('form')
|
||||||
create_footer('form')
|
create_footer('form')
|
||||||
create_footer_about('form')
|
create_footer_about('form')
|
||||||
|
'''
|
||||||
|
|
||||||
print(langs.site.form_ready)
|
print(langs.site.form_ready)
|
||||||
|
|
||||||
|
@ -700,16 +709,18 @@ def create_domain(target):
|
||||||
#------------------------#
|
#------------------------#
|
||||||
def create_metas(option):
|
def create_metas(option):
|
||||||
if not dom.ready: dom.valid()
|
if not dom.ready: dom.valid()
|
||||||
|
|
||||||
|
print(' │\n ├ %s'%langs.site.metas_inf)
|
||||||
|
if option != "new": return
|
||||||
|
|
||||||
# Create new default config file, or ask if exists
|
# Create new default config file, or ask if exists
|
||||||
if tyto.exists(dom.metas_f):
|
if tyto.exists(dom.metas_f):
|
||||||
answer = asking(' ├ %s. %s%s '%(
|
answer = asking(' ├ %s%s '%(
|
||||||
langs.site.metas, langs.site.form_reset,
|
langs.site.form_reset, langs.site.q
|
||||||
langs.site.q
|
|
||||||
), False)
|
), False)
|
||||||
|
|
||||||
if not answer in answer_yes:
|
if not answer in answer_yes:
|
||||||
if option == "form": return
|
if option == "new": return
|
||||||
logs.out("255", '', True)
|
logs.out("255", '', True)
|
||||||
|
|
||||||
# Set default content for
|
# Set default content for
|
||||||
|
@ -766,10 +777,6 @@ def create_metas(option):
|
||||||
'<meta name="revisit-after" content="3 days">'
|
'<meta name="revisit-after" content="3 days">'
|
||||||
|
|
||||||
tyto.set_file(dom.metas_f, 'New', metas_tags)
|
tyto.set_file(dom.metas_f, 'New', metas_tags)
|
||||||
|
|
||||||
# Create an empty html file in wip/www server if not exists
|
|
||||||
if not tyto.exists(dom.wip_metas_f):
|
|
||||||
html.create_user_metas('wip')
|
|
||||||
|
|
||||||
|
|
||||||
#=============================#
|
#=============================#
|
||||||
|
@ -778,15 +785,17 @@ def create_metas(option):
|
||||||
def create_navbar(option):
|
def create_navbar(option):
|
||||||
if not dom.ready: dom.valid()
|
if not dom.ready: dom.valid()
|
||||||
|
|
||||||
|
print(' │\n ├ %s'%langs.site.navbar_inf)
|
||||||
|
if option != "new": return
|
||||||
|
|
||||||
# Create new config file, or ask if exists
|
# Create new config file, or ask if exists
|
||||||
if tyto.exists(dom.navbar_f):
|
if tyto.exists(dom.navbar_f):
|
||||||
answer = asking(' ├ %s. %s%s '%(
|
answer = asking(' ├ %s%s '%(
|
||||||
langs.site.navbar, langs.site.form_reset,
|
langs.site.form_reset, langs.site.q
|
||||||
langs.site.q
|
|
||||||
), False)
|
), False)
|
||||||
|
|
||||||
if not answer in answer_yes:
|
if not answer in answer_yes:
|
||||||
if option == "form": return
|
if option == "new": return
|
||||||
logs.out("255", '', True)
|
logs.out("255", '', True)
|
||||||
|
|
||||||
|
|
||||||
|
@ -827,9 +836,6 @@ def create_navbar(option):
|
||||||
navbar_lang = navbar_lang%(tyto.Tyto, dom.navbar_f)
|
navbar_lang = navbar_lang%(tyto.Tyto, dom.navbar_f)
|
||||||
|
|
||||||
tyto.set_file(dom.navbar_f, 'New', navbar_lang)
|
tyto.set_file(dom.navbar_f, 'New', navbar_lang)
|
||||||
|
|
||||||
# Create wip navbar file
|
|
||||||
html.create_navbar('wip')
|
|
||||||
|
|
||||||
|
|
||||||
#==============================#
|
#==============================#
|
||||||
|
@ -838,19 +844,21 @@ def create_navbar(option):
|
||||||
def create_sidebar(option):
|
def create_sidebar(option):
|
||||||
if not dom.ready: dom.valid()
|
if not dom.ready: dom.valid()
|
||||||
|
|
||||||
|
print(' │\n ├ %s'%langs.site.sidebar_inf)
|
||||||
|
if option != "new": return
|
||||||
|
|
||||||
# Create an empty html file in wip/www server if not exists
|
# Create an empty html file in wip/www server if not exists
|
||||||
if not tyto.exists(dom.wip_sidebar_f):
|
if not tyto.exists(dom.wip_sidebar_f):
|
||||||
tyto.set_file(dom.wip_sidebar_f, 'new', '')
|
tyto.set_file(dom.wip_sidebar_f, 'new', '')
|
||||||
|
|
||||||
# Create new config file, or ask if exists with option = 'reset'
|
# Create new config file, or ask if exists with option = 'reset'
|
||||||
if tyto.exists(dom.sidebar_f):
|
if tyto.exists(dom.sidebar_f):
|
||||||
answer = asking(' ├ %s. %s%s '%(
|
answer = asking(' ├ %s%s '%(
|
||||||
langs.site.sidebar, langs.site.form_reset,
|
langs.site.form_reset, langs.site.q
|
||||||
langs.site.q
|
|
||||||
), False)
|
), False)
|
||||||
|
|
||||||
if not answer in answer_yes:
|
if not answer in answer_yes:
|
||||||
if option == "form": return
|
if option == "new": return
|
||||||
logs.out("255", '', True)
|
logs.out("255", '', True)
|
||||||
|
|
||||||
|
|
||||||
|
@ -900,6 +908,10 @@ def create_sidebar(option):
|
||||||
def create_footer(option):
|
def create_footer(option):
|
||||||
if not dom.ready: dom.valid()
|
if not dom.ready: dom.valid()
|
||||||
|
|
||||||
|
print(' │\n ├ %s'%langs.site.footer_inf)
|
||||||
|
create_footer_about(option)
|
||||||
|
if option != "new": return
|
||||||
|
|
||||||
# Default footer contents
|
# Default footer contents
|
||||||
#------------------------
|
#------------------------
|
||||||
Tytosrc = \
|
Tytosrc = \
|
||||||
|
@ -999,15 +1011,15 @@ def create_footer(option):
|
||||||
# Final HTML footer code
|
# Final HTML footer code
|
||||||
footer = \
|
footer = \
|
||||||
'%s\n'%footer_lang%(tyto.Tyto, dom.footer_f) + \
|
'%s\n'%footer_lang%(tyto.Tyto, dom.footer_f) + \
|
||||||
'<footer id="footer_page">\n' + \
|
'<footer accesskey="f" id="footer_page">\n' + \
|
||||||
' <div id="footer_container"> \n' + \
|
' <div id="footer_container"> \n' + \
|
||||||
' <div id="footer_infos">\n' + \
|
' <div id="footer_infos">\n' + \
|
||||||
' <h1 id="footer_site_title"\n' + \
|
' <h2 id="footer_site_title"\n' + \
|
||||||
' title="%s %s">%s %s\n'%(
|
' title="%s %s">%s %s\n'%(
|
||||||
langs.site.add_inf, dom.title,
|
langs.site.add_inf, dom.title,
|
||||||
langs.site.about, dom.title
|
langs.site.about, dom.title
|
||||||
) + \
|
) + \
|
||||||
' </h1>\n' + \
|
' </h2>\n' + \
|
||||||
'%s\n'%(footer_about) + \
|
'%s\n'%(footer_about) + \
|
||||||
' </div>\n' + \
|
' </div>\n' + \
|
||||||
'\n' + \
|
'\n' + \
|
||||||
|
@ -1052,21 +1064,16 @@ def create_footer(option):
|
||||||
|
|
||||||
# Create new default file, or ask if exists
|
# Create new default file, or ask if exists
|
||||||
if tyto.exists(dom.footer_f):
|
if tyto.exists(dom.footer_f):
|
||||||
answer = asking(' ├ %s. %s%s '%(
|
answer = asking(' ├ %s%s '%(
|
||||||
langs.site.footer, langs.site.form_reset,
|
langs.site.form_reset, langs.site.q
|
||||||
langs.site.q
|
|
||||||
), False)
|
), False)
|
||||||
|
|
||||||
if not answer in answer_yes:
|
if not answer in answer_yes:
|
||||||
if option == "form": return
|
if option == "new": return
|
||||||
logs.out("255", '', True)
|
logs.out("255", '', True)
|
||||||
|
|
||||||
tyto.set_file(dom.footer_f, 'New', footer)
|
tyto.set_file(dom.footer_f, 'New', footer)
|
||||||
|
|
||||||
# Create footer file in wip server if not exists
|
|
||||||
if not tyto.exists(dom.wip_footer_f):
|
|
||||||
html.create_user_footer('wip')
|
|
||||||
|
|
||||||
|
|
||||||
# Generic HTML list in footer
|
# Generic HTML list in footer
|
||||||
"""
|
"""
|
||||||
|
@ -1084,9 +1091,9 @@ def create_footer(option):
|
||||||
def create_footer_about(option):
|
def create_footer_about(option):
|
||||||
if not tyto.exists(dom.footer_about_f):
|
if not tyto.exists(dom.footer_about_f):
|
||||||
set_f = '%s\n'%langs.site.footer_about_doc%(tyto.Tyto,
|
set_f = '%s\n'%langs.site.footer_about_doc%(tyto.Tyto,
|
||||||
dom.footer_about_f
|
dom.footer_about_f
|
||||||
) + \
|
) + \
|
||||||
'<p id="footer_about">%s</p>'%dom.about
|
'<p id="footer_about">%s</p>'%dom.about
|
||||||
|
|
||||||
tyto.set_file(dom.footer_about_f, False, set_f)
|
tyto.set_file(dom.footer_about_f, 'New', set_f)
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ import os, sys, importlib
|
||||||
import logs, db, dom, tyto, form, langs
|
import logs, db, dom, tyto, form, langs
|
||||||
|
|
||||||
# Publish option can be
|
# Publish option can be
|
||||||
|
wip_opts = ('wip', 'new')
|
||||||
pub_opts = ('www', 'pub')
|
pub_opts = ('www', 'pub')
|
||||||
|
|
||||||
# Not a line if it starts with...(for sidebar, navbar)
|
# Not a line if it starts with...(for sidebar, navbar)
|
||||||
|
@ -158,18 +159,18 @@ def create_main_page(target, article_bottom):
|
||||||
' %s\n'%logo_html + \
|
' %s\n'%logo_html + \
|
||||||
' </div>\n' + \
|
' </div>\n' + \
|
||||||
' <div id="site_infos">\n' + \
|
' <div id="site_infos">\n' + \
|
||||||
' <a href="/"\n' + \
|
' <h1 id="site_title">\n' + \
|
||||||
' title="%s"\n'%(langs.site.home) + \
|
' <a href="/"\n' + \
|
||||||
' id="site_link">\n' + \
|
' title="%s"\n'%(langs.site.home) + \
|
||||||
' <h1 id="site_title">%s</h1>\n'%dom.title + \
|
' id="site_link">%s</a>\n'%dom.title + \
|
||||||
' </a>\n' + \
|
' </h1>\n' + \
|
||||||
' <p id="site_about">%s</p>\n'%dom.about + \
|
' <p id="site_about">%s</p>\n'%dom.about + \
|
||||||
' </div>\n' + \
|
' </div>\n' + \
|
||||||
' </header>\n' + \
|
' </header>\n' + \
|
||||||
tyto.tags_html_mods[dom.wip_navbar_f] + '\n' + \
|
tyto.tags_html_mods[dom.wip_navbar_f] + '\n' + \
|
||||||
' <article id="article_main">\n' + \
|
' <article id="article_main">\n' + \
|
||||||
' <h1 id="main_title"\n' + \
|
' <h1 accesskey="t" id="post_title"\n' + \
|
||||||
' title="[%s] %s %s %s %s">%s</h1>\n'%(
|
' title="[%s] %s %s %s %s">%s</h1>\n'%(
|
||||||
db.title, langs.site.w_written, db.date,
|
db.title, langs.site.w_written, db.date,
|
||||||
langs.site.by, db.author,
|
langs.site.by, db.author,
|
||||||
db.title,
|
db.title,
|
||||||
|
@ -250,15 +251,15 @@ def create_html_time_meta(process):
|
||||||
def create_user_metas(option):
|
def create_user_metas(option):
|
||||||
dom.valid()
|
dom.valid()
|
||||||
|
|
||||||
if option == 'wip': target = dom.wip_metas_f
|
form.create_metas(option)
|
||||||
|
|
||||||
|
if option in wip_opts: target = dom.wip_metas_f
|
||||||
elif option in pub_opts: target = dom.www_metas_f
|
elif option in pub_opts: target = dom.www_metas_f
|
||||||
|
|
||||||
if option == 'www' and tyto.exists(target):
|
if option == 'www' and tyto.exists(target):
|
||||||
form.asking(' ├ %s. %s%s '%(
|
form.asking(' ├ %s. %s%s '%(
|
||||||
langs.site.metas, langs.site.form_rep, langs.site.q
|
langs.site.metas, langs.site.form_rep, langs.site.q
|
||||||
), True)
|
), True)
|
||||||
|
|
||||||
print(' │\n ├ %s'%langs.site.metas_inf)
|
|
||||||
|
|
||||||
# Create wip metas.html file according to option
|
# Create wip metas.html file according to option
|
||||||
#-----------------------------------------------
|
#-----------------------------------------------
|
||||||
|
@ -284,10 +285,12 @@ def create_user_metas(option):
|
||||||
def create_navbar(option):
|
def create_navbar(option):
|
||||||
dom.valid()
|
dom.valid()
|
||||||
|
|
||||||
|
form.create_navbar(option)
|
||||||
|
|
||||||
if not tyto.exists(dom.navbar_f):
|
if not tyto.exists(dom.navbar_f):
|
||||||
logs.out("1", dom.navbar_f, True)
|
logs.out("1", dom.navbar_f, True)
|
||||||
|
|
||||||
if option == 'wip': target = dom.wip_navbar_f
|
if option in wip_opts: target = dom.wip_navbar_f
|
||||||
elif option in pub_opts: target = dom.www_navbar_f
|
elif option in pub_opts: target = dom.www_navbar_f
|
||||||
|
|
||||||
if option == 'www' and tyto.exists(target):
|
if option == 'www' and tyto.exists(target):
|
||||||
|
@ -296,14 +299,12 @@ def create_navbar(option):
|
||||||
option, langs.site.q
|
option, langs.site.q
|
||||||
), True)
|
), True)
|
||||||
|
|
||||||
print(' │\n ├ %s'%langs.site.navbar_inf)
|
|
||||||
|
|
||||||
# navbar has items
|
# navbar has items
|
||||||
navbar_items = False
|
navbar_items = False
|
||||||
|
|
||||||
# Set first HTML line
|
# Set first HTML line
|
||||||
menu_html = \
|
menu_html = \
|
||||||
'%s<nav id="site_menu">\n'%(4 * ' ') + \
|
'%s<nav accesskey="m" id="site_menu">\n'%(4 * ' ') + \
|
||||||
'%s<menu id="site_menu_items">'%(6 * ' ')
|
'%s<menu id="site_menu_items">'%(6 * ' ')
|
||||||
|
|
||||||
navbar_lines = open(dom.navbar_f, 'r').read()
|
navbar_lines = open(dom.navbar_f, 'r').read()
|
||||||
|
@ -345,7 +346,7 @@ def create_navbar(option):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# index.html server files must exist (or 404 error)
|
# index.html server files must exist (or 404 error)
|
||||||
if option == 'wip':
|
if option in wip_opts:
|
||||||
if not tyto.exists(wip_index):
|
if not tyto.exists(wip_index):
|
||||||
logs.out('26', '> %s'%(wip_index), False)
|
logs.out('26', '> %s'%(wip_index), False)
|
||||||
no_wip_index = True
|
no_wip_index = True
|
||||||
|
@ -374,10 +375,7 @@ def create_navbar(option):
|
||||||
|
|
||||||
# Nothing to do
|
# Nothing to do
|
||||||
if not navbar_items:
|
if not navbar_items:
|
||||||
if not tyto.exists(target):
|
tyto.set_file(target, 'New', '')
|
||||||
tyto.set_file(target, 'New', '')
|
|
||||||
logs.out('28', '%s'%langs.log.navbar, False)
|
|
||||||
return
|
|
||||||
|
|
||||||
# Create ending HTML file
|
# Create ending HTML file
|
||||||
else:
|
else:
|
||||||
|
@ -392,12 +390,14 @@ def create_navbar(option):
|
||||||
def create_sidebar(option):
|
def create_sidebar(option):
|
||||||
dom.valid()
|
dom.valid()
|
||||||
|
|
||||||
|
form.create_sidebar(option)
|
||||||
|
|
||||||
if not tyto.exists(dom.sidebar_f):
|
if not tyto.exists(dom.sidebar_f):
|
||||||
logs.out("1", dom.sidebar_f, True)
|
logs.out("1", dom.sidebar_f, True)
|
||||||
|
|
||||||
if int(dom.sidebar_items) > 16: db.sidebar_items = 6
|
if int(dom.sidebar_items) > 16: db.sidebar_items = 6
|
||||||
|
|
||||||
if option == 'wip': target = dom.wip_sidebar_f
|
if option in wip_opts: target = dom.wip_sidebar_f
|
||||||
elif option in pub_opts: target = dom.www_sidebar_f
|
elif option in pub_opts: target = dom.www_sidebar_f
|
||||||
|
|
||||||
if option == 'www' and tyto.exists(target):
|
if option == 'www' and tyto.exists(target):
|
||||||
|
@ -405,15 +405,13 @@ def create_sidebar(option):
|
||||||
langs.site.sidebar, langs.site.form_rep, langs.site.q
|
langs.site.sidebar, langs.site.form_rep, langs.site.q
|
||||||
), True)
|
), True)
|
||||||
|
|
||||||
print(' │\n ├ %s'%langs.site.sidebar_inf)
|
|
||||||
|
|
||||||
sidebar_items = False
|
sidebar_items = False
|
||||||
|
|
||||||
# Set HTML sidebar
|
# Set HTML sidebar
|
||||||
sidebar_list = ''
|
sidebar_list = ''
|
||||||
sidebar_html = \
|
sidebar_html = \
|
||||||
'<aside id="sidebar">\n' + \
|
'<aside accesskey="s" id="sidebar">\n' + \
|
||||||
' <h1 id="sidebar_title">%s</h1>\n' + \
|
' <h2 id="sidebar_title">%s</h2>\n' + \
|
||||||
' <ul id="sidebar_list">\n' + \
|
' <ul id="sidebar_list">\n' + \
|
||||||
'%s' + \
|
'%s' + \
|
||||||
' </ul>\n' + \
|
' </ul>\n' + \
|
||||||
|
@ -447,7 +445,7 @@ def create_sidebar(option):
|
||||||
exec(open(db_uri).read(),globals())
|
exec(open(db_uri).read(),globals())
|
||||||
|
|
||||||
# Check wip status and if article exists in server
|
# Check wip status and if article exists in server
|
||||||
if option == 'wip':
|
if option in wip_opts:
|
||||||
if hash_wip != hash_chk:
|
if hash_wip != hash_chk:
|
||||||
logs.out("30", line, False)
|
logs.out("30", line, False)
|
||||||
continue
|
continue
|
||||||
|
@ -477,7 +475,7 @@ def create_sidebar(option):
|
||||||
' <li class="sidebar_item">\n' + \
|
' <li class="sidebar_item">\n' + \
|
||||||
' <a class="sidebar_item_link"\n' + \
|
' <a class="sidebar_item_link"\n' + \
|
||||||
' href="/%s">\n'%short_srv + \
|
' href="/%s">\n'%short_srv + \
|
||||||
' <h2 class="sidebar_item_title">%s</h2>\n'%title + \
|
' <h3 class="sidebar_item_title">%s</h2>\n'%title + \
|
||||||
' <p class="sidebar_item_about"\n' + \
|
' <p class="sidebar_item_about"\n' + \
|
||||||
' title="%s">\n'%link_title + \
|
' title="%s">\n'%link_title + \
|
||||||
' %s [%s] - %s\n'%(date, author, about) + \
|
' %s [%s] - %s\n'%(date, author, about) + \
|
||||||
|
@ -487,10 +485,7 @@ def create_sidebar(option):
|
||||||
|
|
||||||
# Nothing to do
|
# Nothing to do
|
||||||
if not sidebar_items:
|
if not sidebar_items:
|
||||||
if not tyto.exists(target):
|
tyto.set_file(target, 'New', '')
|
||||||
tyto.set_file(target, 'New', '')
|
|
||||||
logs.out('28', '%s'%langs.log.sidebar, False)
|
|
||||||
return
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Create HTML complete sidebar
|
# Create HTML complete sidebar
|
||||||
|
@ -510,7 +505,9 @@ def create_sidebar(option):
|
||||||
def create_user_footer(option):
|
def create_user_footer(option):
|
||||||
dom.valid()
|
dom.valid()
|
||||||
|
|
||||||
if option == 'wip': target = dom.wip_footer_f
|
form.create_footer(option)
|
||||||
|
|
||||||
|
if option in wip_opts: target = dom.wip_footer_f
|
||||||
elif option in pub_opts: target = dom.www_footer_f
|
elif option in pub_opts: target = dom.www_footer_f
|
||||||
|
|
||||||
if option == 'www' and tyto.exists(target):
|
if option == 'www' and tyto.exists(target):
|
||||||
|
@ -518,8 +515,6 @@ def create_user_footer(option):
|
||||||
langs.site.footer, langs.site.form_rep, langs.site.q
|
langs.site.footer, langs.site.form_rep, langs.site.q
|
||||||
), True)
|
), True)
|
||||||
|
|
||||||
print(' │\n ├ %s'%langs.site.footer_inf)
|
|
||||||
|
|
||||||
try: footer_f = open(dom.footer_f, 'r').read()
|
try: footer_f = open(dom.footer_f, 'r').read()
|
||||||
except: logs.out("1", dom.footer_f, True)
|
except: logs.out("1", dom.footer_f, True)
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,9 @@
|
||||||
import os, sys
|
import os, sys
|
||||||
import langs
|
import langs
|
||||||
|
|
||||||
|
# Use to mark new article
|
||||||
|
shebang = "#!/usr/bin/tyto"
|
||||||
|
|
||||||
# Set colors
|
# Set colors
|
||||||
CS = '\033[0;0m'
|
CS = '\033[0;0m'
|
||||||
CR = '\033[1;31m'
|
CR = '\033[1;31m'
|
||||||
|
@ -97,6 +100,9 @@ def out(nbr, value, out):
|
||||||
'60' : ' │\n ╞ %s'%langs.log.status_r,
|
'60' : ' │\n ╞ %s'%langs.log.status_r,
|
||||||
'61' : ' ╞ %s%s%s > %s'%(CG, langs.log.file_e, CS, value),
|
'61' : ' ╞ %s%s%s > %s'%(CG, langs.log.file_e, CS, value),
|
||||||
'85' : ' ╞═ %s%s%s > %s'%(CY, langs.log.was_pub, CS, value),
|
'85' : ' ╞═ %s%s%s > %s'%(CY, langs.log.was_pub, CS, value),
|
||||||
|
'81' : ' ╘ %s%s%s > %s'%(CR, langs.log.post_exists, CS, value),
|
||||||
|
'82' : ' ╞ %s%s "%s"%s > %s'%(CR, langs.log.shebang_r, shebang, CS, value),
|
||||||
|
'84' : ' ╞ %s%s%s %s'%(CR, langs.log.title_no, CS, value),
|
||||||
'91' : ' ╞═ %s%s%s > %s'%(CY, langs.log.post_nfd, 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),
|
'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),
|
'94' : ' ╞═ %s%s%s > %s'%(CY, langs.log.st_chk_o, CS, value),
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#**********************************************************************
|
#**********************************************************************
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import args, dom, logs, form, html
|
import args, dom, logs, langs, form, html, tyto, show
|
||||||
|
|
||||||
|
|
||||||
#===============================================#
|
#===============================================#
|
||||||
|
@ -42,21 +42,41 @@ import args, dom, logs, form, html
|
||||||
# - domain: target becomes 3rd command argument #
|
# - domain: target becomes 3rd command argument #
|
||||||
#-----------------------------------------------#
|
#-----------------------------------------------#
|
||||||
def manage(target):
|
def manage(target):
|
||||||
# Generic option, except for domain
|
# "domain" target
|
||||||
option = 'new'
|
#----------------
|
||||||
|
option = args.action
|
||||||
if target == "domain":
|
if target == "domain":
|
||||||
try: option = sys.argv[3]
|
try: option = sys.argv[3]
|
||||||
except: option = ''
|
except: option = args.action
|
||||||
|
|
||||||
if target in args.pass_targets:
|
if target in args.pass_targets:
|
||||||
actions = {
|
actions = {
|
||||||
'domain' : form.manage,
|
'domain' : form.manage,
|
||||||
'sidebar' : form.create_sidebar,
|
'sidebar' : html.create_sidebar,
|
||||||
'navbar' : form.create_navbar,
|
'navbar' : html.create_navbar,
|
||||||
'metas' : form.create_metas,
|
'metas' : html.create_user_metas,
|
||||||
'footer' : form.create_footer
|
'footer' : html.create_user_footer
|
||||||
}
|
}
|
||||||
|
|
||||||
actions[target](option)
|
actions[target](option)
|
||||||
|
|
||||||
|
# article target
|
||||||
|
#---------------
|
||||||
else:
|
else:
|
||||||
logs.out("11", '"%s" with "%s"'%(target, option), True)
|
filepost = "%s%s.tyto"%(dom.user_dir, args.target)
|
||||||
|
if tyto.exists(filepost):
|
||||||
|
logs.out("81", filepost, True)
|
||||||
|
|
||||||
|
else:
|
||||||
|
form.asking(" ├ %s%s %s"%(
|
||||||
|
langs.site.new_post,
|
||||||
|
langs.site.q,
|
||||||
|
filepost
|
||||||
|
), True)
|
||||||
|
|
||||||
|
post = tyto.new_article%(args.target,
|
||||||
|
dom.user,
|
||||||
|
tyto.nowdate().rsplit(' ')[0]
|
||||||
|
)
|
||||||
|
tyto.set_file(filepost, True, post)
|
||||||
|
show.read_lines(filepost, True)
|
||||||
|
|
|
@ -33,7 +33,8 @@
|
||||||
|
|
||||||
#**********************************************************************
|
#**********************************************************************
|
||||||
|
|
||||||
import args, dom, logs, tyto, form, db
|
import os
|
||||||
|
import args, dom, logs, tyto, html, db
|
||||||
|
|
||||||
def domain():
|
def domain():
|
||||||
if dom.hole: logs.out("13", '', True)
|
if dom.hole: logs.out("13", '', True)
|
||||||
|
@ -53,29 +54,85 @@ def domain():
|
||||||
|
|
||||||
# Show unused values
|
# Show unused values
|
||||||
for err_val in dom.err_val:
|
for err_val in dom.err_val:
|
||||||
logs.out("16", err_val, False)
|
logs.out("16", err_val, True)
|
||||||
|
|
||||||
|
# Create unused directories
|
||||||
|
srv_show_wip = srv_show_www = local_show = dom_err = False
|
||||||
|
for value in dom.dom_values:
|
||||||
|
set_value = eval(str('dom.%s'%value))
|
||||||
|
|
||||||
# Missing directories (was created)
|
# wip directories
|
||||||
for dir_new in dom.dir_new:
|
if value.endswith('_d'):
|
||||||
logs.out("33", dir_new, False)
|
if value.startswith("srv_wip"):
|
||||||
|
if not tyto.exists(set_value):
|
||||||
|
if not srv_show_wip:
|
||||||
|
print(' │\n │ [wip]')
|
||||||
|
srv_show_wip = True
|
||||||
|
try:
|
||||||
|
os.makedirs(set_value, exist_ok=True)
|
||||||
|
logs.out("33", set_value, False)
|
||||||
|
except:
|
||||||
|
logs.out("1", set_value, False)
|
||||||
|
dom_err = True
|
||||||
|
|
||||||
|
# www directories
|
||||||
|
elif value.startswith("srv_www"):
|
||||||
|
if not tyto.exists(set_value):
|
||||||
|
if not srv_show_www:
|
||||||
|
print(' │\n │ [www]')
|
||||||
|
srv_show_www = True
|
||||||
|
try:
|
||||||
|
os.makedirs(set_value, exist_ok=True)
|
||||||
|
logs.out("33", set_value, False)
|
||||||
|
except:
|
||||||
|
logs.out("1", set_value, False)
|
||||||
|
dom_err = True
|
||||||
|
|
||||||
|
# local directories
|
||||||
|
else:
|
||||||
|
if not tyto.exists(set_value):
|
||||||
|
if not local_show:
|
||||||
|
print(' │\n │ [local]')
|
||||||
|
local_show = True
|
||||||
|
try:
|
||||||
|
os.makedirs(set_value, exist_ok=True)
|
||||||
|
logs.out("33", set_value, False)
|
||||||
|
except:
|
||||||
|
logs.out("1", set_value, False)
|
||||||
|
dom_err = True
|
||||||
|
|
||||||
|
|
||||||
# Create missing modules files
|
# Create missing modules files
|
||||||
|
if not tyto.exists(dom.metas_f) or \
|
||||||
|
not tyto.exists(dom.wip_metas_f):
|
||||||
|
html.create_user_metas('new')
|
||||||
|
|
||||||
|
if not tyto.exists(dom.navbar_f) or \
|
||||||
|
not tyto.exists(dom.wip_navbar_f):
|
||||||
|
html.create_navbar('new')
|
||||||
|
|
||||||
|
if not tyto.exists(dom.sidebar_f) or \
|
||||||
|
not tyto.exists(dom.wip_sidebar_f):
|
||||||
|
html.create_sidebar('new')
|
||||||
|
|
||||||
|
if not tyto.exists(dom.footer_f) or \
|
||||||
|
not tyto.exists(dom.wip_footer_f):
|
||||||
|
html.create_user_footer('new')
|
||||||
|
|
||||||
|
|
||||||
|
'''
|
||||||
create_files = \
|
create_files = \
|
||||||
{
|
{
|
||||||
'navbar_f' : form.create_navbar,
|
'navbar_f' : form.create_navbar,
|
||||||
'sidebar_f' : form.create_sidebar,
|
'sidebar_f' : form.create_sidebar,
|
||||||
'metas_f' : form.create_metas,
|
'metas_f' : form.create_metas,
|
||||||
'footer_f' : form.create_footer,
|
'footer_f' : form.create_footer,
|
||||||
'footer_about_f': form.create_footer_about
|
'footer_about_f': form.create_footer_about
|
||||||
}
|
}
|
||||||
|
|
||||||
for value in dom.file_mod:
|
for value in dom.file_mod:
|
||||||
create_files[value]('form')
|
create_files[value]('form')
|
||||||
|
'''
|
||||||
for file_mods in dom.wip_html_mods:
|
|
||||||
if not tyto.exists(file_mods):
|
|
||||||
logs.out("1", file_mods, False)
|
|
||||||
|
|
||||||
|
|
||||||
#==============================#
|
#==============================#
|
||||||
# On demand with status action #
|
# On demand with status action #
|
||||||
|
@ -86,21 +143,10 @@ def check(target):
|
||||||
logs.out("5", '[target]', True)
|
logs.out("5", '[target]', True)
|
||||||
|
|
||||||
# Domain statuses
|
# Domain statuses
|
||||||
elif target == "domain":
|
elif target == "domain":
|
||||||
conf_err = False
|
# Check unused files in servers
|
||||||
|
check_domain_files("wip")
|
||||||
if dom.dir_unu or dom.file_unu:
|
check_domain_files("www")
|
||||||
logs.out("60", '', False)
|
|
||||||
|
|
||||||
for dir_unu in dom.dir_unu:
|
|
||||||
logs.out("1", dir_unu, False)
|
|
||||||
conf_err = True
|
|
||||||
|
|
||||||
for file_unu in dom.file_unu:
|
|
||||||
logs.out("24", file_unu, False)
|
|
||||||
|
|
||||||
if conf_err:
|
|
||||||
logs.out("31", '', True)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# target is an article
|
# target is an article
|
||||||
|
@ -147,4 +193,21 @@ def check(target):
|
||||||
# Article has NO DB
|
# Article has NO DB
|
||||||
elif not db.exists:
|
elif not db.exists:
|
||||||
logs.out("25", db.uri_file, True)
|
logs.out("25", db.uri_file, True)
|
||||||
|
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
def check_domain_files(srv):
|
||||||
|
if srv == "www": template_files = dom.templates_files_www
|
||||||
|
elif srv == "wip": template_files = dom.templates_files_wip
|
||||||
|
else: return
|
||||||
|
|
||||||
|
dom_err = False
|
||||||
|
print(' │\n │ [%s]'%srv)
|
||||||
|
for f in template_files:
|
||||||
|
if not tyto.exists(f):
|
||||||
|
dom_err = True
|
||||||
|
logs.out("1", f, False)
|
||||||
|
|
||||||
|
if not dom_err:
|
||||||
|
logs.out("28", 'tout va bien', False)
|
||||||
|
|
|
@ -45,128 +45,163 @@ Tytoweb = 'https://tyto.echolib.re'
|
||||||
|
|
||||||
# Needed header tags
|
# Needed header tags
|
||||||
needed_header_tags = \
|
needed_header_tags = \
|
||||||
(
|
(
|
||||||
'title',
|
'title',
|
||||||
'about',
|
'about',
|
||||||
'author',
|
'author',
|
||||||
'tags',
|
'tags',
|
||||||
'date'
|
'date'
|
||||||
)
|
)
|
||||||
|
|
||||||
# Optional header tags
|
# Optional header tags
|
||||||
opt_header_tags = \
|
opt_header_tags = \
|
||||||
(
|
(
|
||||||
'file',
|
'file',
|
||||||
'image',
|
'image',
|
||||||
'link',
|
'link',
|
||||||
'abbr',
|
'abbr',
|
||||||
'raw',
|
'raw',
|
||||||
'code',
|
'code',
|
||||||
'snpic'
|
'snpic'
|
||||||
)
|
)
|
||||||
|
|
||||||
opt_tags_long_name = \
|
opt_tags_long_name = \
|
||||||
(
|
(
|
||||||
'link',
|
'link',
|
||||||
'file'
|
'file'
|
||||||
)
|
)
|
||||||
|
|
||||||
opt_tags_check_uri = \
|
opt_tags_check_uri = \
|
||||||
(
|
(
|
||||||
'image',
|
'image',
|
||||||
'file',
|
'file',
|
||||||
'raw',
|
'raw',
|
||||||
'code'
|
'code'
|
||||||
)
|
)
|
||||||
|
|
||||||
# Set all tags used in article's header
|
# Set all tags used in article's header
|
||||||
headers = \
|
headers = \
|
||||||
(
|
(
|
||||||
'title:',
|
'title:',
|
||||||
'about:',
|
'about:',
|
||||||
'author:',
|
'author:',
|
||||||
'tags:',
|
'tags:',
|
||||||
'date:',
|
'date:',
|
||||||
'link:',
|
'link:',
|
||||||
'image:',
|
'image:',
|
||||||
'file:',
|
'file:',
|
||||||
'abbr:',
|
'abbr:',
|
||||||
'code:',
|
'code:',
|
||||||
'raw:',
|
'raw:',
|
||||||
'#',
|
'#',
|
||||||
'snpic:',
|
'snpic:',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Words and template Tags (paragraphs, lists, bold, strong...)
|
# Words Tags (paragraphs, lists, bold, strong...)
|
||||||
# Used to check, and replace (wip) tags
|
# Used to check, and replace (wip) tags
|
||||||
# As base64 is used, do NOT set marker: =_ _=
|
# ! As base64 is used, do NOT set marker: =_ _=
|
||||||
# [5] = name for stats and log.
|
# [5] = name for stats and log.
|
||||||
# [6] = Check content differently. 't' = startswith
|
|
||||||
#-------------------------------------------------------------
|
#-------------------------------------------------------------
|
||||||
words_tags = [
|
words_tags = [
|
||||||
('>_', '_<',
|
(
|
||||||
'<a class="anchor_link" href="#%s">',
|
'>_', '_<',
|
||||||
'</a>', 'anchors', 'w'
|
'<a class="anchor_link" href="#%s">', '</a>',
|
||||||
),
|
'anchors'
|
||||||
('*_', '_*', '<strong class="strong">', '</strong>', 'strongs', 'w'),
|
),
|
||||||
('+_', '_+', '<b class="bold">', '</b>', 'bolds', 'w'),
|
(
|
||||||
(';_', '_;', '<em class="em">', '</em>', 'emphasis', 'w'),
|
'*_', '_*',
|
||||||
(':_', '_:', '<i class="italic">', '</i>', 'italics', 'w'),
|
'<strong class="strong">', '</strong>',
|
||||||
('~_', '_~', '<del class="del">', '</del>', 'dels', 'w'),
|
'strongs'
|
||||||
('._', '_.', '<u class="underline">', '</u>', 'underlines', 'w'),
|
),
|
||||||
('[_', '_]', '<cite class="cite">', '</cite>', 'cites', 'w'),
|
(
|
||||||
('%_', '_%', '<span class="custom">', '</span>', 'customs', 'w'),
|
'+_', '_+',
|
||||||
('{_', '_}', '<code class="icode">', '</code>', 'codes', 'w'),
|
'<b class="bold">', '</b>',
|
||||||
|
'bolds'
|
||||||
|
),
|
||||||
|
(
|
||||||
|
';_', '_;',
|
||||||
|
'<em class="em">', '</em>',
|
||||||
|
'emphasis'
|
||||||
|
),
|
||||||
|
(
|
||||||
|
':_', '_:',
|
||||||
|
'<i class="italic">', '</i>',
|
||||||
|
'italics'
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'~_', '_~',
|
||||||
|
'<del class="del">', '</del>',
|
||||||
|
'dels'
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'._', '_.', '<u class="underline">',
|
||||||
|
'</u>',
|
||||||
|
'underlines'
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'[_', '_]',
|
||||||
|
'<cite class="cite">', '</cite>',
|
||||||
|
'cites'
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'%_', '_%',
|
||||||
|
'<span class="custom">', '</span>',
|
||||||
|
'customs'
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'{_', '_}',
|
||||||
|
'<code class="icode">', '</code>',
|
||||||
|
'codes'
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
# At begining line, create block contents
|
# At begining line, create block contents
|
||||||
block_tags = \
|
block_tags = [
|
||||||
[
|
('((', '))', '<p class="%s">', '</p>', 'paragraphs'),
|
||||||
('((', '))', '<p class="%s">', '</p>', 'paragraphs'),
|
('[[', ']]', '[[', ']]', 'quotes'),
|
||||||
('[[', ']]', '[[', ']]', 'quotes'),
|
('{{', '}}', '{{', '}}', 'bcodes'),
|
||||||
('{{', '}}', '{{', '}}', 'bcodes'),
|
('-(', '-)', '-(', '-)', 'lists'),
|
||||||
('-(', '-)', '-(', '-)', 'lists'),
|
('<<', '>>', '<div class="%s">', '</div>', 'div'),
|
||||||
('<<', '>>', '<div class="%s">', '</div>', 'div'),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
# Tags that do not need to be paired
|
# Tags that do not need to be paired
|
||||||
#-----------------------------------
|
#-----------------------------------
|
||||||
single_tags = [
|
single_tags = [
|
||||||
('|', '<br class="%s" />'), # New Line
|
('|', '<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:
|
# When counting words, do no count line starting with:
|
||||||
nolinewords = \
|
nolinewords = \
|
||||||
(
|
(
|
||||||
block_tags[0][0], block_tags[0][1], # paragraphs
|
block_tags[0][0], block_tags[0][1], # paragraphs
|
||||||
block_tags[1][0], block_tags[1][1], # quotes
|
block_tags[1][0], block_tags[1][1], # quotes
|
||||||
block_tags[2][0], block_tags[2][1], # bcodes
|
block_tags[2][0], block_tags[2][1], # bcodes
|
||||||
block_tags[3][0], block_tags[3][1], # lists
|
block_tags[3][0], block_tags[3][1], # lists
|
||||||
single_tags[0][0], single_tags[1][0], # New line, anchor
|
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[1], '_%s:'%opt_header_tags[4], # _image:, _raw:
|
||||||
'_%s:'%opt_header_tags[5] # _code
|
'_%s:'%opt_header_tags[5] # _code
|
||||||
)
|
)
|
||||||
|
|
||||||
# warning symbols (Check if paired)
|
# warning symbols (Check if paired)
|
||||||
#----------------------------------
|
#----------------------------------
|
||||||
tpl_tags = [
|
tpl_tags = [
|
||||||
('(', ')'),
|
('(', ')'),
|
||||||
('[', ']'),
|
('[', ']'),
|
||||||
('{', '}'),
|
('{', '}'),
|
||||||
('«', '»'),
|
('«', '»'),
|
||||||
]
|
]
|
||||||
|
|
||||||
# When including HTML in article, check some paired tags
|
# When including HTML in article, check some paired tags
|
||||||
#-------------------------------------------------------
|
#-------------------------------------------------------
|
||||||
leg_html_tags = [
|
leg_html_tags = [
|
||||||
('<!--', '-->'),
|
('<!--', '-->'),
|
||||||
('<div', '</div>'),
|
('<div', '</div>'),
|
||||||
('<ul', '</ul>'),
|
('<ul', '</ul>'),
|
||||||
('<li', '</li>'),
|
('<li', '</li>'),
|
||||||
('<p', '</p>'),
|
('<p', '</p>'),
|
||||||
('<span','</span>'),
|
('<span','</span>'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -176,16 +211,25 @@ markers_lists = ('+', '=', ' ', '#')
|
||||||
|
|
||||||
# Tags used for titles
|
# Tags used for titles
|
||||||
#---------------------
|
#---------------------
|
||||||
titles_tags = ('#1 ', '#2 ', '#3 ', '#4 ', '#5 ', '#6 ')
|
titles_user = ('#1', '#2', '#3', '#4', '#5')
|
||||||
|
titles_html = ('<h1', '<h2', '<h3', '<h4', '<h5', '<h6')
|
||||||
|
titles_tags = [
|
||||||
|
("", "",),
|
||||||
|
('#1 ', '<h2 class="title_2">%s</h2>'),
|
||||||
|
('#2 ', '<h3 class="title_3">%s</h3>'),
|
||||||
|
('#3 ', '<h4 class="title_5">%s</h4>'),
|
||||||
|
('#4 ', '<h5 class="title_6">%s</h5>'),
|
||||||
|
('#5 ', '<h6 class="title_6">%s</h6>')
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
# Tags for quote
|
# Tags for quote
|
||||||
quote_tags = [
|
quote_tags = [
|
||||||
('_cite:', 'author'),
|
('_cite:', 'author'),
|
||||||
('_date:', 'date'),
|
('_date:', 'date'),
|
||||||
('_link:', 'link'),
|
('_link:', 'link'),
|
||||||
('_book:', 'book'),
|
('_book:', 'book'),
|
||||||
('_lang:', 'lang')
|
('_lang:', 'lang')
|
||||||
]
|
]
|
||||||
|
|
||||||
# Tags to check in header in content _TAG
|
# Tags to check in header in content _TAG
|
||||||
|
@ -205,6 +249,33 @@ chrs_invalid = \
|
||||||
set('{}[]_()+*=/:%~´')
|
set('{}[]_()+*=/:%~´')
|
||||||
|
|
||||||
|
|
||||||
|
new_article = """%s
|
||||||
|
# tyto new %s
|
||||||
|
|
||||||
|
title:
|
||||||
|
about:
|
||||||
|
author: %s
|
||||||
|
tags:
|
||||||
|
date: %s
|
||||||
|
|
||||||
|
#abbr: TYTO
|
||||||
|
Le générateur de sites web Libre
|
||||||
|
Tyto - Littérateur
|
||||||
|
|
||||||
|
#image: Image-1
|
||||||
|
URI
|
||||||
|
Texte-alternatif
|
||||||
|
|
||||||
|
#link: lien 1
|
||||||
|
URi/URL
|
||||||
|
Text-alternatif
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
|
#3
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
# Stats for icodes, bcodes, quotes
|
# Stats for icodes, bcodes, quotes
|
||||||
nbr_icodes = 0
|
nbr_icodes = 0
|
||||||
|
|
||||||
|
|
|
@ -425,6 +425,7 @@ def get_wh_image(value):
|
||||||
if not sizes[0][1]: return('%spx'%value)
|
if not sizes[0][1]: return('%spx'%value)
|
||||||
else: return(value)
|
else: return(value)
|
||||||
|
|
||||||
|
|
||||||
#=================================#
|
#=================================#
|
||||||
# Find all _image, get parameters #
|
# Find all _image, get parameters #
|
||||||
# Convert _images:%name to HTML #
|
# Convert _images:%name to HTML #
|
||||||
|
@ -517,6 +518,7 @@ def quote_params(qline):
|
||||||
globals()[tag[1]] = qline.rsplit('%s '%tag[0])[1].lstrip()
|
globals()[tag[1]] = qline.rsplit('%s '%tag[0])[1].lstrip()
|
||||||
return(True)
|
return(True)
|
||||||
|
|
||||||
|
|
||||||
#==========================#
|
#==========================#
|
||||||
# Convert quote in article #
|
# Convert quote in article #
|
||||||
#--------------------------#
|
#--------------------------#
|
||||||
|
@ -720,75 +722,69 @@ def wip_bcodes():
|
||||||
|
|
||||||
#========================================#
|
#========================================#
|
||||||
# Convert titles to HTML #
|
# Convert titles to HTML #
|
||||||
# Check between titles to set div or not #
|
# #1 = <h3>, #2 = <h4>... #
|
||||||
#----------------------------------------#
|
#----------------------------------------#
|
||||||
def wip_titles():
|
def wip_titles():
|
||||||
if db.titles == 0: return
|
if db.titles == 0: return
|
||||||
|
|
||||||
global post_bottom
|
global post_bottom
|
||||||
|
|
||||||
article_temp = post_bottom
|
for line in post_bottom.rsplit('\n'):
|
||||||
article_tmp2 = '' # Construct article, without empty lines
|
|
||||||
|
|
||||||
for line in post_bottom.rsplit('\n'):
|
|
||||||
if line.startswith('#'):
|
if line.startswith('#'):
|
||||||
hx = line[1]
|
tx = int(line[1])
|
||||||
title_cont = line[2: len(line)].lstrip()
|
title_name = line[2: len(line)].lstrip()
|
||||||
title_html = '<h%s class="title_%s">%s</h%s>'%(
|
title_html = tyto.titles_tags[tx][1]%title_name
|
||||||
hx, hx, title_cont, hx
|
replace_in_post(line, title_html)
|
||||||
)
|
|
||||||
article_temp = article_temp.replace(line, title_html)
|
|
||||||
|
|
||||||
|
|
||||||
# Remove useless empty lines from article
|
wip_titles_div()
|
||||||
for line in article_temp.rsplit('\n'):
|
|
||||||
if line:
|
|
||||||
if article_tmp2: article_tmp2 = '%s\n%s'%(article_tmp2, line)
|
|
||||||
else: article_tmp2 = line
|
|
||||||
|
|
||||||
article_temp = article_tmp2
|
|
||||||
|
#======================================#
|
||||||
|
# Create div between titles if content #
|
||||||
|
#--------------------------------------#
|
||||||
|
def wip_titles_div():
|
||||||
|
global post_bottom
|
||||||
|
|
||||||
# Add div after title if needed
|
article_tmp = ''
|
||||||
for ln, line in enumerate(article_tmp2.rsplit('\n')):
|
|
||||||
if line.startswith('<h'):
|
|
||||||
try: article_tmp2.rsplit('\n')[ln + 1]
|
|
||||||
except: continue
|
|
||||||
|
|
||||||
if article_tmp2.rsplit('\n')[ln + 1].startswith('<h'):
|
|
||||||
continue
|
|
||||||
else:
|
|
||||||
article_temp = \
|
|
||||||
article_temp.replace(line,
|
|
||||||
'%s\n<div class="contents">'%(line)
|
|
||||||
)
|
|
||||||
continue
|
|
||||||
else:
|
|
||||||
continue
|
|
||||||
|
|
||||||
# Close div before title if needed
|
div_close = False
|
||||||
article_tmp2 = article_temp
|
for ln, line in enumerate(post_bottom.rsplit('\n')):
|
||||||
indiv = False
|
# Remove empty lines
|
||||||
for ln, line in enumerate(article_tmp2.rsplit('\n')):
|
if not line: continue
|
||||||
try: article_tmp2.rsplit('\n')[ln + 1]
|
|
||||||
except: continue
|
|
||||||
|
|
||||||
if line.startswith('<h') and indiv:
|
div_open = False
|
||||||
article_temp = \
|
# Title <hX> found
|
||||||
article_temp.replace(line,
|
if line.startswith(tyto.titles_html):
|
||||||
'</div>\n%s'%line
|
hx = line[2]
|
||||||
)
|
|
||||||
indiv = False
|
# Div need to be close vefore title
|
||||||
|
if div_close:
|
||||||
if article_tmp2.rsplit('\n')[ln + 1].startswith('<div'):
|
line = '</div>\n%s'%line
|
||||||
indiv = True
|
div_close = False
|
||||||
continue
|
|
||||||
|
# Has content after, open div
|
||||||
|
try:
|
||||||
|
post_bottom.rsplit('\n')[ln + 1]
|
||||||
|
div_open = True
|
||||||
|
except:
|
||||||
|
continue
|
||||||
|
|
||||||
|
# New div
|
||||||
|
if div_open:
|
||||||
|
line = '%s\n<div class="contents contents_%s">'%(line, hx)
|
||||||
|
div_close = True
|
||||||
|
|
||||||
|
# Save new article with div and no empty lines
|
||||||
|
#---------------------------------------------
|
||||||
|
if not article_tmp: article_tmp = line
|
||||||
|
else: article_tmp = "%s\n%s"%(article_tmp, line)
|
||||||
|
|
||||||
if indiv:
|
# Close last div (if any)
|
||||||
article_temp = '%s\n</div>'%article_temp
|
if div_close:
|
||||||
|
article_tmp = "%s\n</div>"%(article_tmp)
|
||||||
|
|
||||||
# Replace article with new contents
|
post_bottom = article_tmp
|
||||||
post_bottom = article_temp
|
|
||||||
|
|
||||||
|
|
||||||
#==============================================#
|
#==============================================#
|
||||||
# Convert raw file to HTML with <pre> + <code> #
|
# Convert raw file to HTML with <pre> + <code> #
|
||||||
|
|
|
@ -41,14 +41,18 @@ file_n = "File changed"
|
||||||
file_e = "File exists"
|
file_e = "File exists"
|
||||||
dir_c = "Directory created"
|
dir_c = "Directory created"
|
||||||
dir_e = "Directory exists"
|
dir_e = "Directory exists"
|
||||||
|
post_exists = "Ab article already exists"
|
||||||
|
|
||||||
# chk
|
# chk
|
||||||
|
shebang_r= 'Remove shebang'
|
||||||
nycheck = "Article not yet checked"
|
nycheck = "Article not yet checked"
|
||||||
was_chk = "Article was 'check'"
|
was_chk = "Article was 'check'"
|
||||||
st_chk_o = "Old 'check' status"
|
st_chk_o = "Old 'check' status"
|
||||||
post_inc = "Unused in article"
|
post_inc = "Unused in article"
|
||||||
post_inv = "Article not valid"
|
post_inv = "Article not valid"
|
||||||
post_val = "Article is valid"
|
post_val = "Article is valid"
|
||||||
|
title_no = "Empty title"
|
||||||
|
unused_p = "Empty article"
|
||||||
|
|
||||||
# wip
|
# wip
|
||||||
nywip = "Article not yet wip"
|
nywip = "Article not yet wip"
|
||||||
|
@ -71,7 +75,6 @@ post_chg = "Article changed: 'check' it first"
|
||||||
sep_inv = "Unused separator in article"
|
sep_inv = "Unused separator in article"
|
||||||
unused_v = "Unused value in article"
|
unused_v = "Unused value in article"
|
||||||
unused_t = "Unused value in header"
|
unused_t = "Unused value in header"
|
||||||
unused_p = "Empty article"
|
|
||||||
mark_np = "Not paired marks"
|
mark_np = "Not paired marks"
|
||||||
symb_np = "Not paired symbols"
|
symb_np = "Not paired symbols"
|
||||||
snpic_d = "Using default snpic. Not found"
|
snpic_d = "Using default snpic. Not found"
|
||||||
|
|
|
@ -40,14 +40,18 @@ file_n = "Fichier modifié"
|
||||||
file_e = "Fichier présent"
|
file_e = "Fichier présent"
|
||||||
dir_c = "Dossier créé"
|
dir_c = "Dossier créé"
|
||||||
dir_e = "Dossier présent"
|
dir_e = "Dossier présent"
|
||||||
|
post_exists = "Un article existe déjà"
|
||||||
|
|
||||||
# chk
|
# chk
|
||||||
|
shebang_r= 'Enlever le shebang'
|
||||||
nycheck = "Article pas encore 'check'"
|
nycheck = "Article pas encore 'check'"
|
||||||
was_chk = "Article déjà vérifié"
|
was_chk = "Article déjà vérifié"
|
||||||
st_chk_o = "Statut 'check' Ancien"
|
st_chk_o = "Statut 'check' Ancien"
|
||||||
post_inc = "Donnée manquante dans l'article"
|
post_inc = "Donnée manquante dans l'article"
|
||||||
post_inv = "Article non valide"
|
post_inv = "Article non valide"
|
||||||
post_val = "Article valide"
|
post_val = "Article valide"
|
||||||
|
title_no = "Titre vide"
|
||||||
|
unused_p = "Article vide"
|
||||||
|
|
||||||
# Wip
|
# Wip
|
||||||
nywip = "Article pas encore 'wip'"
|
nywip = "Article pas encore 'wip'"
|
||||||
|
@ -72,7 +76,6 @@ post_chg = "Article modifié : commencer par 'check'"
|
||||||
sep_inv = "Séparateur manquant dans l'article"
|
sep_inv = "Séparateur manquant dans l'article"
|
||||||
unused_v = "Valeur manquante dans l'article"
|
unused_v = "Valeur manquante dans l'article"
|
||||||
unused_t = "Valeur manquante dans l'entête"
|
unused_t = "Valeur manquante dans l'entête"
|
||||||
unused_p = "L'article est vide"
|
|
||||||
mark_np = "Marqueurs non jumelés"
|
mark_np = "Marqueurs non jumelés"
|
||||||
symb_np = "Symboles non jumelés"
|
symb_np = "Symboles non jumelés"
|
||||||
snpic_d = "snpic utilisé par défaut. Manquant"
|
snpic_d = "snpic utilisé par défaut. Manquant"
|
||||||
|
|
|
@ -73,6 +73,7 @@ generator = "Generator"
|
||||||
# Check
|
# Check
|
||||||
check_a = "Check again this article"
|
check_a = "Check again this article"
|
||||||
post_chg = "Article was edited. Check it"
|
post_chg = "Article was edited. Check it"
|
||||||
|
new_post = "Create article"
|
||||||
|
|
||||||
# Wip
|
# Wip
|
||||||
wip_new = "Create a new HTML page in 'wip' server again"
|
wip_new = "Create a new HTML page in 'wip' server again"
|
||||||
|
|
|
@ -73,6 +73,7 @@ generator = "Generateur"
|
||||||
# Check
|
# Check
|
||||||
check_a = "Vérifier encore l'article"
|
check_a = "Vérifier encore l'article"
|
||||||
post_chg = "Article édité. Le vérifier"
|
post_chg = "Article édité. Le vérifier"
|
||||||
|
new_post = "Créer l'article"
|
||||||
|
|
||||||
# Wip
|
# Wip
|
||||||
wip_new = "Créer encore une page HTML dans le serveur 'wip'"
|
wip_new = "Créer encore une page HTML dans le serveur 'wip'"
|
||||||
|
|
Loading…
Reference in New Issue