This commit is contained in:
Cyrille L 2023-04-14 14:17:01 +02:00
parent 23f17705ec
commit 0144d046aa
21 changed files with 618 additions and 338 deletions

View File

@ -1,16 +1,10 @@
# Changelog # Changelog
Tyto - Littérateur Tyto - Littérateur
- Repository: https://git.a-lec.org/echolib/tyto - Repository: https://git.a-lec.org/echolib/tyto-litterateur
- Issues: https://git.a-lec.org/echolib/tyto/-/issues - Issues: https://git.a-lec.org/echolib/tyto-litterateur/-/issues
- Changelog: https://git.a-lec.org/echolib/tyto/-/blob/main/CHANGELOG.md - Changelog: https://git.a-lec.org/echolib/tyto-litterateur/-/blob/master/CHANGELOG.md
- License: https://git.a-lec.org/echolib/tyto/-/blob/main/LICENSE - License: https://git.a-lec.org/echolib/tyto-litterateur/-/blob/master/LICENSE
Tyto - Litterateur is a Libre project to create and manage multiple
websites from articles' files. Tyto uses its own syntax to convert
your articles in HTML5 static pages. Tyto works on a GNU/Linux system
and needs minimal dependancies.
- python3 rsync nano gawk curl
## [0.9.0] First Commit version (pre-final)
## [0.9.0]
- Last testings before final

6
debian/control vendored
View File

@ -1,10 +1,10 @@
Package: tyto Package: tyto
Version: 0.1.0 Version: 0.9.0
Section: custom Section: custom
Priority: optional Priority: optional
Architecture: all Architecture: all
Essential: no Essential: no
Depends: rsync,nano,gawk,curl Depends: nano,python3
Installed-Size: `du -ks .|cut -f 1` Installed-Size: `du -ks .|cut -f 1`
Maintainer: echolib <echolib@a-lec.org> Maintainer: echolib <echolib@a-lec.org>
Description: Tyto - Litterateur is a libre project to create and manage multiple websites from articles' files. Tyto uses its own syntax to convert your articles in HTML5 static pages. Tyto works on a GNU/Linux system and needs minimal dependencies. Description: Tyto - Litterateur is a libre project to create and manage multiple websites from articles files. Tyto uses its own syntax to convert your articles in HTML5 pages. Tyto works on a GNU/Linux system and needs minimal dependencies.

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# Version: 0.9.0
# 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>

View File

@ -117,22 +117,18 @@ code.DOMAIN {
} }
pre.bcode { pre.bcode {
} }
div.bcode { p.bcode {
} }
/* section for author and date */ /* section for author and date */
section#article_infos { section#article_infos {
} }
span#article_author { span#article_author {
} }
span#article_pub { span#article_pub {
} }
span#article_code { span#article_code {
} }
a#article_code_link { a#article_code_link {
} }
@ -140,6 +136,49 @@ a#article_code_link {
* sidebar * sidebar
*/ */
aside#sidebar {
}
h1#sidebar_title {
}
ul#sidebar_list {
}
li.sidebar_item {
}
a.sidebar_item_link {
}
h2.sidebar_item_title {
}
p.sidebar_item_about {
}
/* /*
* footer * footer
*/ */
footer#footer_page {
}
/* Block*/
div#footer_infos {
}
h1#footer_site_title {
}
p#footer_about {
}
/* Block */
div#footer_references {
}
ul.footer_items {
}
li.footer_item {
}
a.footer_item_link {
}
/* Block */
div#footer_credits {
}
p.footer_copyright {
}
p.footer_generator {
}

View File

@ -79,6 +79,7 @@ pass_db = \
'show-db', 'show-db',
'show-wip', 'show-wip',
'show-www', 'show-www',
'status',
'wip', 'wip',
) )
@ -96,6 +97,11 @@ pass_targets = \
'template' 'template'
) )
pass_status = \
(
'domain',
)
multi_chk = ('added', 'again', 'updated') multi_chk = ('added', 'again', 'updated')
action = '' action = ''

View File

