This commit is contained in:
Cyrille L 2023-05-07 09:14:15 +02:00
parent 7d44eb781e
commit 22ce2f0aed
25 changed files with 1169 additions and 953 deletions

View File

@ -24,28 +24,26 @@
# File: /usr/bin/tyto # File: /usr/bin/tyto
#---------------------------------------------------------------------- #----------------------------------------------------------------------
#------------ #-------------------------
# funny stats # Funny Stats Project
#------------ #-------------------------
# scripts files: # Project files : 20
# app lines: # Project lines : 7479
# app comments: # Project comments : 1131
# app functions: # Project functions: 108
# lines: #
# functions: # file lines : 91
# comments: # file comments : 31
#---------------------------------------------------------------------- # file functions: 0
#--------------------------
#**********************************************************************
import sys import sys
sys.path.insert(0, '/var/lib/tyto/program') sys.path.insert(0, '/var/lib/tyto/program')
#====================# #====================#
# MAIN # # MAIN #
# Treat Arguments # # Treat Arguments #
#--------------------#------------------------------------------------- #--------------------#
import logs import logs
if not __name__ == "__main__": if not __name__ == "__main__":
@ -65,15 +63,16 @@ status.domain()
import check, form, html, new, publish, show, wip, infos, creators import check, form, html, new, publish, show, wip, infos, creators
actions = { actions = {
"check" : check.manage, "check" : check.manage,
"create" : creators.manage,
"help" : infos.tyto, "help" : infos.tyto,
"edit" : show.manage, "edit" : show.manage,
"edit-about" : show.manage, "edit-about" : show.manage,
"edit-db" : show.manage, "edit-db" : show.manage,
"edit-wip" : show.manage, "edit-wip" : show.manage,
"edit-www" : show.manage, "edit-www" : show.manage,
"force-wip" : wip.manage,
"new" : new.manage, "new" : new.manage,
"publish" : publish.manage, "publish" : publish.manage,
"preview" : show.manage,
"quick-pub" : publish.manage, "quick-pub" : publish.manage,
"show" : show.manage, "show" : show.manage,
"show-about" : show.manage, "show-about" : show.manage,
@ -81,7 +80,6 @@ actions = {
"show-wip" : show.manage, "show-wip" : show.manage,
"show-www" : show.manage, "show-www" : show.manage,
"status" : status.check, "status" : status.check,
"template" : publish.manage,
"wip" : wip.manage, "wip" : wip.manage,
} }

View File

@ -23,10 +23,18 @@
# File: /usr/share/bash-completion/completions/tyto # File: /usr/share/bash-completion/completions/tyto
#---------------------------------------------------------------------- #----------------------------------------------------------------------
#-------------------------
# Funny Stats Project
#-------------------------
# file lines : 310
# file comments : 44
# file functions: 0
#--------------------------
#=====================================================================#
# Actions section # #=================#
#=====================================================================# # Actions section #
#=================#============================================================
# Actions: argument 1 # # Actions: argument 1 #
#---------------------# #---------------------#
@ -39,6 +47,7 @@ edit-about
edit-db edit-db
edit-wip edit-wip
edit-www edit-www
force-wip
help help
new new
show show
@ -46,6 +55,7 @@ show-about
show-db show-db
show-wip show-wip
show-www show-www
preview
publish publish
quick-pub quick-pub
status status
@ -96,12 +106,12 @@ EOL
} }
#=====================================================================# #=================#
# Targets section # # Targets section #
#=====================================================================# #=================#============================================================
# Targets with wip or publish # Targets for articles and modules
#---------------------------- #--------------------------------
_tyto_targets_wp() { _tyto_targets_wp() {
cat <<EOL cat <<EOL
added added
@ -182,11 +192,12 @@ footer
metas metas
navbar navbar
sidebar sidebar
sitemap
EOL EOL
} }
# # Targets to NOT activate --force
# #--------------------------------
_tyto_targets_not_options() { _tyto_targets_not_options() {
grep -F -q -x "$1" <<EOL grep -F -q -x "$1" <<EOL
added added
@ -203,19 +214,25 @@ EOL
} }
#=====================================================================# #=================#
# Targets section # # Options section #
#=====================================================================# #=================#============================================================
_tyto_options() { _tyto_options() {
cat <<EOL cat <<EOL
--force
--static --static
EOL EOL
} }
#=====================================================================# # Only with [publish template]
# Main autocompletion # _tyto_options_pt() {
#=====================================================================# cat <<EOL
--no-mods
EOL
}
#=====================#
# Main autocompletion #
#=====================#========================================================
_tyto_completions() { _tyto_completions() {
local cur local cur
cur="${COMP_WORDS[COMP_CWORD]}" cur="${COMP_WORDS[COMP_CWORD]}"
@ -236,8 +253,13 @@ _tyto_completions() {
if [ "$prev" == "new" ];then if [ "$prev" == "new" ];then
COMPREPLY=( $(compgen -W "$(_tyto_targets_new)" -- ${cur}) ) COMPREPLY=( $(compgen -W "$(_tyto_targets_new)" -- ${cur}) )
return 0 return 0
elif [ "$prev" == "quick-pub" ];then elif [ "$prev" == "quick-pub" ] ||
[ "$prev" == "preview" ];then
COMPREPLY=( $(compgen -W "$(_tyto_targets_qp)" -- ${cur}) )
return 0
elif [ "$prev" == "force-wip" ];then
COMPREPLY=( $(compgen -W "$(_tyto_targets_qp)" -- ${cur}) ) COMPREPLY=( $(compgen -W "$(_tyto_targets_qp)" -- ${cur}) )
return 0 return 0
@ -273,6 +295,12 @@ _tyto_completions() {
COMPREPLY=( $(compgen -W "$(_tyto_options)" -- ${cur}) ) COMPREPLY=( $(compgen -W "$(_tyto_options)" -- ${cur}) )
return 0 return 0
fi fi
# Only with [publish template]
elif [ "$prev2" == "publish" ] && \
[ "$prev1" == "template" ];then
COMPREPLY=( $(compgen -W "$(_tyto_options_pt)" -- ${cur}) )
return 0
fi fi
;; ;;

View File

@ -7,12 +7,8 @@ Tyto - Littérateur
- License: https://git.a-lec.org/echolib/tyto-litterateur/-/blob/master/LICENSE - License: https://git.a-lec.org/echolib/tyto-litterateur/-/blob/master/LICENSE
- Documentation: https://tyto.echolib.re - Documentation: https://tyto.echolib.re
## {0.10.5] ## [0.10.5]
- added sitemap with `tyto create sitemap` - New sitemap
- added escaped markers - Very Last testings
- added bash-autocompletion (not yet all)
- updated help
- changed function to protect icodes
- very lots more
- pre 1.0

View File

@ -3,6 +3,16 @@
* DOMAIN MUST be changed by domain css set in configuration * DOMAIN MUST be changed by domain css set in configuration
*/ */
/* include header to footer */
div#site_container {
}
/* Include article + sidebar */
div#article_sidebar_container {
}
/*===================================================================== /*=====================================================================
* Header * Header
*/ */

View File

@ -19,7 +19,6 @@ navbar_f = ""
sidebar_f = "" sidebar_f = ""
metas_f = "" metas_f = ""
footer_f = "" footer_f = ""
footer_about_f = ""
# Domain # Domain
shortname = "" shortname = ""

View File

@ -23,135 +23,147 @@
# File: /var/lib/tyto/program/args.py # File: /var/lib/tyto/program/args.py
#---------------------------------------------------------------------- #----------------------------------------------------------------------
#------------ #-------------------------
# funny stats # Funny Stats Project
#------------ #-------------------------
# lines: # file lines : 173
# functions: # file comments : 28
# comments: # file functions: 2
#---------------------------------------------------------------------- #--------------------------
#**********************************************************************
import os, sys import os, sys
import infos import infos
# Arguments from command line
# tyto [action] [target]
#----------------------------
actions = \
(
'check',
'create',
'edit',
'edit-db',
'edit-wip',
'edit-www',
'quick-pub',
'new',
'show',
'show-db',
'show-wip',
'show-www',
'status',
'wip',
'publish'
)
options = \
(
'--static',
'--force',
)
pass_actions = ('new')
# Actions that needs to check for article's database
pass_db = \
(
'check',
'edit',
'edit-db',
'edit-wip',
'edit-www',
'publish',
'quick-pub',
'show',
'show-about',
'show-db',
'show-wip',
'show-www',
'status',
'wip',
)
pass_targets = \
(
'added',
'again',
'updated',
'domain',
'footer',
'metas',
'navbar',
'sidebar',
'sitemap',
'stats',
'template'
)
pass_status = \
(
'domain',
)
multi_chk = \
(
'added',
'again',
'updated'
)
helps = \
(
'domains',
'version',
'help'
)
# action
#-------
try: action = sys.argv[1]
except: action = ''
act_err = False
# With no argument, show help
if not action:
infos.tyto('full')
sys.exit(0)
elif action in helps:
infos.tyto(action)
# Unused argument [action]
elif not action in actions:
act_err = True
# target
#-------
try: try:
target = sys.argv[2] action
except: target
infos.tyto('full')
sys.exit(0)
# options except:
try: option = sys.argv[3]
except: option = '' # Arguments from command line
# tyto [action] [target]
#----------------------------
actions = \
(
'check',
'edit',
'edit-db',
'edit-wip',
'edit-www',
'force-wip',
'new',
'preview',
'publish',
'quick-pub',
'show',
'show-db',
'show-wip',
'show-www',
'status',
'wip',
)
quicks = \
(
'force-wip',
'quick-pub',
)
options = \
(
'--static',
)
pass_actions = ('new')
# Actions that needs to check for article's database
pass_db = \
(
'check',
'edit',
'edit-db',
'edit-wip',
'edit-www',
'force-wip',
'publish',
'preview',
'quick-pub',
'show',
'show-about',
'show-db',
'show-wip',
'show-www',
'status',
'wip',
)
pass_targets = \
(
'added',
'again',
'updated',
'domain',
'footer',
'metas',
'navbar',
'sidebar',
'sitemap',
'stats',
'template'
)
pass_status = \
(
'domain',
)
multi_chk = \
(
'added',
'again',
'updated'
)
helps = \
(
'domains',
'version',
'help'
)
# action
#-------
try: action = sys.argv[1]
except: action = ''
act_err = False
# With no argument, show help
if not action:
infos.tyto('full')
sys.exit(0)
elif action in helps:
infos.tyto(action)
# Unused argument [action]
elif not action in actions:
act_err = True
# target
#-------
try:
target = sys.argv[2]
except:
infos.tyto('full')
sys.exit(0)
# options
try: option = sys.argv[3]
except: option = ''
# Set action and target for binary # Set action and target for binary
def set_action(): def set_action():

View File

@ -24,17 +24,14 @@
# File: /var/lib/tyto/program/check.py # File: /var/lib/tyto/program/check.py
#---------------------------------------------------------------------- #----------------------------------------------------------------------
#------------ #-------------------------
# funny stats # Funny Stats Project
#------------ #-------------------------
# lines: # file lines : 1141
# functions: # file comments : 162
# comments: # file functions: 25
#---------------------------------------------------------------------- #--------------------------
#**********************************************************************
# Import needed libs
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
@ -767,9 +764,9 @@ def check_anchors():
db.uri_file db.uri_file
), False) ), False)
post_err = True post_err = True
return
else: globals()['post_%s'%tyto.anchor_tags[4]] = int(c_opened)
globals()['post_%s'%tyto.anchor_tags[4]] = int(c_opened)
# Anchor target # Anchor target
@ -805,6 +802,8 @@ def check_anchors():
# Check if anchor link has target one # Check if anchor link has target one
else: else:
for ln, line in enumerate(post_bottom.rsplit('\n'), 1): for ln, line in enumerate(post_bottom.rsplit('\n'), 1):
ln = ln + ln_header + 1
# Anchor link # Anchor link
if tyto.anchor_tags[0] and tyto.anchor_tags[1] in line: if tyto.anchor_tags[0] and tyto.anchor_tags[1] in line:
anchors = re.findall(r">_(.*?)_<", line) anchors = re.findall(r">_(.*?)_<", line)
@ -812,7 +811,7 @@ def check_anchors():
anchor_name = anchor.rsplit(':')[0].lstrip() anchor_name = anchor.rsplit(':')[0].lstrip()
if not anchor_name in anchors_names: if not anchor_name in anchors_names:
logs.out("12", 'L=%s. anchor "%s" > %s'%( logs.out("12", 'L=%s. anchor "%s" > %s'%(
ln + 1 + ln_header, anchor_name, db.uri_file ln, anchor_name, db.uri_file
), False) ), False)
post_err = True post_err = True
@ -844,7 +843,7 @@ def check_titles():
def check_words_tags(): def check_words_tags():
global post_err, post_bottom global post_err, post_bottom
for tag in tyto.words_tags: for tag in tyto.markers_tags:
c_opened = c_closed = 0 c_opened = c_closed = 0
c_opened = post_bottom.count(tag[0]) c_opened = post_bottom.count(tag[0])
@ -896,7 +895,9 @@ def check_contents_list():
if post_lists > 0: if post_lists > 0:
inlist = False inlist = False
for ln, line in enumerate(post_bottom.rsplit('\n'), 1): for ln, line in enumerate(post_bottom.rsplit('\n'), 1):
if line.startswith(tyto.block_tags[3][0]): ln = ln + ln_header + 1
if line.startswith(tyto.block_tags[3][0]):
inlist = True inlist = True
continue continue
elif line.startswith(tyto.block_tags[3][1]): elif line.startswith(tyto.block_tags[3][1]):
@ -907,13 +908,14 @@ def check_contents_list():
if inlist and not line or not line[0] in tyto.markers_lists: if inlist and not line or not line[0] in tyto.markers_lists:
logs.out("3", 'L=%s. %s %s > %s'%( logs.out("3", 'L=%s. %s %s > %s'%(
ln + ln_header, ln,
tyto.block_tags[3][4], tyto.block_tags[3][4],
tyto.markers_lists, tyto.markers_lists,
db.uri_file db.uri_file
), False) ), False)
post_err = True post_err = True
#==================================# #==================================#
# Legacy HTML Tags, check if aired # # Legacy HTML Tags, check if aired #
#----------------------------------# #----------------------------------#