@ -38,7 +38,7 @@
import time, importlib, sys, os, re, datetime import time, importlib, sys, os, re, datetime
from datetime import datetime from datetime import datetime
from time import gmtime, strftime from time import gmtime, strftime
import args, dom, logs, status, db, form, tyto, langs import args, dom, logs, status, db, form, tyto, langs, wip
domain_dir = post_err = multi_chk = False domain_dir = post_err = multi_chk = False
@ -69,7 +69,7 @@ def manage(target):
# Already check # Already check
elif db.exists and not db.old_chk: elif db.exists and not db.old_chk:
print(' [%s] > %s'%(db.title, db.uri_file)) print(' [%s] > %s'%(db.title, db.uri_file))
logs.out("20", '%s > %s'%(db.date_chk, db.uri_file), False) logs.out("20", '%s > %s'%(db.date_chk, db.uri_file), False)
answer = form.asking('%s%s '%( answer = form.asking('%s%s '%(
langs.site.check_a, langs.site.q langs.site.check_a, langs.site.q
@ -151,8 +151,8 @@ def check_all(option):
except: except:
continue continue
if option == 'updated' and not db.old_chk: if option == 'updated' and not db.chk_updated: continue
continue if option == 'again' and not db.chk_again: continue
found = True found = True
check_process(args.target) check_process(args.target)
@ -196,7 +196,7 @@ def check_process(target):
srv_post_www_uri = dom.srv_www + srv_post_short_uri srv_post_www_uri = dom.srv_www + srv_post_short_uri
direc_src = src_post_short_uri.split("/")[-1] direc_src = src_post_short_uri.split("/")[-1]
direc_src = src_post_short_uri.rsplit(direc_src)[0] direc_src = src_post_short_uri.rsplit(direc_src)[0]
# Get sub_uri for HTML # Get sub_uri for HTML
global sub_uri global sub_uri
sub_uri = db.uri_file.rsplit('articles/')[1] sub_uri = db.uri_file.rsplit('articles/')[1]
@ -235,11 +235,18 @@ def check_process(target):
# Check header tags configurations # Check header tags configurations
check_needed_tags(post_header.rsplit('\n')) check_needed_tags(post_header.rsplit('\n'))
check_opt_tags(post_header.rsplit('\n')) if post_err:
#print("In Dev: return from process...") if db.exists and tyto.exists(db.config):
if post_err: return os.remove(db.config)
return
print('\n ├ [%s] > %s'%(title, db.uri_file))
check_opt_tags(post_header.rsplit('\n'))
if post_err:
if db.exists and tyto.exists(db.config):
os.remove(db.config)
return
print('\n ├─ [%s] > %s'%(title, db.uri_file))
# Check for valid contents # Check for valid contents
check_content(post_bottom) check_content(post_bottom)
@ -271,8 +278,9 @@ def file_to_string():
for line in article.rsplit('\n'): for line in article.rsplit('\n'):
if line.startswith('-----'): if line.startswith('-----'):
sep = True if not sep:
continue sep = True
continue
if sep: if sep:
if line: content = True if line: content = True
@ -410,7 +418,7 @@ def check_needed_tags(post_header):
# Set data from tag # Set data from tag
if line.startswith('%s:'%tag): if line.startswith('%s:'%tag):
globals()[tag] = line.rsplit('%s:'%tag)[1].lstrip() globals()[tag] = line.rsplit('%s:'%tag)[1].lstrip()
globals()[tag] = globals()[tag].replace('"', '') globals()[tag] = tyto.convert_altname(globals()[tag])
# Stat for "tags:" # Stat for "tags:"
if tag == 'tags': if tag == 'tags':
stat_tags = len(globals()[tag].strip().split(",")) stat_tags = len(globals()[tag].strip().split(","))
@ -420,6 +428,8 @@ def check_needed_tags(post_header):
if not globals()[tag]: if not globals()[tag]:
logs.out("38", '%s:'%tag, False) logs.out("38", '%s:'%tag, False)
post_err = True post_err = True
# Check date format # Check date format
# Set french format in post DB # Set french format in post DB
@ -495,6 +505,27 @@ def check_opt_tags(post_header):
check_3lines(tag, ln, line) check_3lines(tag, ln, line)
#===================================#
# Check if registred value is valid #
#-----------------------------------#
def valid_data_name(tag, name):
global post_err
data_inv = ''
data_err = False
for c in name:
if c in tyto.chrs_invalid:
post_err = True
data_err = True
data_inv = '%s%s'%(data_inv, str(c))
if data_err:
logs.out("3", '"%s: %s" > %s'%(tag, name, data_inv), False)
return False
return True
#============================================# #============================================#
# Do stats, check 3 lines tags from ln # # Do stats, check 3 lines tags from ln #
# Set data for each 2 next lines # # Set data for each 2 next lines #
@ -519,7 +550,8 @@ def check_3lines(tag, ln, line):
name = line.rsplit('%s:'%tag)[1].lstrip() name = line.rsplit('%s:'%tag)[1].lstrip()
else: else:
name = line.rsplit('%s:'%tag)[1].lstrip().rsplit(' ')[0] name = line.rsplit('%s:'%tag)[1].lstrip().rsplit(' ')[0]
if not valid_data_name(tag, name): return
if not name: if not name:
logs.out("2", 'L=%s. "%s: %s" > %s'%( logs.out("2", 'L=%s. "%s: %s" > %s'%(
@ -576,6 +608,10 @@ def check_3lines(tag, ln, line):
), False) ), False)
post_err = True post_err = True
# Convert special characters for HTML
if not tag in tyto.opt_tags_check_uri:
data = tyto.convert_altname(data)
# For tags having URI, check if file exists # For tags having URI, check if file exists
# Set data for post DB # Set data for post DB
if l == 1 and tag in tyto.opt_tags_check_uri: if l == 1 and tag in tyto.opt_tags_check_uri:

View File

@ -36,7 +36,10 @@
import os import os
import args, logs, dom, form, tyto, check, publish import args, logs, dom, form, tyto, check, publish
remove = exists = post = corrupt = False remove = exists = post = corrupt = file_wip = file_www = False
chk_again = chk_updated = False
wip_again = wip_added = wip_updated = False
www_again = www_added = www_updated = False
if dom.hole: if dom.hole:
logs.out("13", '', True) logs.out("13", '', True)
@ -59,7 +62,10 @@ if args.target \
config = '%s%s.config'%(dom.articles_db_d, uri_id) config = '%s%s.config'%(dom.articles_db_d, uri_id)
if tyto.exists(config): if tyto.exists(config):
exists = True exists = True
exec(open(config).read()) try:
exec(open(config).read())
except:
exists = False
else: else:
exists = False exists = False
@ -129,6 +135,7 @@ if args.target \
'codes', 'codes',
) )
# Set exist for wip and www files
for value in values: for value in values:
try: try:
eval(str(value)) eval(str(value))
@ -143,7 +150,6 @@ if args.target \
exists = False exists = False
logs.out("23", config, False) logs.out("23", config, False)
file_wip = file_www = False
old_chk = old_wip = old_www = False old_chk = old_wip = old_www = False
no_chk = no_wip = no_www = False no_chk = no_wip = no_www = False
sync_srvs = False sync_srvs = False
@ -154,19 +160,34 @@ if args.target \
if tyto.exists(post_wip): file_wip = True if tyto.exists(post_wip): file_wip = True
if tyto.exists(post_www): file_www = True if tyto.exists(post_www): file_www = True
# Source article has changed
if hash_post != hash_chk: old_chk = True
# WIP article is old
if hash_chk != hash_wip: old_wip = True
# WWW article is old
if hash_wip != hash_www: old_www = True
# Statuses not set in Db # Statuses not set in Db
if not hash_chk: no_chk = True if not hash_chk: no_chk = True
if not hash_wip: no_wip = True if not hash_wip: no_wip = True
if not hash_www: no_www = True if not hash_www: no_www = True
# Source article has changed
if hash_post != hash_chk: old_chk = chk_updated = True
if hash_chk: chk_again = True
# WIP article is old
if not old_chk:
if hash_wip and hash_chk != hash_wip: old_wip = wip_updated = True
if no_wip: wip_added = True
if hash_wip: wip_again = True
if not file_wip:
old_wip = wip_updated = True
wip_added = True
wip_again = True
# WWW article is old
if not old_wip:
if hash_www and hash_www != hash_wip: old_www = www_updated = True
if hash_www: www_again = True
if no_www: www_added = True
if not file_www:
old_www = www_updated = True
www_added = True
www_again = True
# Article is updated on both servers # Article is updated on both servers
if hash_chk == hash_wip == hash_www: sync_srvs = True if hash_chk == hash_wip == hash_www: sync_srvs = True

View File

@ -36,7 +36,7 @@
#********************************************************************** #**********************************************************************
from datetime import datetime from datetime import datetime
import os, sys, re, locale, importlib import os, sys, shutil, re, locale, importlib
import logs, dom, tyto, html, show, langs import logs, dom, tyto, html, show, langs
# locale translation directory # locale translation directory
@ -184,12 +184,13 @@ def create_domain(target):
# Start registering variables in domain database # Start registering variables in domain database
#----------------------------------------------- #-----------------------------------------------
local_user = '%s/.local/tyto/%s/'%(dom.home_dir, shortname) local_user = '%s/.local/tyto/%s/'%(dom.home_dir, shortname)
modules_dir = '%s/articles/_configs/'%dom.folder modules_dir = '%sarticles/_configs/'%dom.root_dir
footer_about_f = '%sfooter_about.html'%modules_dir footer_about_f = '%sfooter_about.html'%modules_dir
config_bkp = '%sdomain_config.bkp'%local_user
set_f = \ set_f = \
'# Home Domain\n' + \ '# Home Domain\n' + \
'directory = "%s/"\n'%dom.folder + \ 'directory = "%s"\n'%dom.root_dir + \
'database = "%s"\n'%dom.config + \ 'database = "%s"\n'%dom.config + \
'\n# Local user configuration\n' + \ '\n# Local user configuration\n' + \
'lang_sys = "%s"\n'%lang_sys + \ 'lang_sys = "%s"\n'%lang_sys + \
@ -197,9 +198,9 @@ def create_domain(target):
'lang_logs = "%s"\n'%lang_logs + \ 'lang_logs = "%s"\n'%lang_logs + \
'articles_db_d = "%sarticles/"\n'%local_user + \ 'articles_db_d = "%sarticles/"\n'%local_user + \
'\n# Working directories\n' + \ '\n# Working directories\n' + \
'articles_d = "%s/articles/"\n'%dom.folder + \ 'articles_d = "%sarticles/"\n'%dom.root_dir + \
'files_d = "%s/articles/files/"\n'%dom.folder + \ 'files_d = "%sarticles/files/"\n'%dom.root_dir + \
'images_d = "%s/articles/images/"\n'%dom.folder + \ 'images_d = "%sarticles/images/"\n'%dom.root_dir + \
'modules_d = "%s"\n'%modules_dir + \ 'modules_d = "%s"\n'%modules_dir + \
'\n# Modules files\n' + \ '\n# Modules files\n' + \
'navbar_f = "%styto.navbar"\n'%modules_dir + \ 'navbar_f = "%styto.navbar"\n'%modules_dir + \
@ -336,7 +337,7 @@ def create_domain(target):
if answer: title = answer if answer: title = answer
if not title: invalid = True if not title: invalid = True
elif '"' in title: title = title.replace('"', '') else: title = tyto.convert_altname(title)
set_f = 'title = "%s"'%title set_f = 'title = "%s"'%title
tyto.set_file(dom.config, False, set_f) tyto.set_file(dom.config, False, set_f)
@ -368,7 +369,7 @@ def create_domain(target):
if answer: about = answer if answer: about = answer
if not about: invalid = True if not about: invalid = True
elif '"' in about: about = about.replace('"', '') else: about = tyto.convert_altname(about)
set_f = 'about = "%s"'%about set_f = 'about = "%s"'%about
tyto.set_file(dom.config, False, set_f) tyto.set_file(dom.config, False, set_f)
@ -595,7 +596,8 @@ def create_domain(target):
if not sdb_title: if not sdb_title:
sdb_title = '' sdb_title = ''
invalid = True invalid = True
elif '"' in sdb_title: sdb_title = sdb_title.replace('"', '') else:
sdb_title = tyto.convert_altname(sdb_title)
set_f = 'sidebar_title = "%s"'%sdb_title set_f = 'sidebar_title = "%s"'%sdb_title
tyto.set_file(dom.config, False, set_f) tyto.set_file(dom.config, False, set_f)
@ -648,7 +650,8 @@ def create_domain(target):
# Activate Domain # Activate Domain
#---------------- #----------------
tyto.set_file(dom.config, False, '\nactivated = True') tyto.set_file(dom.config, False, '\nactivated = True')
shutil.copy2(dom.config, config_bkp)
logs.out("32", config_bkp, False)
# RELoad config # RELoad config
#-------------- #--------------
@ -902,7 +905,7 @@ def create_footer(option):
Tytosrc = \ Tytosrc = \
'\n%s(<a href="%s"\n'%(6 * ' ', tyto.Tytogit) + \ '\n%s(<a href="%s"\n'%(6 * ' ', tyto.Tytogit) + \
'%stitle="%s"\n'%(9 * ' ', langs.site.tyto_git_t%(tyto.Tyto)) + \ '%stitle="%s"\n'%(9 * ' ', langs.site.tyto_git_t%(tyto.Tyto)) + \
'%sid="footer_item_link">%s</a>)'%(9 * ' ', langs.site.source_code) '%sclass="footer_item_link">%s</a>)'%(9 * ' ', langs.site.source_code)
tyto_show = \ tyto_show = \
'%s<a href="%s"\n'%(6 * ' ', tyto.Tytoweb) + \ '%s<a href="%s"\n'%(6 * ' ', tyto.Tytoweb) + \
@ -919,7 +922,7 @@ def create_footer(option):
domain_home = \ domain_home = \
'\n%s<a href="/"\n'%(6 * ' ') + \ '\n%s<a href="/"\n'%(6 * ' ') + \
'%stitle="%s"\n'%(9 * ' ', langs.site.go_home) + \ '%stitle="%s"\n'%(9 * ' ', langs.site.go_home) + \
'%sid="footer_title_link">%s</a>'%(9 * ' ', dom.title) '%sclass="footer_title_link">%s</a>'%(9 * ' ', dom.title)
# Insert content of footer_about_f or default if not exists # Insert content of footer_about_f or default if not exists
footer_about = '' footer_about = ''
@ -1034,10 +1037,12 @@ def create_footer(option):
' </ul>\n' + \ ' </ul>\n' + \
' </div>\n' + \ ' </div>\n' + \
' <div id="footer_credits">\n' + \ ' <div id="footer_credits">\n' + \
' <p>Copyright%s © %s %s</p>\n'%( ' <p class="footer_copyright">Copyright%s © %s %s</p>\n'%(
langs.site.pp, footer_date, dom.title langs.site.pp, footer_date, dom.title
) + \ ) + \
' <p>%s%s \n'%(langs.site.generator, langs.site.pp) + \ ' <p class="footer_generator">%s%s \n'%(
langs.site.generator, langs.site.pp
) + \
'%s\n'%tyto_show + \ '%s\n'%tyto_show + \
' </p>\n' + \ ' </p>\n' + \
' </div>\n' + \ ' </div>\n' + \

View File

@ -254,14 +254,15 @@ def create_user_metas(option):
if option == 'wip': target = dom.wip_metas_f if option == 'wip': 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
# Create wip metas.html file according to option
#-----------------------------------------------
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
#-----------------------------------------------
try: user_file = open(dom.metas_f, 'r').read() try: user_file = open(dom.metas_f, 'r').read()
except: logs.out("1", dom.metas_f, True) except: logs.out("1", dom.metas_f, True)
@ -290,6 +291,14 @@ def create_navbar(option):
if option == 'wip': target = dom.wip_navbar_f if option == 'wip': 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):
form.asking('%s. %s(%s)%s '%(
langs.site.navbar, langs.site.form_rep,
option, langs.site.q
), True)
print('\n%s'%langs.site.navbar_inf)
# navbar has items # navbar has items
navbar_items = False navbar_items = False
@ -374,14 +383,6 @@ def create_navbar(option):
# Create ending HTML file # Create ending HTML file
else: else:
menu_html = '\n%s\n%s</ul>\n%s</nav>\n'%(menu_html, 8 * ' ', 6 * ' ') menu_html = '\n%s\n%s</ul>\n%s</nav>\n'%(menu_html, 8 * ' ', 6 * ' ')
# Ask to replace only for www
if option == 'www':
form.asking('%s. %s(%s)%s '%(
langs.site.navbar, langs.site.form_rep,
option, langs.site.q
), True)
tyto.set_file(target, 'New', menu_html) tyto.set_file(target, 'New', menu_html)
@ -391,7 +392,7 @@ def create_navbar(option):
#----------------------------------------------# #----------------------------------------------#
def create_sidebar(option): def create_sidebar(option):
dom.valid() dom.valid()
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)
@ -400,6 +401,13 @@ def create_sidebar(option):
if option == 'wip': target = dom.wip_sidebar_f if option == 'wip': 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):
form.asking('%s. %s%s '%(
langs.site.sidebar, langs.site.form_rep, langs.site.q
), True)
print('\n%s'%langs.site.sidebar_inf)
sidebar_items = False sidebar_items = False
# Set HTML sidebar # Set HTML sidebar
@ -435,7 +443,6 @@ def create_sidebar(option):
if not tyto.exists(db_uri): if not tyto.exists(db_uri):
logs.out('25', line, False) logs.out('25', line, False)
continue continue
# Load article"s database # Load article"s database
exec(open(db_uri).read(),globals()) exec(open(db_uri).read(),globals())
@ -494,13 +501,6 @@ def create_sidebar(option):
sidebar_content = '' sidebar_content = ''
for line in sidebar_temp.rsplit('\n'): for line in sidebar_temp.rsplit('\n'):
sidebar_content = sidebar_content + '%s%s\n'%(4 * ' ', line) sidebar_content = sidebar_content + '%s%s\n'%(4 * ' ', line)
# Ask to replace only for www
if option == 'www':
form.asking('%s. %s(%s)%s '%(
langs.site.sidebar, langs.site.form_rep,
option, langs.site.q
), True)
tyto.set_file(target, True, sidebar_content) tyto.set_file(target, True, sidebar_content)
@ -519,6 +519,8 @@ 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)

View File

@ -33,7 +33,15 @@
#********************************************************************** #**********************************************************************
import os, langs import os, importlib
import langs
importlib.reload(langs)
# Set colors
CS = '\033[0;0m'
CR = '\033[1;31m'
CY = '\033[1;33m'
CG = '\033[1;32m'
def tyto(target): def tyto(target):
noinfos = False noinfos = False
@ -48,19 +56,46 @@ def tyto(target):
# Show domains list # Show domains list
try: try:
db_domains = '%s/.local/tyto'%os.path.expanduser('~') has_domains = True
user = os.environ.get('USER') user = os.environ.get('USER')
hashdomain = False user_dir = os.path.expanduser('~')
print('# Registred domains for', user) db_domains = '%s/.local/tyto'%user_dir
for folder in os.listdir(db_domains):
if os.path.isdir('%s/%s'%(db_domains, folder)):
if hashdomain:
hasdomain = False
hashdomain = True
print(' -', folder)
except: except:
noinfo = True has_domains = False
print(':< No .../.local/tyto')
print(':', langs.site.args_helps) if not os.path.exists(db_domains):
has_domains = False
print('! No directory > %s/'%db_domains)
if has_domains:
list_domains = (())
for folder in os.listdir(db_domains):
domain_local_uri = '%s/%s'%(db_domains, folder)
if os.path.isdir(domain_local_uri):
domain_conf = '%s/domain_config.bkp'%domain_local_uri
if os.path.exists(domain_conf):
try:
exec(open(domain_conf).read(),globals())
except:
continue
if os.path.exists(directory):
dir_domain = '%s%s%s'%(CG, directory, CS)
else:
dir_domain = '%s%s%s'%(CR, directory, CS)
list_domains = \
(('%s > %s > %s'%(folder, dir_domain, www_url)),)
if list_domains:
print('# %s %ss %s'%(
langs.site.reg_domains,
langs.site.fo,
user
)
)
for domain in list_domains:
print(' - %s'%domain)
# Show arguments help
print(langs.site.args_helps)