View File

@ -24,15 +24,14 @@
# File: /var/lib/tyto/program/creators.py # File: /var/lib/tyto/program/creators.py
#---------------------------------------------------------------------- #----------------------------------------------------------------------
#------------ #-------------------------
# funny stats # Funny Stats Project
#------------ #-------------------------
# lines: # file lines : 240
# functions: # file comments : 40
# comments: # file functions: 3
#---------------------------------------------------------------------- #--------------------------
#**********************************************************************
import os, importlib, datetime, subprocess import os, importlib, datetime, subprocess
import args, dom, db, langs, tyto, check, wip, logs import args, dom, db, langs, tyto, check, wip, logs
@ -42,16 +41,14 @@ import args, dom, db, langs, tyto, check, wip, logs
# Manage action [create] # # Manage action [create] #
#------------------------# #------------------------#
def manage(target): def manage(target):
target = args.target
creators = { creators = {
"sitemap" : create_sitemap, "sitemap" : create_sitemap,
} }
try: try: creators[target](target)
creators[target](target) except: logs.out("28", "%s + %s"%(args.action, args.target), True)
except:
logs.out("28", "%s + %s"%(args.action, args.target), True)
#=====================# #=====================#
@ -73,7 +70,7 @@ def create_sitemap(target):
# Define sitemap.tyto # Define sitemap.tyto
sitemap_tyto = \ sitemap_tyto = \
'# %s Tyto - Littérateur [tyto create sitemap]\n'%langs.site.sitemap_gen + \ '# %s Tyto - Littérateur [tyto new sitemap]\n'%langs.site.sitemap_gen + \
'# NoSitemap\n' + \ '# NoSitemap\n' + \
'title: %s (%s %s)\n'%(langs.site.sitemap_t, '%s', langs.site.links) + \ 'title: %s (%s %s)\n'%(langs.site.sitemap_t, '%s', langs.site.links) + \
'about: %s Tyto - Littérateur\n'%langs.site.sitemap_gen + \ 'about: %s Tyto - Littérateur\n'%langs.site.sitemap_gen + \
@ -85,14 +82,23 @@ def create_sitemap(target):
'-----\n' + \ '-----\n' + \
'\n' + \ '\n' + \
'%s\n' + \ '%s\n' + \
'-)' '|\n' + \
'<hr class="hr">\n' + \
print(sitemap_tyto) '|\n' + \
'\n' + \
'%s\n'
tab = 8 tab = 8
uri_dir_set = "" uri_dir_set = ""
# Contents in article's Header
links = "" links = ""
contents = "#1 /\n-( sitemap"
# Index of all links in article
index_l = '-( index\n= <a href="#index">/</a>'
# All links in sitemap
contents = '-( sitemap\n= / <z id="index"></a>'
# Not real articles folder # Not real articles folder
forbid_dir = ( forbid_dir = (
@ -107,79 +113,128 @@ def create_sitemap(target):
if r.startswith(forbid_dir): if r.startswith(forbid_dir):
continue continue
# Take only .tyto files
for f in files: for f in files:
if f.endswith(".tyto"): if not f.endswith(".tyto"):
continue
try:
uri_file = r.rsplit(dom.articles_d)[1]
uri_file = os.path.join(uri_file, f)
except:
uri_file = f
uri_dir = uri_file.rsplit(f)[0]
if not uri_dir:
uri_dir = "~/"
# Try to load Article Database
args.action = "check"
args.target = uri_file
importlib.reload(db)
if not db.exists:
continue
else:
try: try:
uri_file = r.rsplit(dom.articles_d)[1] db.hash_www
uri_file = os.path.join(uri_file,f) db.sitemap
except: if not db.sitemap:
uri_file = f
uri_dir = uri_file.rsplit(f)[0]
if not uri_dir:
uri_dir = "~/"
# Try to load Article Database
args.action = "check"
args.target = uri_file
importlib.reload(db)
if not db.exists:
continue
else:
try:
db.hash_www
db.sitemap
if not db.sitemap:
continue
except:
continue continue
except:
# Count continue
nbr_files += 1
# Count
# create defined link nbr_files += 1
if not links:
links = \ # create defined link
"link: %s\n%s%s\n%s%s\n"%( if not links:
db.title, tab * " ", db.short_srv, tab * " ", db.about links = \
) "link: %s\n%s%s\n%s%s\n"%(
else: db.title, tab * " ", db.short_srv, tab * " ", db.about
links = \
"%s\nlink: %s\n%s%s\n%s%s\n"%(
links,
db.title, tab * " ",
db.short_srv, tab * " ", db.about
)
# Create list link line
if not uri_dir.startswith(uri_dir_set):
root_dir = uri_dir.rsplit("/")[0]
contents = "%s\n-)\n\n#1 %s\n-( sitemap"%(contents, root_dir)
uri_dir_set = uri_dir.rsplit("/")[0]
uls = uri_dir.count("/")
contents = \
"%s\n%s [%s] _%s (%s)"%(
contents,
uls * "=", db.date, db.title, db.author
) )
else:
links = \
"%s\nlink: %s\n%s%s\n%s%s\n"%(
links,
db.title, tab * " ",
db.short_srv, tab * " ", db.about
)
# Create list link line
curr_dir = uri_dir.count("/")
root_dir = uri_dir.rsplit("/")[0]
ranc_dir = root_dir.replace(" ", "_")
try: prev_dir
except: prev_dir = curr_dir
try: name_dir
except: name_dir = root_dir
#print(":",prev_dir, name_dir, curr_dir, root_dir)
#print(": %s"%(uri_dir.rsplit("/")[int(curr_dir - 1)]))
#print(">", subdirs, uri_dir.rsplit("/"))
#print(":", prev_dir, curr_dir)
if name_dir != root_dir:
index_l = '%s\n= <a href="#%s">%s</a>'%(
index_l,
ranc_dir,
root_dir
)
contents = '%s\n%s [%s] <a id="%s"></a>'%(
contents,
int(curr_dir) * "=",
root_dir,
ranc_dir
)
name_dir = root_dir
prev_dir = curr_dir
if prev_dir != curr_dir:
sanc_dir = uri_dir.rsplit("/")[int(curr_dir - 1)].replace(" ", "_")
index_l = '%s\n%s <a href="#%s">%s</a>'%(
index_l,
int(curr_dir) * "=",
sanc_dir,
uri_dir.rsplit("/")[int(curr_dir - 1)]
)
contents = '%s\n%s [%s] <a id="%s"></a>'%(
contents,
int(curr_dir) * "=",
uri_dir.rsplit("/")[int(curr_dir - 1)],
sanc_dir
)
prev_dir = curr_dir
contents = "%s\n%s _%s"%(
contents,
int(curr_dir + 1) * '=',
db.title
)
# Ending markers
index_l = "%s\n-)"%index_l
contents = "%s\n-)"%contents
# Fill new sitemap.tyto and create
sitemap_tyto = \ sitemap_tyto = \
sitemap_tyto%( sitemap_tyto%(
nbr_files, nbr_files,
links, links,
index_l,
contents contents
) )
sitemap_file = "%ssitemap.tyto"%dom.articles_d sitemap_file = "%ssitemap.tyto"%dom.articles_d
tyto.set_file(sitemap_file, "New", sitemap_tyto) tyto.set_file(sitemap_file, "New", sitemap_tyto)
# Check and wip # Check and wip
print()
www = subprocess.run( www = subprocess.run(
[ [
'/usr/bin/tyto', '/usr/bin/tyto',
'wip', 'force-wip',
'sitemap.tyto', 'sitemap.tyto'
'--force'
], ],
) )

View File

@ -23,15 +23,14 @@
# File: /var/lib/tyto/program/db.py # File: /var/lib/tyto/program/db.py
#---------------------------------------------------------------------- #----------------------------------------------------------------------
#------------ #-------------------------
# funny stats # Funny Stats Project
#------------ #-------------------------
# lines: # file lines : 195
# functions: # file comments : 35
# comments: # file functions: 0
#---------------------------------------------------------------------- #--------------------------
#**********************************************************************
import os import os
import args, logs, dom, form, tyto, check, publish import args, logs, dom, form, tyto, check, publish
@ -79,63 +78,63 @@ if args.target \
# Check if database config is valid (contains values) # Check if database config is valid (contains values)
if exists: if exists:
values = \ values = \
( (
'post_id', 'post_id',
'post_src', 'post_src',
'post_wip', 'post_wip',
'static_wip', 'static_wip',
'post_www', 'post_www',
'static_www', 'static_www',
'direc_src', 'direc_src',
'short_src', 'short_src',
'short_srv', 'short_srv',
'sub_uri', 'sub_uri',
'http_wip', 'http_wip',
'http_www', 'http_www',
'date_chk', 'date_chk',
'hash_chk', 'hash_chk',
'date_wip', 'date_wip',
'hash_wip', 'hash_wip',
'date_www', 'date_www',
'hash_www', 'hash_www',
'title', 'title',
'about', 'about',
'author', 'author',
'meta_tags', 'meta_tags',
'date', 'date',
'snpic', 'snpic',
'sitemap', 'sitemap',
'uris', 'uris',
'uniq_anchors', 'uniq_anchors',
'uniq_abbrs', 'uniq_abbrs',
'uniq_links', 'uniq_links',
'uniq_images', 'uniq_images',
'uniq_files', 'uniq_files',
'uniq_raws', 'uniq_raws',
'comments', 'comments',
'tags', 'tags',
'words', 'words',
'titles', 'titles',
'paragraphs', 'paragraphs',
'links', 'links',
'images', 'images',
'anchors', 'anchors',
'abbrs', 'abbrs',
'strongs', 'strongs',
'bolds', 'bolds',
'emphasis', 'emphasis',
'italics', 'italics',
'dels', 'dels',
'underlines', 'underlines',
'cites', 'cites',
'customs', 'customs',
'icodes', 'icodes',
'bcodes', 'bcodes',
'quotes', 'quotes',
'lists', 'lists',
'files', 'files',
'raws', 'raws',
'codes', 'codes',
) )
# Set exist for wip and www files # Set exist for wip and www files

View File

@ -23,285 +23,290 @@
# File: /var/lib/tyto/program/dom.py # File: /var/lib/tyto/program/dom.py
#---------------------------------------------------------------------- #----------------------------------------------------------------------
#------------ #-------------------------
# funny stats # Funny Stats Project
#------------ #-------------------------
# lines: # file lines : 317
# functions: # file comments : 30
# comments: # file functions: 1
#---------------------------------------------------------------------- #--------------------------
#**********************************************************************
import os, sys, importlib, langs import os, sys, importlib, langs
import args import args
lib = 'tyto_domain'
exists = incomplete = active = ready = shortname = corrupt = False
local_user = articles_db_d = False
hole = False
# Set current directory
try: try:
user_dir ready
except: except:
try:
user_dir = os.getcwd() + "/"
except:
hole = True
# Set current user name lib = 'tyto_domain'
try: exists = incomplete = active = ready = shortname = corrupt = False
user local_user = articles_db_d = False
except: hole = False
try:
user = os.environ.get('USER')
except:
user = ''
# Settings for domain, check if db is not corrupted
dom_values = \
(
'directory',
'database',
'local_user',
'lang_sys',
'lang_logs',
'articles_db_d',
'articles_d',
'files_d',
'images_d',
'modules_d',
'navbar_f',
'sidebar_f',
'metas_f',
'footer_f',
'shortname',
'www_url',
'wip_url',
'srv_root',
'srv_domain',
'srv_wip',
'srv_wip_tpl_d',
'srv_wip_images_d',
'srv_wip_files_d',
'srv_www',
'srv_www_tpl_d',
'srv_www_images_d',
'srv_www_files_d',
'wip_favicon_f',
'wip_css_f',
'wip_logo_f',
'wip_navbar_f',
'wip_sidebar_f',
'wip_metas_f',
'wip_footer_f',
'wip_stats_f',
'www_navbar_f',
'www_sidebar_f',
'www_metas_f',
'www_footer_f',
'www_stats_f',
'www_logo_f',
'www_css_f',
'www_rss_f',
'www_favicon_f',
'favicon',
'logo',
'styles',
'rss',
'rss_items',
'title',
'date',
'about',
'lang_site',
'mail',
'tags',
'license',
'license_url',
'legal_url',
'terms_url',
'css',
'sep',
'article_code',
'relme',
'sidebar_title',
'sidebar_items',
'activated'
)
create_files = \
(
'navbar_f',
'sidebar_f',
'metas_f',
'footer_f',
)
wip_html_mods = ()
err_val = (()) # Make a list from values error
if not hole:
home_dir = os.path.expanduser('~')
# Set configuration domain directory # Set current directory
root_dir = user_dir try:
if '/articles' in user_dir: user_dir
root_dir = user_dir.rsplit('/articles')[0] + "/" except:
# Set configuration domain file
config = '%styto_domain.py'%root_dir
shortname = config
# Set exists if configuration file
if os.path.exists(config):
exists = True
try: try:
exec(open(config).read()) user_dir = os.getcwd() + "/"
try:
os.path.exists(articles_d)
if '/articles' in user_dir:
user_uri_dir = user_dir.rsplit(articles_d)[1]
else:
user_uri_dir = ''
os.chdir(articles_d)
except: corrupt = True
except: except:
corrupt = True hole = True
if not args.target in args.pass_targets: # Set current user name
if args.target.startswith("articles/"): try:
args.target = args.target.rsplit("articles/")[1] user
args.target = user_uri_dir + args.target except:
try:
user = os.environ.get('USER')
except:
user = ''
# Settings for domain, check if db is not corrupted
dom_values = \
(
'directory',
'database',
'local_user',
'lang_sys',
'lang_logs',
'articles_db_d',
'articles_d',
'files_d',
'images_d',
'modules_d',
'navbar_f',
'sidebar_f',
'metas_f',
'footer_f',
'shortname',
'www_url',
'wip_url',
'srv_root',
'srv_domain',
'srv_wip',
'srv_wip_tpl_d',
'srv_wip_images_d',
'srv_wip_files_d',
'srv_www',
'srv_www_tpl_d',
'srv_www_images_d',
'srv_www_files_d',
'wip_favicon_f',
'wip_css_f',
'wip_logo_f',
'wip_navbar_f',
'wip_sidebar_f',
'wip_metas_f',
'wip_footer_f',
'wip_stats_f',
'www_navbar_f',
'www_sidebar_f',
'www_metas_f',
'www_footer_f',
'www_stats_f',
'www_logo_f',
'www_css_f',
'www_rss_f',
'www_favicon_f',
'favicon',
'logo',
'styles',
'rss',
'rss_items',
'title',
'date',
'about',
'lang_site',
'mail',
'tags',
'license',
'license_url',
'legal_url',
'terms_url',
'css',
'sep',
'article_code',
'relme',
'sidebar_title',
'sidebar_items',
'activated'
)
create_files = \
(
'navbar_f',
'sidebar_f',
'metas_f',
'footer_f',
)
wip_html_mods = ()
err_val = (()) # Make a list from values error
if not hole:
home_dir = os.path.expanduser('~')
# For logs: show uri if not shortname known # Set configuration domain directory
try: shortname root_dir = user_dir
except: pass if '/articles' in user_dir:
root_dir = user_dir.rsplit('/articles')[0] + "/"
# Set configuration domain file
config = '%styto_domain.py'%root_dir
shortname = config
try: active = activated # Set exists if configuration file
except: pass if os.path.exists(config):
exists = True
# Check set values configuration try:
if not corrupt: exec(open(config).read())
for value in dom_values:
try: try:
eval(str(value)) os.path.exists(articles_d)
value_set = True if '/articles' in user_dir:
except: user_uri_dir = user_dir.rsplit(articles_d)[1]
err_val = err_val + ((value),) else:
value_set = False user_uri_dir = ''
incomplete = True os.chdir(articles_d)
active = False except: corrupt = True
except:
corrupt = True
#==============================================#
# When an active and complete domain is needed #
#----------------------------------------------#
if exists and not incomplete and not corrupt:
if active:
ready = True
wip_html_mods = \
(
eval(str('wip_navbar_f')),
eval(str('wip_sidebar_f')),
eval(str('wip_metas_f')),
eval(str('wip_footer_f'))
)
www_html_mods = \
(
eval(str('www_navbar_f')),
eval(str('www_sidebar_f')),
eval(str('www_metas_f')),
eval(str('www_footer_f'))
)
metas = \
(
eval(str('metas_f')),
eval(str('wip_metas_f')),
eval(str('www_metas_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')),
)
templates = \
(
eval(str('wip_logo_f')),
eval(str('wip_favicon_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')),
eval(str('www_favicon_f')),
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')),
)
statistics = \
(
eval(str('wip_stats_f')),
eval(str('www_stats_f')),
)
modules = \ if not args.target in args.pass_targets:
{ if args.target.startswith("articles/"):
"metas" : metas, args.target = args.target.rsplit("articles/")[1]
"navbar" : navbars, args.target = user_uri_dir + args.target
"sidebar" : sidebars,
"footer" : footers, # For logs: show uri if not shortname known
"template": templates, try: shortname
"stats" : statistics, except: pass
}
try: active = activated
except: pass
# Check set values configuration
if not corrupt:
for value in dom_values:
try:
eval(str(value))
value_set = True
except:
err_val = err_val + ((value),)
value_set = False
incomplete = True
active = False
templates_files_wip = \
( #==============================================#
eval(str('wip_favicon_f')), # When an active and complete domain is needed #
eval(str('wip_logo_f')), #----------------------------------------------#
eval(str('wip_css_f')), if exists and not incomplete and not corrupt:
eval(str('wip_navbar_f')), if active:
eval(str('wip_sidebar_f')), ready = True
eval(str('wip_metas_f')),
eval(str('wip_footer_f')), wip_html_mods = \
eval(str('wip_stats_f')), (
) eval(str('wip_navbar_f')),
eval(str('wip_sidebar_f')),
eval(str('wip_metas_f')),
eval(str('wip_footer_f'))
)
www_html_mods = \
(
eval(str('www_navbar_f')),
eval(str('www_sidebar_f')),
eval(str('www_metas_f')),
eval(str('www_footer_f'))
)
metas = \
(
eval(str('metas_f')),
eval(str('wip_metas_f')),
eval(str('www_metas_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')),
)
templates = \
(
eval(str('wip_logo_f')),
eval(str('wip_favicon_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')),
eval(str('www_favicon_f')),
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')),
)
statistics = \
(
eval(str('wip_stats_f')),
eval(str('www_stats_f')),
)
templates_files_www = \ modules = \
( {
eval(str('www_favicon_f')), "metas" : metas,
eval(str('www_logo_f')), "navbar" : navbars,
eval(str('www_css_f')), "sidebar" : sidebars,
eval(str('www_navbar_f')), "footer" : footers,
eval(str('www_sidebar_f')), "template": templates,
eval(str('www_metas_f')), "stats" : statistics,
eval(str('www_footer_f')), }
eval(str('www_stats_f')),
eval(str('www_rss_f')) templates_files_wip = \
) (
eval(str('wip_favicon_f')),
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_files_www = \
(
eval(str('www_favicon_f')),
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 #

View File

@ -25,36 +25,42 @@
# File: /var/lib/tyto/program/form.py # File: /var/lib/tyto/program/form.py
#---------------------------------------------------------------------- #----------------------------------------------------------------------
#------------ #-------------------------
# funny stats # Funny Stats Project
#------------ #-------------------------
# lines: # file lines : 1096
# functions: # file comments : 103
# comments: # file functions: 7
#---------------------------------------------------------------------- #--------------------------
#**********************************************************************
from datetime import datetime from datetime import datetime
import os, sys, shutil, 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
trans_dir = '/var/lib/tyto/translations'
# Get default System language
try: try:
lang_sys = locale.getdefaultlocale()[0].split('_')[0] lang_site
os.path.exists('%s/site_%s.py'%(trans_dir, lang_sys))
except: except:
lang_sys = 'en' # locale translation directory
trans_dir = '/var/lib/tyto/translations'
lang_site = lang_sys
# Get default System language
try:
lang_sys = locale.getdefaultlocale()[0].split('_')[0]
os.path.exists('%s/site_%s.py'%(trans_dir, lang_sys))
except:
lang_sys = 'en'
lang_site = lang_sys
# Generic answer # Generic answer
"""
answer_yes = ('y', 'Y', 'yes', 'Yes', 'YES', answer_yes = ('y', 'Y', 'yes', 'Yes', 'YES',
'o', 'O', 'oui', 'Oui', 'Oui' 'o', 'O', 'oui', 'Oui', 'Oui'
) )
"""
try: answer_yes
except: answer_yes = langs.answer_yes
#=======================================# #=======================================#
@ -72,7 +78,11 @@ def asking(question, yes_no):
logs.out("255", '', True) logs.out("255", '', True)
if yes_no: if yes_no:
if not answer in answer_yes: go = False
for yes_names in answer_yes:
if answer.lower() in yes_names:
go = True
if not go:
logs.out("255", '', True) logs.out("255", '', True)
else: else:

View File

@ -22,19 +22,19 @@
# File: /var/lib/tyto/program/html.py # File: /var/lib/tyto/program/html.py
#---------------------------------------------------------------------- #----------------------------------------------------------------------
#------------ #-------------------------
# funny stats # Funny Stats Project
#------------ #-------------------------
# lines: # file lines : 543
# functions: # file comments : 70
# comments: # file functions: 8
#---------------------------------------------------------------------- #--------------------------
#**********************************************************************
import os, sys, importlib 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') wip_opts = ('wip', 'new')
pub_opts = ('www', 'pub') pub_opts = ('www', 'pub')
@ -163,6 +163,7 @@ def create_main_page(target, article_bottom):
'%s\n'%metas + \ '%s\n'%metas + \
' </head>\n\n' + \ ' </head>\n\n' + \
' <body>\n' + \ ' <body>\n' + \
' <div id="site_container">\n' + \
' <header id="header_page">\n' + \ ' <header id="header_page">\n' + \
' <div id="site_logo">\n' + \ ' <div id="site_logo">\n' + \
' %s\n'%logo_html + \ ' %s\n'%logo_html + \
@ -177,6 +178,7 @@ def create_main_page(target, article_bottom):
' </div>\n' + \ ' </div>\n' + \
' </header>\n' + \ ' </header>\n' + \
tags_html_mods[dom.wip_navbar_f] + '\n' + \ tags_html_mods[dom.wip_navbar_f] + '\n' + \
' <div id="article_sidebar_container">\n' + \
' <article id="article_main">\n' + \ ' <article id="article_main">\n' + \
' <h1 accesskey="t" id="post_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'%(
@ -199,7 +201,9 @@ def create_main_page(target, article_bottom):
' </article>\n' + \ ' </article>\n' + \
'\n' + \ '\n' + \
tags_html_mods[dom.wip_sidebar_f] + '\n' + \ tags_html_mods[dom.wip_sidebar_f] + '\n' + \
' </div>\n' + \
tags_html_mods[dom.wip_footer_f] + '\n' + \ tags_html_mods[dom.wip_footer_f] + '\n' + \
' </div>\n' + \
' </body>\n' + \ ' </body>\n' + \
'</html>' '</html>'
@ -484,10 +488,10 @@ 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 + \
' <h3 class="sidebar_item_title">%s</h2>\n'%title + \ ' <h3 class="sidebar_item_title">%s</h3>\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\n'%(date, about) + \
' </p>\n' + \ ' </p>\n' + \
' </a>\n' + \ ' </a>\n' + \
' </li>\n' ' </li>\n'

View File

@ -23,20 +23,20 @@
# File: /var/lib/tyto/program/infos.py # File: /var/lib/tyto/program/infos.py
#---------------------------------------------------------------------- #----------------------------------------------------------------------
#------------ #-------------------------
# funny stats # Funny Stats Project
#------------ #-------------------------
# lines: # file lines : 130
# functions: # file comments : 26
# comments: # file functions: 3
#---------------------------------------------------------------------- #--------------------------
#**********************************************************************
import os, sys, importlib import os, sys, importlib
import langs import langs
importlib.reload(langs) importlib.reload(langs)
# Set colors # Set colors
CS = '\033[0;0m' CS = '\033[0;0m'
CR = '\033[1;31m' CR = '\033[1;31m'

View File

@ -23,50 +23,67 @@
# File: /var/lib/tyto/program/langs.py # File: /var/lib/tyto/program/langs.py
#---------------------------------------------------------------------- #----------------------------------------------------------------------
#------------ #-------------------------
# funny stats # Funny Stats Project
#------------ #-------------------------
# lines: # file lines : 89
# functions: # file comments : 27
# comments: # file functions: 0
#---------------------------------------------------------------------- #--------------------------
#**********************************************************************
import locale, sys, os, importlib import locale, sys, os, importlib
import dom import dom
# Import translation directory
trans_dir = '/var/lib/tyto/translations'
sys.path.insert(0, trans_dir)
# Get default system language
# or set "en" (english) if no translation file
try: try:
lang_sys = locale.getdefaultlocale()[0].split('_')[0] site.yes
os.path.exists('%s/logs_%s.py'%(trans_dir, lang_sys))
except: except:
lang_sys = 'en' # Import translation directory
trans_dir = '/var/lib/tyto/translations'
sys.path.insert(0, trans_dir)
# Create yes array with all yes languages
try:
answer_yes
except:
answer_yes = (())
for lang_file in os.listdir(trans_dir):
if lang_file.startswith("site_") and lang_file.endswith(".py"):
lang_file = lang_file.replace(".py", "")
lang = importlib.import_module(lang_file)
answer_yes = answer_yes + ((lang.yes),)
# Get default system language
# or set "en" (english) if no translation file
try:
lang_sys = locale.getdefaultlocale()[0].split('_')[0]
os.path.exists('%s/logs_%s.py'%(trans_dir, lang_sys))
except:
lang_sys = 'en'
# Set language logs from configuration domain
# or set default english if not known
try:
dom.exists
lang_logs = dom.lang_logs
os.path.exists('%s/logs_%s.py'%(trans_dir, lang_logs))
log = importlib.import_module('logs_%s'%lang_logs, package=None)
except:
log = importlib.import_module('logs_%s'%lang_sys, package=None)
# Set language site/form from configuration domain
# or set default english if not known
try:
dom.exists
lang_site = dom.lang_site
os.path.exists('%s/site_%s.py'%(trans_dir, lang_site))
site = importlib.import_module('site_%s'%lang_site, package=None)
except:
site = importlib.import_module('site_%s'%lang_sys, package=None)
# Set language logs from configuration domain
# or set default english if not known
try:
dom.exists
lang_logs = dom.lang_logs
os.path.exists('%s/logs_%s.py'%(trans_dir, lang_logs))
log = importlib.import_module('logs_%s'%lang_logs, package=None)
except:
log = importlib.import_module('logs_%s'%lang_sys, package=None)
# Set language site/form from configuration domain
# or set default english if not known
try:
dom.exists
lang_site = dom.lang_site
os.path.exists('%s/site_%s.py'%(trans_dir, lang_site))
site = importlib.import_module('site_%s'%lang_site, package=None)
except:
site = importlib.import_module('site_%s'%lang_sys, package=None)

View File

@ -23,27 +23,30 @@
# File: /var/lib/tyto/program/logs.py # File: /var/lib/tyto/program/logs.py
#---------------------------------------------------------------------- #----------------------------------------------------------------------
#------------ #-------------------------
# funny stats # Funny Stats Project
#------------ #-------------------------
# lines: # file lines : 126
# functions: # file comments : 22
# comments: # file functions: 1
#---------------------------------------------------------------------- #--------------------------
#**********************************************************************
import os, sys import os, sys
import langs import langs
# Use to mark new article
shebang = "#!/NEW"
# Set colors try:
CS = '\033[0;0m' shebang
CR = '\033[1;31m' except:
CY = '\033[1;33m' # Use to mark new article
CG = '\033[1;32m' shebang = "#!/NEW"
# Set colors
CS = '\033[0;0m'
CR = '\033[1;31m'
CY = '\033[1;33m'
CG = '\033[1;32m'
# Exit from program with message # # Exit from program with message #

View File

@ -23,19 +23,18 @@
# File: /var/lib/tyto/program/new.py # File: /var/lib/tyto/program/new.py
#---------------------------------------------------------------------- #----------------------------------------------------------------------
#------------ #-------------------------
# funny stats # Funny Stats Project
#------------ #-------------------------
# lines: # file lines : 93
# functions: # file comments : 26
# comments: # file functions: 1
#---------------------------------------------------------------------- #--------------------------
#**********************************************************************
import sys import sys
from unidecode import unidecode from unidecode import unidecode
import args, dom, logs, langs, form, html, tyto, show import args, dom, logs, langs, form, html, tyto, show, creators
#===============================================# #===============================================#
@ -56,7 +55,8 @@ def manage(target):
'sidebar' : html.create_sidebar, 'sidebar' : html.create_sidebar,
'navbar' : html.create_navbar, 'navbar' : html.create_navbar,
'metas' : html.create_user_metas, 'metas' : html.create_user_metas,
'footer' : html.create_user_footer 'footer' : html.create_user_footer,
'sitemap' : creators.manage
} }
actions[target](option) actions[target](option)

View File

@ -23,20 +23,20 @@
# File: /var/lib/tyto/program/publish.py # File: /var/lib/tyto/program/publish.py
#---------------------------------------------------------------------- #----------------------------------------------------------------------
#------------ #-------------------------
# funny stats # Funny Stats Project
#------------ #-------------------------
# lines: # file lines : 293
# functions: # file comments : 49
# comments: # file functions: 6
#---------------------------------------------------------------------- #--------------------------
#**********************************************************************
import os, sys, shutil, importlib import os, sys, shutil, importlib, subprocess
from pathlib import Path from pathlib import Path
import logs, args, dom, db, wip, html, tyto, form, stats, rss, langs, check import logs, args, dom, db, wip, html, tyto, form, stats, rss, langs, check
#==============================# #==============================#
# Manage action, get post db # # Manage action, get post db #
# check if publish can be done # # check if publish can be done #
@ -46,15 +46,17 @@ def manage(target):
# Specific QUICK processes: check > wip > publish # Specific QUICK processes: check > wip > publish
if args.action == "quick-pub": if args.action == "quick-pub":
try: try: db.uri_file
db.uri_file except: logs.out("28", "%s + %s"%(args.action, args.target), True)
except:
logs.out("28", "%s + %s"%(args.action, args.target), True) wip = subprocess.run(
[
print(" ! Quick Publish") '/usr/bin/tyto',
check.check_process(target) 'force-wip',
importlib.reload(db) target
wip.wip_article(db.uri_file) ],
)
print()
importlib.reload(db) importlib.reload(db)
check_to_publish('one') check_to_publish('one')
publish_article() publish_article()
@ -280,6 +282,9 @@ def publish_template(option):
logs.out("32", item_dst, False) logs.out("32", item_dst, False)
# Create new file from _configs/ files # Create new file from _configs/ files
if args.option == "--no-mods":
return
html.create_sidebar('pub') html.create_sidebar('pub')
html.create_navbar('pub') html.create_navbar('pub')
html.create_user_metas('pub') html.create_user_metas('pub')

View File

@ -23,15 +23,14 @@
# File: /var/lib/tyto/program/rss.py # File: /var/lib/tyto/program/rss.py
#---------------------------------------------------------------------- #----------------------------------------------------------------------
#------------ #-------------------------
# funny stats # Funny Stats Project
#------------ #-------------------------
# lines: # file lines : 128
# functions: # file comments : 27
# comments: # file functions: 1
#---------------------------------------------------------------------- #--------------------------
#*********************************************************************
import os import os
from pathlib import Path from pathlib import Path
@ -86,6 +85,10 @@ def create_feed():
if not hash_www or hash_chk != hash_www: if not hash_www or hash_chk != hash_www:
continue continue
# NoSitemap
if not db.sitemap:
continue
rss_item = True rss_item = True
nbr_item += 1 nbr_item += 1

View File

@ -24,19 +24,19 @@
# File: /var/lib/tyto/program/show.py # File: /var/lib/tyto/program/show.py
#---------------------------------------------------------------------- #----------------------------------------------------------------------
#------------ #-------------------------
# funny stats # Funny Stats Project
#------------ #-------------------------
# lines: # file lines : 215
# functions: # file comments : 38
# comments: # file functions: 3
#---------------------------------------------------------------------- #--------------------------
#**********************************************************************
import os, sys, importlib import os, sys, importlib, subprocess
import args, logs, langs, dom, db, form, tyto, check, html, stats import args, logs, langs, dom, db, form, tyto, check, html, stats
#========================# #========================#
# Read lines from a file # # Read lines from a file #
# alone: True/False # # alone: True/False #
@ -93,80 +93,85 @@ def manage(target):
try: post_www = db.post_www try: post_www = db.post_www
except: pass except: pass
# Except for show-about > Show post DB
if args.action == "show-about":
target = 'post'
# Convert command action to do[] # Convert command action to do[]
# as edit* &nd show* [action] have same target file # as edit* &nd show* [action] have same target file
actions = \ actions = \
{ {
"show" : 'src', "show" : 'src',
"edit" : 'src', "edit" : 'src',
"post" : 'src', "post" : 'src',
"show-db" : 'db', "preview" : 'wip',
"edit-db" : 'db', "show-db" : 'db',
"show-wip" : 'wip', "edit-db" : 'db',
"edit-wip" : 'wip', "show-wip" : 'wip',
"show-www" : 'www', "edit-wip" : 'wip',
"edit-www" : 'www' "show-www" : 'www',
} "edit-www" : 'www'
}
action = actions[args.action] action = actions[args.action]
# Set target file from "new" [action] # Set target file from "new" [action]
do = \ do = \
{ {
'src' : { 'src' : {
"domain" : dom.config, "domain" : dom.config,
"footer" : dom.footer_f, "footer" : dom.footer_f,
"metas" : dom.metas_f, "metas" : dom.metas_f,
"navbar" : dom.navbar_f, "navbar" : dom.navbar_f,
"sidebar" : dom.sidebar_f, "sidebar" : dom.sidebar_f,
"post" : post_src "post" : post_src
}, },
'db' : { 'db' : {
"domain" : dom.config, "domain" : dom.config,
"footer" : dom.footer_f, "footer" : dom.footer_f,
"metas" : dom.metas_f, "metas" : dom.metas_f,
"navbar" : dom.navbar_f, "navbar" : dom.navbar_f,
"sidebar" : dom.sidebar_f, "sidebar" : dom.sidebar_f,
"post" : post_db "post" : post_db
}, },
'wip' : { 'wip' : {
"domain" : dom.config, "domain" : dom.config,
"footer" : dom.wip_footer_f, "footer" : dom.wip_footer_f,
"metas" : dom.wip_metas_f, "metas" : dom.wip_metas_f,
"navbar" : dom.wip_navbar_f, "navbar" : dom.wip_navbar_f,
"sidebar" : dom.wip_sidebar_f, "sidebar" : dom.wip_sidebar_f,
"post" : post_wip, "post" : post_wip,
"stats" : dom.wip_stats_f, "sitemap" : '%ssitemap.html'%dom.srv_wip,
}, "stats" : dom.wip_stats_f,
'www' : { },
"domain" : dom.config, 'www' : {
"footer" : dom.www_footer_f, "domain" : dom.config,
"metas" : dom.www_metas_f, "footer" : dom.www_footer_f,
"navbar" : dom.www_navbar_f, "metas" : dom.www_metas_f,
"sidebar" : dom.www_sidebar_f, "navbar" : dom.www_navbar_f,
"post" : post_www, "sidebar" : dom.www_sidebar_f,
"stats" : dom.www_stats_f, "post" : post_www,
}, "stats" : dom.www_stats_f,
} },
}
# Read or edit file, according to legacy args.action # Read or edit file, according to legacy args.action
try: file = do[action][target]
file = do[action][target] if not file:
logs.out("28", '%s + %s'%(args.action, args.target), True)
if args.action in actions_read:
read_lines(file, True) if not file or not tyto.exists(file):
logs.out("1", file, True)
elif args.action in actions_edit:
curr_hash = tyto.get_filesum(file, True) # Except for show-about > Show post DB
tyto.edit_file(file) if args.action == "preview":
preview_wip(file)
return
elif args.action in actions_read:
read_lines(file, True)
except: elif args.action in actions_edit:
logs.out("28", '%s + %s'%(args.action, target), True) curr_hash = tyto.get_filesum(file, True)
tyto.edit_file(file)
# If edit article and hash changed, ask to check # If edit article and hash changed, ask to check
@ -178,16 +183,33 @@ def manage(target):
# Launch process for some changed file # Launch process for some changed file
#------------------------------------- #-------------------------------------
if file == post_src: if file == post_src:
form.asking('%s%s '%(
langs.site.post_chg, langs.site.q
), True)
# Reload post DB (if edited article, and check it if ask "y") # Reload post DB (if edited article, and check it if ask "y")
importlib.reload(db) importlib.reload(db)
check.manage(post_src) check = subprocess.run(
[
'/usr/bin/tyto',
'check',
args.target
]
)
elif file == dom.sidebar_f: html.create_sidebar('wip') elif file == dom.sidebar_f: html.create_sidebar('wip')
elif file == dom.navbar_f: html.create_navbar('wip') elif file == dom.navbar_f: html.create_navbar('wip')
elif file == dom.metas_f: html.create_user_metas('wip') elif file == dom.metas_f: html.create_user_metas('wip')
#=====================================#
# Preview in browser wip page #
# Ensure xdg-open (useless in server) #
#-------------------------------------#
def preview_wip(file):
try:
xdg = subprocess.run(
[
'/usr/bin/xdg-open',
file,
],
)
except:
logs.out("28", "/usr/bin/xdg-open %s"%file, True)

View File

@ -23,19 +23,19 @@
# File: /var/lib/tyto/program/stats.py # File: /var/lib/tyto/program/stats.py
#---------------------------------------------------------------------- #----------------------------------------------------------------------
#------------ #-------------------------
# funny stats # Funny Stats Project
#------------ #-------------------------
# lines: # file lines : 225
# functions: # file comments : 37
# comments: # file functions: 4
#---------------------------------------------------------------------- #--------------------------
#**********************************************************************
import os, importlib import os, importlib
import args, dom, logs, form, tyto, show, langs import args, dom, logs, form, tyto, show, langs
sti_articles = 0 sti_articles = 0
#=======================# #=======================#

View File

@ -23,40 +23,73 @@
# File: /var/lib/tyto/program/status.py # File: /var/lib/tyto/program/status.py
#---------------------------------------------------------------------- #----------------------------------------------------------------------
#------------ #-------------------------
# funny stats # Funny Stats Project
#------------ #-------------------------
# lines: # file lines : 238
# functions: # file comments : 50
# comments: # file functions: 3
#---------------------------------------------------------------------- #--------------------------
#**********************************************************************
import os import os
import args, dom, logs, tyto, html, db import args, dom, logs
#=====================#
# Check domain status #
#---------------------#
def domain(): def domain():
if dom.hole: logs.out("13", '', True) if dom.hole:
elif args.action == 'new' and args.target == "domain": return logs.out("13", '', True)
elif args.act_err: logs.out("11", args.action, True)
elif not dom.exists: logs.out("10", '', True)
elif dom.corrupt: logs.out("39", dom.shortname, True)
print("") # Only condition to not check domain status here
if dom.incomplete: logs.out("41", dom.shortname, False) if args.action == 'new' and \
elif dom.active: logs.out("42", dom.shortname, False) args.target == "domain":
elif not dom.active: logs.out("40", dom.shortname, False) return
# As subprocesses, avoid show domain status each time
if args.action in args.quicks:
return
# No backward in target # [action] not in list
if args.act_err:
logs.out("11", args.action, True)
# No domain found
if not dom.exists:
logs.out("10", '', True)
# Domain id corrupted
if dom.corrupt:
logs.out("39", dom.shortname, True)
# Domain is incomplete
if dom.incomplete:
logs.out("41", dom.shortname, False)
# Show unused values
for err_val in dom.err_val:
logs.out("16", err_val, True)
# Domain not activated
if not dom.active:
logs.out("40", dom.shortname, True)
# Domain is activated
if dom.active:
logs.out("42", dom.shortname, False)
# No backward in [target]
if "../" in args.target: if "../" in args.target:
logs.out("11", '"../"', True) logs.out("11", '"../"', True)
# Show unused values
for err_val in dom.err_val:
logs.out("16", err_val, True)
# Create unused directories #===========================#
# Create unused directories #
#---------------------------#
import tyto
srv_show_wip = srv_show_www = local_show = dom_err = False srv_show_wip = srv_show_www = local_show = dom_err = False
for value in dom.dom_values: for value in dom.dom_values:
set_value = eval(str('dom.%s'%value)) set_value = eval(str('dom.%s'%value))
@ -103,6 +136,8 @@ def domain():
# Create missing modules files # Create missing modules files
import html
if not tyto.exists(dom.metas_f) or \ if not tyto.exists(dom.metas_f) or \
not tyto.exists(dom.wip_metas_f): not tyto.exists(dom.wip_metas_f):
html.create_user_metas('new') html.create_user_metas('new')
@ -124,6 +159,8 @@ def domain():
# On demand with status action # # On demand with status action #
#------------------------------# #------------------------------#
def check(target): def check(target):
import db
# target needed # target needed
if not target: if not target:
logs.out("5", '[target]', True) logs.out("5", '[target]', True)

View File

@ -23,20 +23,20 @@
# File: /var/lib/tyto/program/tyto.py # File: /var/lib/tyto/program/tyto.py
#---------------------------------------------------------------------- #----------------------------------------------------------------------
#------------ #-------------------------
# funny stats # Funny Stats Project
#------------ #-------------------------
# lines: # file lines : 724
# functions: # file comments : 120
# comments: # file functions: 14
#---------------------------------------------------------------------- #--------------------------
#**********************************************************************
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, langs import args, dom, logs, langs
# :D # :D
Tyto = 'Tyto - Littérateur' Tyto = 'Tyto - Littérateur'
Tytogit = 'https://git.a-lec.org/echolib/tyto-litterateur' Tytogit = 'https://git.a-lec.org/echolib/tyto-litterateur'
@ -103,50 +103,6 @@ headers = \
# ! 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.
#------------------------------------------------------------- #-------------------------------------------------------------
words_tags = [
(
'*_', '_*',
'<strong class="%s">'%dom.css, '</strong>',
'strongs'
),
(
'+_', '_+',
'<b class="%s">'%dom.css, '</b>',
'bolds'
),
(
';_', '_;',
'<em class="%s">'%dom.css, '</em>',
'emphasis'
),
(
':_', '_:',
'<i class="%s">'%dom.css, '</i>',
'italics'
),
(
'~_', '_~',
'<del class="%s">'%dom.css, '</del>',
'dels'
),
(
'._', '_.', '<u class="%s">'%dom.css,
'</u>',
'underlines'
),
(
'[_', '_]',
'<cite class="%s">'%dom.css, '</cite>',
'cites'
),
(
'%_', '_%',
'<span class="custom">', '</span>',
'customs'
),
]
icode_tags = \ icode_tags = \
( (
'{_', '_}', '{_', '_}',
@ -154,6 +110,7 @@ icode_tags = \
'icodes', 'icodes',
'\\{_', '\\_}' '\\{_', '\\_}'
) )
strong_tags = \ strong_tags = \
( (
'*_', '_*', '*_', '_*',
@ -162,6 +119,7 @@ strong_tags = \
'\\*_', '\\_*', '\\*_', '\\_*',
'-S1-', '-S2-' '-S1-', '-S2-'
) )
bold_tags = \ bold_tags = \
( (
'+_', '_+', '+_', '_+',
@ -170,6 +128,7 @@ bold_tags = \
'\\+_', '\\_+', '\\+_', '\\_+',
'-B1-', '-B2-' '-B1-', '-B2-'
) )
em_tags = \ em_tags = \
( (
';_', '_;', ';_', '_;',
@ -178,6 +137,7 @@ em_tags = \
'\\;_', '\\_;', '\\;_', '\\_;',
'-EM1-', '-EM2-' '-EM1-', '-EM2-'
) )
i_tags = \ i_tags = \
( (
':_', '_:', ':_', '_:',
@ -186,6 +146,7 @@ i_tags = \
'\\:_', '\\_:', '\\:_', '\\_:',
'-I1-', '-I2-' '-I1-', '-I2-'
) )
u_tags = \ u_tags = \
( (
'._', '_.', '<u class="%s">'%dom.css, '._', '_.', '<u class="%s">'%dom.css,
@ -194,6 +155,7 @@ u_tags = \
'\\._', '\\_.', '\\._', '\\_.',
'-U1-', '-U2-' '-U1-', '-U2-'
) )
del_tags = \ del_tags = \
( (
'~_', '_~', '~_', '_~',
@ -202,6 +164,7 @@ del_tags = \
'\\~_', '\\_~', '\\~_', '\\_~',
'-DE1-', '-DE2-' '-DE1-', '-DE2-'
) )
cite_tags = \ cite_tags = \
( (
'[_', '_]', '[_', '_]',
@ -210,6 +173,7 @@ cite_tags = \
'\\[_', '\\_]', '\\[_', '\\_]',
'-CI1-', '-CI2-' '-CI1-', '-CI2-'
) )
custom1_tags = \ custom1_tags = \
( (
'%_', '_%', '%_', '_%',
@ -219,7 +183,6 @@ custom1_tags = \
'-CU1-', '-CU2-' '-CU1-', '-CU2-'
) )
markers_tags = \ markers_tags = \
[ [
strong_tags, strong_tags,
@ -344,7 +307,7 @@ date: %s
Texte-alternatif Texte-alternatif
#link: lien 1 #link: lien 1
URi/URL URI/URL
Text-alternatif Text-alternatif
----- -----
@ -361,48 +324,6 @@ date: %s
nbr_icodes = 0 nbr_icodes = 0
#==============================#
# Replace escaped markers #
# check: with "" #
# wip: with altternate #
# (recover when wip done) #
#------------------------------#
def protect_escaped(post_bottom, reverse):
for m1, m2, h1, h2, n, e1, e2, r1, r2 in markers_tags:
# In check mode, No need to keep escaped markers
if args.action == "check":
r1 = r2 = ''
if reverse:
post_bottom = post_bottom.replace(r1, m1)
post_bottom = post_bottom.replace(r2, m2)
else:
post_bottom = post_bottom.replace(e1, r1)
post_bottom = post_bottom.replace(e2, r2)
return post_bottom
# -- tests
def find_between( s, first, last ):
try:
start = s.index( first ) + len( first )
end = s.index( last, start )
return s[start:end]
except ValueError:
return ""
def find_between_r( s, first, last ):
try:
start = s.rindex( first ) + len( first )
end = s.rindex( last, start )
return s[start:end]
except ValueError:
return ""
# -- tests
#=======# #=======#
# TOOLS # # TOOLS #
#=======#-------------------------------------------------------------- #=======#--------------------------------------------------------------
@ -432,9 +353,6 @@ def convert_altname(altname):
# False = URI # # False = URI #
#-----------------------# #-----------------------#
def get_filesum(path, src): def get_filesum(path, src):
#if not src and not exists(path):
# logs.out("1", path, True)
file_sum = blake2b(digest_size=4) file_sum = blake2b(digest_size=4)
if src: file_sum.update(open(path, 'rb').read()) if src: file_sum.update(open(path, 'rb').read())
@ -506,6 +424,29 @@ def get_css(line):
return css return css
#==============================#
# Replace escaped markers #
# check: with "" #
# wip: with altternate #
# reverse: True/False #
#------------------------------#
def protect_escaped(post_bottom, reverse):
for m1, m2, h1, h2, n, e1, e2, r1, r2 in markers_tags:
# In check mode, No need to keep escaped markers
if args.action == "check":
r1 = r2 = ''
if reverse:
post_bottom = post_bottom.replace(r1, m1)
post_bottom = post_bottom.replace(r2, m2)
else:
post_bottom = post_bottom.replace(e1, r1)
post_bottom = post_bottom.replace(e2, r2)
return post_bottom
#=============================================# #=============================================#
# First check process to protect contents # # First check process to protect contents #
# Protect block-Codes, quotes # # Protect block-Codes, quotes #
@ -580,11 +521,14 @@ def protect_bcodes_quotes(process, post_bottom):
if not bcode: bcode = line if not bcode: bcode = line
else: bcode = '%s\n%s'%(bcode, line) else: bcode = '%s\n%s'%(bcode, line)
line = '' line = ''
continue
elif in_quote: elif in_quote:
# Convert lines to b64 # Convert lines to b64
if not quote: quote = line if not quote: quote = line
else: quote = '%s\n%s'%(quote, line) else: quote = '%s\n%s'%(quote, line)
line = '' line = ''
continue
# Set new content # Set new content
@ -614,27 +558,27 @@ def protect_icodes(post_bottom):
# Get only lines that contains code # Get only lines that contains code
in_icode = ok_icode = go_icode = False in_icode = ok_icode = go_icode = False
for ln, line in enumerate(post_bottom.rsplit('\n')): for ln, line in enumerate(post_bottom.rsplit('\n')):
if not "{_" in line or not "_}" in line: if not icode_tags[0] in line or \
not icode_tags[1] in line:
continue continue
code = "" code = ""
for i, c in enumerate(line): for i, c in enumerate(line):
if c == "_": if c == "_":
try: try:
if line[i-1] == "{" and line[i-2] != "\\": # {_
if line[i-1] == icode_tags[0][0] and line[i-2] != "\\":
in_icode = True in_icode = True
ok_icode = False ok_icode = False
go_icode = True #go_icode = True
elif line[i+1] == "}" and line[i-2] != "\\": continue
# _}
elif line[i+1] == icode_tags[1][1] and line[i-2] != "\\":
in_icode = False in_icode = False
ok_icode = True ok_icode = True
go_icode = False go_icode = False
except: except:
continue continue
if go_icode :
go_icode = False
continue
if in_icode: if in_icode:
ok_icode = False ok_icode = False
@ -650,7 +594,7 @@ def protect_icodes(post_bottom):
post_bottom = post_bottom.replace(tyto_code , '') post_bottom = post_bottom.replace(tyto_code , '')
elif args.action == "wip": elif args.action == "wip":
code = convert_altname(code) code = convert_altname(code) # HTML sympbols
html_code = "%s%s%s"%( html_code = "%s%s%s"%(
icode_tags[2], code, icode_tags[3]) icode_tags[2], code, icode_tags[3])
b64_code = b64('Encode', html_code, 'I64.', '.I64') b64_code = b64('Encode', html_code, 'I64.', '.I64')

View File

@ -26,17 +26,16 @@
# File: /var/lib/tyto/program/wip.py # File: /var/lib/tyto/program/wip.py
#---------------------------------------------------------------------- #----------------------------------------------------------------------
#------------ #-------------------------
# funny stats # Funny Stats Project
#------------ #-------------------------
# lines: # file lines : 1112
# functions: # file comments : 166
# comments: # file functions: 26
#---------------------------------------------------------------------- #--------------------------
#**********************************************************************
import os, re, sys, locale, shutil, importlib, time import os, re, sys, locale, shutil, importlib, time, subprocess
from pathlib import Path from pathlib import Path
import args, logs, langs, dom, db, tyto, html, form, stats, check import args, logs, langs, dom, db, tyto, html, form, stats, check
@ -53,13 +52,28 @@ def manage(target):
logs.out("5", '[target]', True) logs.out("5", '[target]', True)
# option --force to check and wip processes # option --force to check and wip processes
if args.option == '--force': if args.action == 'force-wip':
if args.target in args.pass_targets: if args.target in args.pass_targets:
logs.out("28", "%s + %s"%(args.target, args.option), True) logs.out("28", "%s + %s"%(args.target, args.option), True)
check.manage(target)
#importlib.reload(db) chk = subprocess.run(
wip_article(target) [
'/usr/bin/tyto',
'check',
target,
'--force'
],
)
print()
wip = subprocess.run(
[
'/usr/bin/tyto',
'wip',
target,
],
)
return return
# Modules and multi-articles # Modules and multi-articles
@ -323,7 +337,7 @@ def wip_single_tags():
#----------------------------------# #----------------------------------#
def wip_words_tags(): def wip_words_tags():
# Strongs, italics... # Strongs, italics...
for tag in tyto.words_tags: for tag in tyto.markers_tags:
# Open tag # Open tag
replace_in_post(tag[0], replace_in_post(tag[0],
tag[2] tag[2]
@ -375,23 +389,54 @@ def wip_words_tags():
) )
#========================# #============================#
# Convert links set inDB # # from wip_links #
# - file_%i # # Get arrays, in DB #
# - link_%i # # sort all links by length #
# from marker to HTML # # (avoic abcd to target abc) #
#------------------------# # return db.NAME_i array #
#----------------------------#
def wip_return_link_nbr(marker, nbr):
items = [()]
links = (())
# Get length link and i (from all arrays ) in new array
for i in range(1, nbr + 1):
item = 'db.%s_%s'%(marker, i)
len_link = len(eval(item)[1])
items = items + [(len_link, i),]
# Sort length by bigger in new array
for i in sorted(items,reverse=True):
try:
print(i[1])
links = links + ((i[1]),)
except:
pass
return links
#=========================#
# Convert links set in DB #
# - file_%i #
# - link_%i #
#-------------------------#
def wip_links(): def wip_links():
if db.uniq_files == 0 and db.uniq_links == 0: return if db.uniq_files == 0 and db.uniq_links == 0: return
link_tb = 'target="_blank"' link_tb = 'target="_blank"'
link_ts = 'target="_self"' link_ts = 'target="_self"'
link_html = '<a class="%s" href="%s" title="%s" %s>%s</a>' link_html = '<a class="%s" href="%s" title="%s" %s>%s</a>'
# ! Doing link files, first, becase of similar marker # ! Doing link files, first, becase of similar marker
#---------------------------------------------------- #----------------------------------------------------
if db.uniq_files > 0: if db.uniq_files > 0:
for i in range(1, db.uniq_files + 1):
links = wip_return_link_nbr("file", db.uniq_files)
for i in links:
if not i:
return
flink = 'db.file_%s'%i flink = 'db.file_%s'%i
flink_css = "link_file" flink_css = "link_file"
flink_name = eval(flink)[0][2:] flink_name = eval(flink)[0][2:]
@ -408,7 +453,12 @@ def wip_links():
# Convert simple links # Convert simple links
#--------------------- #---------------------
if db.uniq_links > 0: if db.uniq_links > 0:
for i in range(1, db.uniq_links + 1):
links = wip_return_link_nbr("link", db.uniq_links)
for i in links:
if not i:
return
link = 'db.link_%s'%i link = 'db.link_%s'%i
link_css = "link" link_css = "link"
link_name = eval(link)[0][1:] link_name = eval(link)[0][1:]
@ -417,6 +467,7 @@ def wip_links():
link_set = link_html%( link_set = link_html%(
link_css, link_anc, link_title, "%s", link_name link_css, link_anc, link_title, "%s", link_name
) )
print(">", eval(link)[1])
replace_in_post(eval(link)[0]+'+', link_set%link_tb) replace_in_post(eval(link)[0]+'+', link_set%link_tb)
replace_in_post(eval(link)[0], link_set%link_ts) replace_in_post(eval(link)[0], link_set%link_ts)
@ -514,7 +565,7 @@ def wip_images():
else: else:
style = '' style = ''
# set <img /> from parameter # set <img> from parameter
image_target = eval(image)[1] image_target = eval(image)[1]
image_target = db.sub_uri + image_target[1:] image_target = db.sub_uri + image_target[1:]
image_src = image_show%( image_src = image_show%(

View File

@ -18,6 +18,9 @@
# - "\n" # - "\n"
# - "+ \" # - "+ \"
# Keep array ! ('','',)
yes = ("y", "yes",)
# Generic # Generic
article = "Article" article = "Article"
links = "links" links = "links"
@ -268,6 +271,7 @@ args_helps = """\n# New domain :
[sidebar, navbar, footer, metas] Create and replace [sidebar, navbar, footer, metas] Create and replace
with default module configuration file with default module configuration file
[filename] (no .tyto) Create article in current folder [filename] (no .tyto) Create article in current folder
[sitemap], create new website sitemap
# Show contents file (with line number) # Show contents file (with line number)
show : Show source file, source configuration module show : Show source file, source configuration module
@ -280,8 +284,10 @@ args_helps = """\n# New domain :
# Create HTML page # Create HTML page
check : Check the validity of a tyto format file check : Check the validity of a tyto format file
wip : Create article HTML page in server 'wip' wip : Create article HTML page in server 'wip'
force-wip : [file], check, and then, wip
preview : [module]/[file], open 'wip' file on default browser
publish : Create article HTML page in server 'www' publish : Create article HTML page in server 'www'
quick-pub : Do check, wip, publish ([file] only) quick-pub : [file], check, wip, publish
# [target] > According to [action] # [target] > According to [action]
# Multiple articles # Multiple articles
@ -306,10 +312,12 @@ args_helps = """\n# New domain :
navbar : Navbar configuration file navbar : Navbar configuration file
sidebar : Sidebar configuration file sidebar : Sidebar configuration file
stats : Stats file (server 'wip' er 'www') stats : Stats file (server 'wip' er 'www')
sitemap : sitemap.tyto/.html file
# [option] : # [option] :
--static : Créer une page HTML entièrement statique --static : Créer une page HTML entièrement statique
--force : Avec [wip], vérifier l'article et créer la page HTML""" --no-mods : With [publish template], do not recreate modules
"""
ex_helps = """# Examples : ex_helps = """# Examples :
# Check article (according to sub-folder) # Check article (according to sub-folder)

View File

@ -18,6 +18,9 @@
# - "\n" # - "\n"
# - "+ \" # - "+ \"
# Garder ! ('','',)
yes = ("o", "oui",)
# Generic # Generic
article = "Article" article = "Article"
links = "liens" links = "liens"
@ -267,6 +270,7 @@ args_helps = """\n# Nouveau domaine :
fichier de configuration du module par le défaut fichier de configuration du module par le défaut
[filename] (sans .tyto) Créer un article dans le [filename] (sans .tyto) Créer un article dans le
dossier actuel dossier actuel
[sitemap], créer le plan du site (sitemap)
# 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
@ -277,8 +281,10 @@ args_helps = """\n# Nouveau domaine :
# Processus de création / Mise en ligne # Processus de création / Mise en ligne
check : Vérifier la validité d'un article au format tyto check : Vérifier la validité d'un article au format tyto
wip : Créer une page HTML de l'article dans le serveur 'wip' wip : Créer une page HTML de l'article dans le serveur 'wip'
force-wip : [file], check, wip
preview : [module]/[file], ouvre le fichier 'wip' dans le navigateur par défaut
publish : Créer une page HTML de l'article dans le serveur 'www' publish : Créer une page HTML de l'article dans le serveur 'www'
quick-pub : Faire check, wip, publish ([file] seulement) quick-pub : [file] , check, wip, publish
# [target] > Selon l'action [action] # [target] > Selon l'action [action]
# Traitement en masse # Traitement en masse
@ -303,10 +309,12 @@ args_helps = """\n# Nouveau domaine :
navbar : Fichier de configuration du menu de navigation navbar : Fichier de configuration du menu de navigation
sidebar : Fichier de configuration de la barre latérale sidebar : Fichier de configuration de la barre latérale
stats : Fichier de statistiques (serveur 'wip' ou 'www') stats : Fichier de statistiques (serveur 'wip' ou 'www')
sitemap : Fichier sitemap.tyto/.html
# [option] # [option]
--static : Créer une page HTML entièrement statique --static : Créer une page HTML entièrement statique
--force : Avec [wip], vérifier l'article et créer la page HTML""" --no-mods : Avec [publish template], ne pas recréer les modules
"""
ex_helps = """# Exemples : ex_helps = """# Exemples :
# Vérifier l'article dans le sous dossier (suivant l'emplacement) # Vérifier l'article dans le sous dossier (suivant l'emplacement)