View File

@ -59,11 +59,7 @@ try:
log = importlib.import_module('logs_%s'%lang_logse, package=None) log = importlib.import_module('logs_%s'%lang_logse, package=None)
except: except:
log = importlib.import_module('logs_%s'%lang_sys, package=None) log = importlib.import_module('logs_%s'%lang_sys, package=None)
'''
exec(open('%s/logs_%s.py'%(trans_dir, lang.logs)).read())
except:
exec(open('%s/logs_%s.py'%(trans_dir, lang_sys)).read())
'''
# Set language site/form from configuration domain # Set language site/form from configuration domain
# or set default english if not known # or set default english if not known

View File

@ -96,6 +96,16 @@ def out(nbr, value, out):
'51' : '%s%s%s > %s'%(CY, langs.log.data_inc, CS, value), '51' : '%s%s%s > %s'%(CY, langs.log.data_inc, CS, value),
'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),
'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),
'94' : ' ╞═ %s%s%s > %s'%(CY, langs.log.st_chk_o, CS, value),
'255' : '%s'%langs.log.laterout '255' : '%s'%langs.log.laterout
} }

View File

@ -71,16 +71,95 @@ def manage_publish(target):
# Publish in www server an article # Publish in www server an article
check_to_publish('one') check_to_publish('one')
# Article already published
if db.file_www:
logs.out("85", '%s > %s'%(db.date_chk, db.uri_file), False)
answer = form.asking('%s%s '%(
langs.site.publish_a, langs.site.q
), True)
# Publish
publish_article() publish_article()
# Create new ATOM/RSS file # Create new ATOM/RSS file
rss.create_feed() rss.create_feed()
#============================================#
# Option 'all' to publish again, based on DB #
#--------------------------------------------#
def publish_all(option):
tyto.show_multi_message('www', dom.srv_www)
form.asking('%s%s '%(langs.site.proceed, langs.site.q), True)
# Sort by newer articles (created by last check)
db_articles = sorted(Path(dom.articles_db_d).iterdir(),
key=os.path.getmtime
)
# Load domain configuration DB
option = args.target
found = False
for post_db in db_articles:
if not str(post_db).endswith('.config'): continue
# Load DB
exec(open(post_db).read(),globals())
args.target = short_src
importlib.reload(db)
if option == "again" and not db.www_again: continue
elif option == "added" and not db.www_added: continue
elif option == "updated" and not db.www_updated: continue
check_to_publish('all')
if err_pub:
continue
found = True
publish_article()
if not found:
logs.out("28", 'publish %s'%option, True)
# If found: create new ATOM/RSS file
rss.create_feed()
#==============================#
# Check if it can be published #
#------------------------------#
def check_to_publish(process):
global err_pub
err_pub = False
print('\n ├ [%s] > %s'%(db.title, db.post_src))
# Article was not checked or changed
if db.no_chk:
logs.out("25", db.uri_file, False)
err_pub = 25
elif db.old_chk:
logs.out("9", db.uri_file, False)
err_pub = 9
# Article must exists in wip server
if db.no_wip or db.old_wip:
logs.out("30", db.uri_file, False)
err_pub = 30
elif not db.file_wip:
logs.out("1", db.post_wip, False)
err_pub = 1
if err_pub:
if process == 'all': return
elif process == 'one': sys.exit(err_pub)
#===============# #===============#
# Let's publish # # Let's publish #
#---------------# #---------------#
def publish_article(): def publish_article():
# Copy wip page to www page # Copy wip page to www page
if not os.makedirs('%s%s'%(dom.srv_www, db.direc_src), exist_ok=True): if not os.makedirs('%s%s'%(dom.srv_www, db.direc_src), exist_ok=True):
logs.out("33", '%s%s'%(dom.srv_www, db.direc_src), False) logs.out("33", '%s%s'%(dom.srv_www, db.direc_src), False)
@ -142,7 +221,6 @@ def replace_lines_pub():
logs.out("46", db.post_www, False) logs.out("46", db.post_www, False)
#print(www_html_post)
tyto.set_file(db.post_www, 'New', www_html_post) tyto.set_file(db.post_www, 'New', www_html_post)
@ -183,86 +261,3 @@ def publish_template(option):
html.create_user_footer('pub') html.create_user_footer('pub')
#============================================#
# Option 'all' to publish again, based on DB #
#--------------------------------------------#
def publish_all(option):
# Ask or show what to do
if args.target == "again":
form.asking("%s%s "%(
langs.site.wip_again, langs.site.q
), True)
elif args.target == "addedd":
print('%s'%langs.site.wip_older)
#os.chdir(dom.articles_d)
elif args.target == "updated":
print('%s'%langs.site.wip_newer)
# Sort by newer articles (created by last check)
db_articles = sorted(Path(dom.articles_db_d).iterdir(),
key=os.path.getmtime
)
# Load domain configuration DB
option = args.target
found = False
for post_db in db_articles:
if not str(post_db).endswith('.config'): continue
# Load DB
exec(open(post_db).read(),globals())
args.target = short_src
importlib.reload(db)
if not db.hash_wip: continue
if option == "again" and not db.sync_srvs: continue
if option == "added" and not db.old_www: continue
if db.old_chk:
logs.out("9", '', False)
continue
check_to_publish('all')
if err_pub: continue
found = True
publish_article()
if not found:
logs.out("28", '(publish)', True)
else:
# Create new ATOM/RSS file
rss.create_feed()
#==============================#
# Check if it can be published #
#------------------------------#
def check_to_publish(process):
global err_pub
err_pub = False
print('\n ├─ [%s] > %s'%(db.title, db.post_src))
# Article was not checked or changed
if db.no_chk:
logs.out("25", db.uri_file, False)
err_pub = 25
elif db.old_chk:
logs.out("9", db.uri_file, False)
err_pub = 9
# Article must exists in wip server
if db.no_wip or db.old_wip:
logs.out("30", db.uri_file, False)
err_pub = 30
elif not db.file_wip:
logs.out("1", db.post_wip, False)
err_pub = 1
if err_pub:
if process == 'all': return
elif process == 'one': sys.exit(err_pub)

View File

@ -35,7 +35,7 @@
import os import os
from pathlib import Path from pathlib import Path
import logs, dom, db, tyto import logs, dom, db, tyto, langs
#============================# #============================#
@ -120,5 +120,6 @@ def create_feed():
' </channel>\n' + \ ' </channel>\n' + \
'</rss>' '</rss>'
print('\n ├─ %s'%langs.site.rss_c)
tyto.set_file(dom.www_rss_f, 'New', set_f) tyto.set_file(dom.www_rss_f, 'New', set_f)

View File

@ -33,7 +33,7 @@
#********************************************************************** #**********************************************************************
import args, dom, logs, tyto, form import args, dom, logs, tyto, form, db
def domain(): def domain():
if dom.hole: logs.out("13", '', True) if dom.hole: logs.out("13", '', True)
@ -80,9 +80,13 @@ def domain():
# On demand with status action # # On demand with status action #
#------------------------------# #------------------------------#
def check(target): def check(target):
conf_err = False # target needed
if not target:
if target == "domain": logs.out("5", '[target]', True)
elif target == "domain":
conf_err = False
if dom.dir_unu or dom.file_unu: if dom.dir_unu or dom.file_unu:
logs.out("60", '', False) logs.out("60", '', False)
@ -93,6 +97,37 @@ def check(target):
for file_unu in dom.file_unu: for file_unu in dom.file_unu:
logs.out("24", file_unu, False) logs.out("24", file_unu, False)
if conf_err: if conf_err:
logs.out("31", '', True) logs.out("31", '', True)
return
# Unused file
elif not db.post:
logs.out("1", db.uri_file, True)
# Article has DB
elif db.exists:
# Article datas
print('\n ├ [%s] > %s'%(db.title, db.uri_file))
# chk
if db.old_chk: logs.out("94", db.uri_file, False)
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)
# 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)
return
# Article has NO DB
elif not db.exists:
logs.out("25", db.uri_file, True)

View File

@ -35,7 +35,7 @@
import os, sys, re, subprocess, locale, base64, datetime, shutil import os, sys, re, subprocess, locale, base64, datetime, shutil
from hashlib import blake2b from hashlib import blake2b
import args, dom, logs import args, dom, logs, langs
# :D # :D
Tyto = 'Tyto - Littérateur' Tyto = 'Tyto - Littérateur'
@ -182,6 +182,11 @@ quote_tags = [
# Tags to check in header in content _TAG # Tags to check in header in content _TAG
head_tags = ("image:", "raw:", "code;") head_tags = ("image:", "raw:", "code;")
# Valid characters for some datas
chrs_invalid = \
set('{}[]_()+*=/:%~´')
# Stats for icodes, bcodes, quotes # Stats for icodes, bcodes, quotes
nbr_icodes = 0 nbr_icodes = 0
@ -197,6 +202,18 @@ def exists(uri):
else: return(False) else: return(False)
#========================================#
# Return converted valid HTML characters #
#----------------------------------------#
def convert_altname(altname):
altname = altname.replace('<', '&lt;')
altname = altname.replace('>', '&gt;')
altname = altname.replace('"', '&quot;')
altname = altname.replace("'", '&apos;')
return altname
#=======================# #=======================#
# Return sum of srcfile # # Return sum of srcfile #
# src: True = Content # # src: True = Content #
@ -309,8 +326,7 @@ def protect_bcodes_quotes(process, post_bottom):
in_bcode = False in_bcode = False
if process == "wip": if process == "wip":
bcode = '%s\n%s'%(bcode, line) bcode = '%s\n%s'%(bcode, line)
bcode = bcode.replace('<', '&lt;') bcode = convert_altname(bcode)
bcode = bcode.replace('>', '&gt;')
b64_bcode = b64('Encode', bcode, 'B64.', '.B64') b64_bcode = b64('Encode', bcode, 'B64.', '.B64')
line = b64_bcode line = b64_bcode
@ -324,8 +340,7 @@ def protect_bcodes_quotes(process, post_bottom):
in_quote = False in_quote = False
if process == "wip": if process == "wip":
quote = '%s\n%s'%(quote, line) quote = '%s\n%s'%(quote, line)
quote = quote.replace('<', '&lt;') quote = convert_altname(quote)
quote = quote.replace('>', '&gt;')
b64_quote = b64('Encode', quote, 'Q64.', '.Q64') b64_quote = b64('Encode', quote, 'Q64.', '.Q64')
line = b64_quote line = b64_quote
@ -408,8 +423,7 @@ def protect_icodes(post_bottom):
# No more in code if # No more in code if
if c_a == '}' and not c_b == '\\': if c_a == '}' and not c_b == '\\':
in_icode = False in_icode = False
src_code = src_code.replace('<', '&lt;') src_code = convert_altname(src_code)
src_code = src_code.replace('>', '&gt;')
code = '%s%s%s'%(code, src_code, words_tags[9][3]) code = '%s%s%s'%(code, src_code, words_tags[9][3])
b64_code = b64('Encode', code, 'I64.', '.I64') b64_code = b64('Encode', code, 'I64.', '.I64')
rep_code = "%s%s%s"%( rep_code = "%s%s%s"%(
@ -535,3 +549,18 @@ def files_to_srv(server):
logs.out("32", f_dst, False) logs.out("32", f_dst, False)
except: except:
logs.out('4', f_dst, True) logs.out('4', f_dst, True)
#========================================#
# For mass treatment, show message about #
#----------------------------------------#
def show_multi_message(server, srv_dir):
if args.target == "added":
print("%s '%s' > %s"%(langs.site.srv_added, server, srv_dir))
elif args.target == "updated":
print("%s '%s' > %s "%(langs.site.srv_updated, server, srv_dir))
elif args.target == "again":
print("%s '%s' > %s"%(langs.site.srv_again, server, srv_dir))

View File

@ -40,6 +40,7 @@ import os, re, sys, locale, shutil, importlib, time
from pathlib import Path from pathlib import Path
import args, logs, langs, dom, db, tyto, html, form, stats import args, logs, langs, dom, db, tyto, html, form, stats
#=========================================# #=========================================#
# Manage wip action with option as target # # Manage wip action with option as target #
#-----------------------------------------# #-----------------------------------------#
@ -85,34 +86,15 @@ def manage(target):
elif db.old_chk: elif db.old_chk:
logs.out("9", db.uri_file, True) logs.out("9", db.uri_file, True)
# Article has changed or wip file missing # Create HTML page
if db.old_wip or not db.file_wip: wip_article(db.uri_file)
wip_article(db.uri_file)
# wip is up-to-date: ask to wip again
else:
logs.out("19", db.date_wip, False)
form.asking(' ├ [%s] %s%s '%(
db.title, langs.site.wip_new, langs.site.q
), True)
wip_article(db.uri_file)
#========================================# #========================================#
# Option 'all' to wip again, based on DB # # Option 'all' to wip again, based on DB #
#----------------------------------------# #----------------------------------------#
def wip_all(process): def wip_all(process):
# Ask or show what to do tyto.show_multi_message('wip', dom.srv_wip)
if args.target == "again":
form.asking("%s%s "%(
langs.site.wip_again, langs.site.q
), True)
elif args.target == "addedd":
print('%s'%langs.site.wip_older)
elif args.target == "updated":
print('%s'%langs.site.wip_newer)
# Sort by newer articles (created by last check) # Sort by newer articles (created by last check)
db_articles = sorted(Path(dom.articles_db_d).iterdir(), db_articles = sorted(Path(dom.articles_db_d).iterdir(),
@ -133,23 +115,10 @@ def wip_all(process):
importlib.reload(db) importlib.reload(db)
except: except:
continue continue
# Article has changed and not check if option == "added" and not db.wip_added: continue
if db.old_chk: elif option == "updated" and not db.wip_updated: continue
logs.out("9", db.post_src, False) elif option == "again" and not db.wip_again: continue
continue
# newer: article not yet wip
elif option == "added" and db.hash_wip:
continue
# All: only old wip
elif option == "updated" and not db.old_wip:
continue
# again: wip again wip articles
elif option == "again" and not db.hash_wip:
continue
found = True found = True
wip_article(db.post_src) wip_article(db.post_src)
@ -175,7 +144,7 @@ def wip_article(target):
# Convert file to strings # Convert file to strings
file_to_string(target) file_to_string(target)
print('\n [%s] > %s'%(db.title, db.post_src)) print('\n [%s] > %s'%(db.title, db.post_src))
global post_header global post_header
global post_bottom global post_bottom
@ -192,11 +161,11 @@ def wip_article(target):
# Convert contents from modules # Convert contents from modules
wip_images() # Images_%i from headers in DB
wip_single_tags() # br /, anchors wip_single_tags() # br /, anchors
wip_words_tags() # Paragraphs, strongs, italics wip_words_tags() # Paragraphs, strongs, italics
wip_links() # Links_%i from headers in DB wip_links() # Links_%i from headers in DB
wip_abbrs() # Convert abbr wip_abbrs() # Convert abbr
wip_images() # Images_%i from headers in DB
wip_titles() # Convert #N, remove empty line, add divs wip_titles() # Convert #N, remove empty line, add divs
wip_lists() # convert ul/ol lists wip_lists() # convert ul/ol lists
wip_quotes() # Quotes. Decode base64 Q64 and convert to HTML wip_quotes() # Quotes. Decode base64 Q64 and convert to HTML
@ -234,15 +203,16 @@ def file_to_string(post_file):
for line in article.rsplit('\n'): for line in article.rsplit('\n'):
if line.startswith('-----'): if line.startswith('-----'):
sep = True if not sep:
continue sep = True
continue
if sep: if sep:
if not post_bottom: post_bottom = line if not post_bottom: post_bottom = line
else: post_bottom = '%s\n%s'%(post_bottom, line) else: post_bottom = '%s\n%s'%(post_bottom, line)
else: else:
if not post_header: post_header = line if not post_header: post_header = line
else: post_header = '%s\n%s'%(post_header, line) else: post_header = '%s\n%s'%(post_header, line)
#===============================================================# #===============================================================#
@ -383,9 +353,12 @@ def wip_abbrs():
abbr_src = '<abbr class="%s" title="%s">%s</abbr>' abbr_src = '<abbr class="%s" title="%s">%s</abbr>'
for i in range(1, db.uniq_abbrs + 1): for i in range(1, db.uniq_abbrs + 1):
abbr = 'db.abbr_%s'%i abbr = 'db.abbr_%s'%i
try: abbr_show = eval(abbr)[2]
except: abbr_show = eval(abbr)[0] abbr_show = eval(abbr)[2]
if not eval(abbr)[2]:
abbr_show = eval(abbr)[0][1:-1]
abbr_html = abbr_src%(dom.css, abbr_html = abbr_src%(dom.css,
eval(abbr)[1], eval(abbr)[1],
abbr_show abbr_show
@ -689,7 +662,7 @@ def wip_bcodes():
# Block-code content per line # Block-code content per line
else: else:
html_bcode = \ html_bcode = \
'%s\n <div class="bcode">%s</div>'%( '%s\n <p class="bcode">%s</p>'%(
html_bcode, line html_bcode, line
) )
@ -779,17 +752,19 @@ def wip_filecode(target):
for i in range(1, db.uniq_codes + 1): for i in range(1, db.uniq_codes + 1):
code = 'db.code_%s'%i code = 'db.code_%s'%i
code_file = open('%s%s'%(dom.articles_d, eval(code)[1])).read() code_file = open('%s%s'%(dom.articles_d, eval(code)[1])).read()
code_html = '<pre class="%s" title="%s">\n'%( code_html = '<code class="%s" title="%s">\n'%(
dom.css, eval(code)[2] dom.css, eval(code)[2]
) + \ ) + \
' <code class="bcode">' ' <pre class="bcode">'
for line in code_file.rsplit('\n'): for line in code_file.rsplit('\n'):
code_html = '%s\n <span class="bcode">%s</span>'%( line = line.replace('<', '&lt;')
line = line.replace('>', '&gt;')
code_html = '%s\n <p class="bcode">%s</p>'%(
code_html, line code_html, line
) )
code_html = '%s\n </code>\n</pre>'%(code_html) code_html = '%s\n </pre>\n</code>'%(code_html)
replace_in_post(eval(code)[0], replace_in_post(eval(code)[0],
code_html code_html
) )
@ -803,21 +778,21 @@ def wip_lists():
global post_bottom global post_bottom
content_list = ''
in_list = False in_list = False
for line in post_bottom.rsplit('\n'): for line in post_bottom.rsplit('\n'):
# Open list # Open list
if line.startswith(tyto.words_tags[13][0]): if line.startswith(tyto.words_tags[13][0]):
block_list = content_list = ''
css = tyto.get_css(line) css = tyto.get_css(line)
in_list = True in_list = True
content_list = line block_list = line
continue continue
# Close list # Close list
elif line.startswith(tyto.words_tags[13][1]): elif line.startswith(tyto.words_tags[13][1]):
in_list = False in_list = False
content_list = '%s\n%s'%(content_list, line) block_list = '%s\n%s'%(block_list, line)
html_list = convert_list( html_list = convert_list(
content_list content_list
).replace('<ul>', ).replace('<ul>',
@ -825,10 +800,14 @@ def wip_lists():
).replace('<li>', ).replace('<li>',
'<li class="%s">'%css '<li class="%s">'%css
) )
replace_in_post(content_list, html_list)
replace_in_post(block_list, html_list)
if in_list: if in_list:
content_list = '%s\n%s'%(content_list, line) block_list = '%s\n%s'%(block_list, line)
if not content_list: content_list = line
else: content_list = '%s\n%s'%(content_list, line)
else: else:
continue continue

View File

@ -42,12 +42,31 @@ file_e = "File exists"
dir_c = "Directory created" dir_c = "Directory created"
dir_e = "Directory exists" dir_e = "Directory exists"
was_chk = "Article 'check'" # chk
was_wip = "Article already 'wip'" nycheck = "Article not yet checked"
check_m = "Check manually" was_chk = "Article was 'check'"
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"
# 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
check_m = "Check manually"
post_chg = "Article changed: 'check' it first" 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"
@ -58,8 +77,6 @@ symb_np = "Not paired symbols"
snpic_d = "Using default snpic. Not found" snpic_d = "Using default snpic. Not found"
anch_nu = "Anchor not uniq" anch_nu = "Anchor not uniq"
nyfile = "file not yet created" nyfile = "file not yet created"
nycheck = "Article not yet checked"
nywip = "Article not yet wip"
add = "Add:" add = "Add:"
nomods = "Create HTML modules first" nomods = "Create HTML modules first"
status_r = "Checking unused ressources..." status_r = "Checking unused ressources..."

View File

@ -41,12 +41,31 @@ file_e = "Fichier présent"
dir_c = "Dossier créé" dir_c = "Dossier créé"
dir_e = "Dossier présent" dir_e = "Dossier présent"
# chk
nycheck = "Article pas encore 'check'"
was_chk = "Article déjà vérifié" was_chk = "Article déjà vérifié"
was_wip = "Article déjà 'wip'" st_chk_o = "Statut 'check' Ancien"
check_m = "Vérifier manuellement"
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"
# 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
check_m = "Vérifier manuellement"
post_chg = "Article modifié : commencer par 'check'" 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"
@ -57,8 +76,8 @@ symb_np = "Symboles non jumelés"
snpic_d = "snpic utilisé par défaut. Manquant" snpic_d = "snpic utilisé par défaut. Manquant"
anch_nu = "Ancre non unique" anch_nu = "Ancre non unique"
nyfile = "Fichier pas encore créé" nyfile = "Fichier pas encore créé"
nycheck = "Article pas encore 'check'"
nywip = "Article pas encore 'wip'"
add = "Ajout:" add = "Ajout:"
nomods = "Créer d'abord les modules HTML" nomods = "Créer d'abord les modules HTML"
status_r = "Vérification des ressources manquantes..." status_r = "Vérification des ressources manquantes..."

View File

@ -30,6 +30,8 @@ File = 'File'
name = 'Name' name = 'Name'
by = "by" by = "by"
le = "the" le = "the"
fo = "for"
proceed = "Continue"
q = '?' q = '?'
i = '!' i = '!'
pp = ":" pp = ":"
@ -66,14 +68,26 @@ mail_to = "Contact by %s the admin of"%mail.lower()
feed = "Feed" feed = "Feed"
generator = "Generator" generator = "Generator"
# Misc for Tyto
#--------------
# Check # Check
check_a = "Check again this article"
post_chg = "Article was edited. Check it" post_chg = "Article was edited. Check it"
# Wip # Wip
wip_new = "Create a new HTML page in 'wip' server again" wip_new = "Create a new HTML page in 'wip' server again"
wip_again = "Create already converted pages again" srv_again = "Create again converted HTMl pages in server"
wip_newer = "Create missing HTML pages" srv_added = "Create missing HTML pages in server"
wip_older = "Update HTMl pages" srv_updated = "Update HTMl pages in server"
# publish
publish_a = "Publish again this article"
rss_c = "Create ATOM/RSS feed"
# Other
uptpl = "Update directory"
stats_f = "Articles: %s (%s words)"
reg_domains = 'Registred domains'
# Form # Form
#---------------------------------------------------------------------- #----------------------------------------------------------------------
@ -131,14 +145,10 @@ form_file_c = "File created"
form_reset = "Reset configuration?" form_reset = "Reset configuration?"
form_rep = "Replace HTML file" form_rep = "Replace HTML file"
check_a = "Check again this article"
uptpl = "Update directory"
stats_f = "Articles: %s (%s words)"
# Documentation of configuration files # Documentation of configuration files
#------------------------------------- #-------------------------------------
metas_inf = "Create <meta> tags"
metas_doc = \ metas_doc = \
'# For %s\n' + \ '# For %s\n' + \
'# Type text/HTML file\n' + \ '# Type text/HTML file\n' + \
@ -152,6 +162,7 @@ metas_doc = \
'# - Do NOT copy this file to template directory\n' + \ '# - Do NOT copy this file to template directory\n' + \
'# - These tags are already set' '# - These tags are already set'
navbar_inf = "Create navbar"
navbar_doc = \ navbar_doc = \
'# For %s\n' + \ '# For %s\n' + \
'# Type: Text file\n' + \ '# Type: Text file\n' + \
@ -179,6 +190,7 @@ navbar_doc = \
'# about # infos about this website\n' + \ '# about # infos about this website\n' + \
'# %s\n\n'%(20 * "-") '# %s\n\n'%(20 * "-")
sidebar_inf = "Create sidebar"
sidebar_doc = \ sidebar_doc = \
'# For %s\n' + \ '# For %s\n' + \
'# Type Text file\n' + \ '# Type Text file\n' + \
@ -204,6 +216,7 @@ sidebar_doc = \
'# dir1/index.tyto\n' + \ '# dir1/index.tyto\n' + \
'# %s\n\n'%(20 * "-") '# %s\n\n'%(20 * "-")
footer_inf = "Create footer"
footer_doc = \ footer_doc = \
'# For %s\n' + \ '# For %s\n' + \
'# Type text/HTML file\n' + \ '# Type text/HTML file\n' + \
@ -235,54 +248,87 @@ footer_about_doc = \
'# %s\n'%(20 * "-") '# %s\n'%(20 * "-")
# Help with Tyto commands # Help with Tyto commands
args_helps = """\n# New domain: args_helps = """\n# New domain :
- Create your domain folder, and go in - Create directory and go in
- Create domain with 'tyto new domain [URL]' - Create domain with 'tyto new domain [URL]'
- Create article file in articles/ directory - Create .tyto file in directory "articles/"
- Use these actions on article file: Check > wip > publish - Use these actions: check > wip > publish
! Config files are in _configs/ directory ! - Modules files are in directory "_configs/"
and used to create HTML file in your template and used to custom some website parts
Your template files (css, logo...) go to wip/template/ server - (css, logo...) files go in "wip/template/"
# Usage: tyto [action] [target] # Usage: tyto [action] [target]
- [action] > according to [target]: # Actions
edit : Edit a file (article, config module) - [action] > According to [target]
edit-about: specific for (footer), or like [edit-db]
edit-db : Edit a config file (domain, article (TAKE CARE !)) # Edit a file
edit-wip : Edit html file in wip server edit : Source file, configuration module
edit_www : Edit html file in www server edit-about: [footer] Edit description section in footer
new : Create new (domain, sidebar/footer... config's file) or same as [edit-db]
show : Show content file (article, config's module) edit-db : Edit database/configuration file
show-about: specific for (footer), or like [show-db] edit-wip : Edit a file in server 'wip'
show-db : Show content of article database edit_www : Edit a file in server 'www'
show-wip : Show content of HTML file in wip server new : [domain] Créer un domaine ou le modifier via le formulaire
show-www : Show content of HTML file in www server\n [sidebar, navbar, footer, metas] Create and replace
check : Check if article is valid and ready to convert with default module configuration file
wip : Create HTML page in wip server
publish : Create HTML page in www server\n # Show contents file (with line number)
- [target] > according to [action] show : Show source file, source configuration module
all : update changed articles show-about: [footer] Show description footer file
again : process again ALL valid articles or same as [show-db]
newer : [wip/publish] convert only newer articles show-db : Show database/configuration file
[check] process not yet checked .tyto files in domain show-wip : Show a file in server 'wip'
template : - Create new navbar/sidebar/metas/footer in www server show-www : Show a file in server 'www'
- Copy other wip/template/ files to www server
domain : Create/Show domain config's file # Create HTML page
[file] : URI of an article file (autocompletion's friend) check : Check the validity of a tyto format file
footer : Create/Show footer HTML config file wip : Create article HTML page in server 'wip'
metas : Create/Show metas HTML config file publish : Create article HTML page in server 'www'
navbar : Create/Show navbar config file
sidebar : Create/Show sidebar config file # Targets
stats : Create statistics file in root server\n - [target] > According to [action]
# Examples:
- Check article syntax: tyto check mysubdir/index.tyto # Multiple articles
- Create default _configs/tyto.sidebar: tyto new sidebar updated : Update articles (already checked)
- Edit _configs/tyto.navbar: tyto edit navbar again : Force all articles (already checked)
(each edition launches process if file changed like: added : [check] Search and check for .tyto articles in domain
- check (not yet checked)
- (navbar, sidebar, metas, footer) : create file on wip server) [wip, publish] Create articles HTML pages
- Edit index.html in www server: tyto edit-www index.tyto that were edited and checked
- Create sidebar.html in wip server: tyto wip sidebar
- Show footer.html in wip server: tyto show-wip footer # Update modules/files template
- Create metas.html in www server: tyto publish metas template : - Create (replace) modules in directory "template/"
- Show navbar.html in www server: tyto show-www navbar""" - [publish] Also, copy all other files from "wip/template/"
# Domain and files
domain : Create or edit a domain
[file] : URI file (autocompletion friendly)
# Modules
footer : Footer configuration file
metas : <meta>, <link> configuration file
navbar : Navbar configuration file
sidebar : Sidebar configuration file
stats : Stats file (server 'wip' er 'www')
# Examples :
# Check article (according to sub-folder)
$ tyto check mysubdir/index.tyto
# Create (replace) default sidebar configuration file
$ tyto new sidebar
# Edit navbar configuration file
$ tyto edit navbar
# edit doc/index.html in server 'www'
$ tyto edit-www doc/index.tyto
# Create HTML sidebar file in server 'wip'
$ tyto wip sidebar
# Show footer HTML file in server 'wip'
$ tyto show-wip footer
# Create statistics file in serveur 'www'
$ tyto publish stats"""

View File

@ -21,7 +21,7 @@
# Generic # Generic
article = "Article" article = "Article"
sidebar = 'Barre Latérale' sidebar = 'Barre Latérale'
navbar = 'Barre de navigation' navbar = 'Barre de menu'
metas = 'Balises Metas' metas = 'Balises Metas'
footer = 'Pied de Page' footer = 'Pied de Page'
title = 'Titre' title = 'Titre'
@ -29,6 +29,8 @@ File = 'Fichier'
name = 'Nom' name = 'Nom'
by = "par" by = "par"
le = "le" le = "le"
fo = "pour"
proceed = "Continuer"
q = ' ?' q = ' ?'
i = ' !' i = ' !'
pp = " :" pp = " :"
@ -65,14 +67,27 @@ mail_to = "Contacter par %s l'administrateur de"%mail.lower()
feed = "Flux" feed = "Flux"
generator = "Generateur" generator = "Generateur"
# Misc for Tyto
#--------------
# Check # Check
check_a = "Vérifier encore l'article"
post_chg = "Article édité. Le vérifier" post_chg = "Article édité. Le vérifier"
# 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'"
wip_again = "Créer encore les pages déjà converties" srv_again = "Créer encore les pages dans le serveur"
wip_newer = "Créer les pages HTML manquantes" srv_added = "Créer les pages HTML manquantes dans le serveur"
wip_older = "Mise à jour des pages HTML" srv_updated = "Mise à jour des pages HTML dans le serveur"
# publish
publish_a = "Publier encore l'article"
rss_c = "Créer le flux ATOM/RSS"
# Autre
uptpl = "Mettre à jour le dossier"
stats_f = "Articles : %s (%s mots)"
reg_domains = 'Domaines enregistrés'
# Formulaire # Formulaire
#---------------------------------------------------------------------- #----------------------------------------------------------------------
@ -131,14 +146,10 @@ form_file_c = "Fichier créé"
form_reset = "Réinitialiser la configuration" form_reset = "Réinitialiser la configuration"
form_rep = "Remplacer le fichier HTML" form_rep = "Remplacer le fichier HTML"
check_a = "Vérifier encore l'article"
uptpl = "Mettre à jour le dossier"
stats_f = "Articles : %s (%s mots)"
# Documentation des fichiers de configuration # Documentation des fichiers de configuration
#-------------------------------------------- #--------------------------------------------
metas_inf = "Créer les balises <meta>"
metas_doc = \ metas_doc = \
'# Pour %s\n' + \ '# Pour %s\n' + \
'# Type Fichier text/HTML\n' + \ '# Type Fichier text/HTML\n' + \
@ -152,6 +163,7 @@ metas_doc = \
'# - Ne PAS copier ce fichier dans le dossier template\n' + \ '# - Ne PAS copier ce fichier dans le dossier template\n' + \
'# - Les balises suivantes sont déjà présentes' '# - Les balises suivantes sont déjà présentes'
navbar_inf = "Créer la barre de menu"
navbar_doc = \ navbar_doc = \
'# Pour %s\n' + \ '# Pour %s\n' + \
'# Type fichier texte\n' + \ '# Type fichier texte\n' + \
@ -179,6 +191,7 @@ navbar_doc = \
'# a-propos # Informations concernant ce site\n' + \ '# a-propos # Informations concernant ce site\n' + \
'# %s\n\n'%(20 * "-") '# %s\n\n'%(20 * "-")
sidebar_inf = "Créer la barre latérale"
sidebar_doc = \ sidebar_doc = \
'# Pour %s\n' + \ '# Pour %s\n' + \
'# Type fichier texte\n' + \ '# Type fichier texte\n' + \
@ -204,6 +217,7 @@ sidebar_doc = \
'# dir1/index.tyto\n' + \ '# dir1/index.tyto\n' + \
'# %s\n\n'%(20 * "-") '# %s\n\n'%(20 * "-")
footer_inf = "Créer le pied de page"
footer_doc = \ footer_doc = \
'# Pour %s\n' + \ '# Pour %s\n' + \
'# Type Fichier text/HTML\n' + \ '# Type Fichier text/HTML\n' + \
@ -238,18 +252,18 @@ footer_about_doc = \
args_helps = """\n# Nouveau domaine : args_helps = """\n# Nouveau domaine :
- Créer un dossier et aller dedans - Créer un dossier et aller dedans
- Créer un domain avec 'tyto new domain [URL]' - Créer un domain avec 'tyto new domain [URL]'
- Créer un fichier .tyto dans le dossier articles/ - Créer un fichier .tyto dans le dossier "articles/"
- Utiliser les actions check > wip > publish - Utiliser les actions check > wip > publish
! - Les fichiers des modules sont dans le dossier _configs/ ! - Les fichiers des modules sont dans le dossier "_configs/"
et utilisés pour personnaliser certaines parties du site et utilisés pour personnaliser certaines parties du site
- Les fichier (css, logo...) vont dans le dossier serveur wip/template/ - Les fichier (css, logo...) vont dans le dossier serveur "wip/template/"
# Usage: tyto [action] [target] # Usage: tyto [action] [target]
# Les actions # Les actions
- [action] > Selon l'argument [target] - [action] > Selon l'argument [target]
# Modifier un ficher # Modifier un ficher
edit : fichier source, module de configuration edit : Fichier source, module de configuration
edit-about: [footer] Modifier la section description du pied de page edit-about: [footer] Modifier la section description du pied de page
sinon comme l'action [edit-db] sinon comme l'action [edit-db]
edit-db : Modifier une base de données/fichier de configuration edit-db : Modifier une base de données/fichier de configuration
@ -260,7 +274,7 @@ args_helps = """\n# Nouveau domaine :
fichier de configuration du module par le défaut fichier de configuration du module par le défaut
# Afficher un fichier (avec numéros de ligne) # Afficher un fichier (avec numéros de ligne)
show : fichier source, module de configuration show : Fichier source, module de configuration
show-about: [footer] Afficher la section description du pied de page show-about: [footer] Afficher la section description du pied de page
sinon comme l'action [show-db] sinon comme l'action [show-db]
show-db : Afficher une base de données/fichier de configuration show-db : Afficher une base de données/fichier de configuration
@ -284,7 +298,7 @@ args_helps = """\n# Nouveau domaine :
qui ont été modifiés et vérifiés qui ont été modifiés et vérifiés
# Mise en ligne du thème et des modules # Mise en ligne du thème et des modules
template : - Recréer les modules HTML dans le serveur 'www' template : - Recréer les modules HTML dans "template/"
- Copie tous les autres fichier du dossier wip/template/ - Copie tous les autres fichier du dossier wip/template/
# Domaine et fichier # Domaine et fichier
@ -311,7 +325,7 @@ args_helps = """\n# Nouveau domaine :
# Modifier doc/index.html dans le serveur 'www' # Modifier doc/index.html dans le serveur 'www'
$ tyto edit-www doc/index.tyto $ tyto edit-www doc/index.tyto
# Créer le module HTML (serveur 'wip') de la barre latérale # Créer le fichier HTML de la barre latérale (serveur 'wip')
$ tyto wip sidebar $ tyto wip sidebar
# Afficher le contenu du pied de page HTML dans le serveur 'wip' # Afficher le contenu du pied de page HTML dans le serveur 'wip'