New processes and updated codes
This commit is contained in:
parent
e43f2eaaa4
commit
29ee8cc704
|
@ -64,7 +64,7 @@ actions = {
|
||||||
'show-www' : show.manage,
|
'show-www' : show.manage,
|
||||||
'status' : status.check,
|
'status' : status.check,
|
||||||
'template' : publish.manage_publish,
|
'template' : publish.manage_publish,
|
||||||
'wip' : wip.manage_wip,
|
'wip' : wip.manage,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,27 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# Name: Tyto - Littérateur
|
# Tyto - Littérateur
|
||||||
# Type: Command arguments
|
#
|
||||||
# Description: Check arguments
|
# Copyright (C) 2023 Cyrille Louarn <echolib+tyto@a-lec.org>
|
||||||
# file: args.py
|
#
|
||||||
# Folder: /var/lib/tyto/program/
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# By echolib (XMPP: im@echolib.re)
|
# it under the terms of the GNU Affero General Public License
|
||||||
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
|
# as published by the Free Software Foundation, either version 3 of the
|
||||||
|
# License, or of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# XMPP: echolib (im@echolib.re)
|
||||||
|
#
|
||||||
|
# Description: Manage arguments from command line
|
||||||
|
# File: /var/lib/tyto/program/args.py
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
#------------
|
#------------
|
||||||
# funny stats
|
# funny stats
|
||||||
|
@ -20,27 +36,28 @@
|
||||||
import sys
|
import sys
|
||||||
import infos, logs
|
import infos, logs
|
||||||
|
|
||||||
|
|
||||||
# Arguments from command line
|
# Arguments from command line
|
||||||
# tyto [action] [target]
|
# tyto [action] [target]
|
||||||
#----------------------------
|
#----------------------------
|
||||||
actions = \
|
actions = \
|
||||||
(
|
(
|
||||||
'check',
|
'check',
|
||||||
'edit',
|
'edit',
|
||||||
'edit-about',
|
'edit-about',
|
||||||
'edit-db',
|
'edit-db',
|
||||||
'edit-wip',
|
'edit-wip',
|
||||||
'edit-www',
|
'edit-www',
|
||||||
'help',
|
'help',
|
||||||
'new',
|
'new',
|
||||||
'show',
|
'show',
|
||||||
'show-about',
|
'show-about',
|
||||||
'show-db',
|
'show-db',
|
||||||
'show-wip',
|
'show-wip',
|
||||||
'show-www',
|
'show-www',
|
||||||
'status',
|
'status',
|
||||||
'wip',
|
'wip',
|
||||||
'publish'
|
'publish'
|
||||||
)
|
)
|
||||||
|
|
||||||
pass_actions = (
|
pass_actions = (
|
||||||
|
@ -51,35 +68,35 @@ pass_actions = (
|
||||||
# Actions that needs to check for article's database
|
# Actions that needs to check for article's database
|
||||||
pass_db = \
|
pass_db = \
|
||||||
(
|
(
|
||||||
'check',
|
'check',
|
||||||
'edit',
|
'edit',
|
||||||
'edit-db',
|
'edit-db',
|
||||||
'edit-wip',
|
'edit-wip',
|
||||||
'edit-www',
|
'edit-www',
|
||||||
'publish',
|
'publish',
|
||||||
'show',
|
'show',
|
||||||
'show-about',
|
'show-about',
|
||||||
'show-db',
|
'show-db',
|
||||||
'show-wip',
|
'show-wip',
|
||||||
'show-www',
|
'show-www',
|
||||||
'wip',
|
'wip',
|
||||||
)
|
)
|
||||||
|
|
||||||
pass_targets = \
|
pass_targets = \
|
||||||
(
|
(
|
||||||
'all',
|
'all',
|
||||||
'again',
|
'again',
|
||||||
'newer',
|
'newer',
|
||||||
'domain',
|
'domain',
|
||||||
'footer',
|
'footer',
|
||||||
'metas',
|
'metas',
|
||||||
'navbar',
|
'navbar',
|
||||||
'sidebar',
|
'sidebar',
|
||||||
'stats',
|
'stats',
|
||||||
'template'
|
'template'
|
||||||
)
|
)
|
||||||
|
|
||||||
multi_chk = ('all', 'again')
|
multi_chk = ('all', 'again', 'newer')
|
||||||
|
|
||||||
action = ''
|
action = ''
|
||||||
target = ''
|
target = ''
|
||||||
|
|
|
@ -38,7 +38,6 @@
|
||||||
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
|
||||||
|
|
||||||
post_err = False
|
post_err = False
|
||||||
|
@ -53,27 +52,23 @@ def manage(target):
|
||||||
|
|
||||||
# target needed
|
# target needed
|
||||||
if not target:
|
if not target:
|
||||||
logs.out("5", args.action, True)
|
logs.out("5", '[target]', True)
|
||||||
|
|
||||||
|
elif target in args.multi_chk:
|
||||||
|
check_all(target)
|
||||||
|
|
||||||
|
elif not db.post:
|
||||||
|
logs.out("1", db.uri_file, True)
|
||||||
|
|
||||||
# Already check
|
# Already check
|
||||||
elif not target in args.multi_chk \
|
elif db.exists \
|
||||||
and db.exists \
|
|
||||||
and not db.old_chk:
|
and not db.old_chk:
|
||||||
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
|
||||||
), True)
|
), True)
|
||||||
|
|
||||||
check_process(target)
|
check_process(target)
|
||||||
|
|
||||||
# All
|
|
||||||
elif target in args.multi_chk:
|
|
||||||
check_all(target)
|
|
||||||
|
|
||||||
# No file found
|
|
||||||
elif not db.post:
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
check_process(target)
|
check_process(target)
|
||||||
|
|
||||||
|
@ -367,9 +362,10 @@ def check_needed_tags(post_header):
|
||||||
# Create False date_check #
|
# Create False date_check #
|
||||||
#--------------------------------#
|
#--------------------------------#
|
||||||
def check_date(date):
|
def check_date(date):
|
||||||
global post_err
|
global post_err, date_tr
|
||||||
|
|
||||||
# Check if article date is valid (True)
|
# Check if article date is valid (True)
|
||||||
|
date_tr = date
|
||||||
fmt_article = "%Y-%m-%d"
|
fmt_article = "%Y-%m-%d"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -388,9 +384,8 @@ def check_date(date):
|
||||||
# Set franch format in post DB
|
# Set franch format in post DB
|
||||||
if dom.lang_site == 'fr':
|
if dom.lang_site == 'fr':
|
||||||
date = date.rsplit('-')
|
date = date.rsplit('-')
|
||||||
date = date[2] + '/' + date[1] + '/' + date[0]
|
date_tr = date[2] + '/' + date[1] + '/' + date[0]
|
||||||
|
print("> Convert date in FR >", date_tr)
|
||||||
date = (date, date_check)
|
|
||||||
|
|
||||||
|
|
||||||
#===========================================#
|
#===========================================#
|
||||||
|
@ -750,7 +745,7 @@ def create_database():
|
||||||
'about = "%s"\n'%about + \
|
'about = "%s"\n'%about + \
|
||||||
'author = "%s"\n'%author + \
|
'author = "%s"\n'%author + \
|
||||||
'tags = "%s"\n'%tags + \
|
'tags = "%s"\n'%tags + \
|
||||||
'date = "%s"\n'%date + \
|
'date = "%s"\n'%date_tr + \
|
||||||
'snpic = "%s"\n'%snpic_url + \
|
'snpic = "%s"\n'%snpic_url + \
|
||||||
'\n# Used files\n' + \
|
'\n# Used files\n' + \
|
||||||
'uris = %s'%str(files_post)
|
'uris = %s'%str(files_post)
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#**********************************************************************
|
#**********************************************************************
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import args, logs, dom, form, tyto
|
import args, logs, dom, form, tyto
|
||||||
|
|
||||||
remove = exists = post = corrupt = False
|
remove = exists = post = corrupt = False
|
||||||
|
@ -26,6 +25,7 @@ remove = exists = post = corrupt = False
|
||||||
try: in_dir = os.getcwd()
|
try: in_dir = os.getcwd()
|
||||||
except: logs.out("13", '', True)
|
except: logs.out("13", '', True)
|
||||||
|
|
||||||
|
|
||||||
# target needs db (file).
|
# target needs db (file).
|
||||||
# action like show, wip, edit-db
|
# action like show, wip, edit-db
|
||||||
# not domain, all, again...
|
# not domain, all, again...
|
||||||
|
@ -52,9 +52,7 @@ if args.target \
|
||||||
post = True
|
post = True
|
||||||
hash_post = tyto.get_filesum(uri_file, True)
|
hash_post = tyto.get_filesum(uri_file, True)
|
||||||
else:
|
else:
|
||||||
post = False
|
|
||||||
remove = True
|
remove = True
|
||||||
logs.out("1", uri_file, False)
|
|
||||||
|
|
||||||
# Check if database config is valid (contains values)
|
# Check if database config is valid (contains values)
|
||||||
if exists:
|
if exists:
|
||||||
|
|
|
@ -1,11 +1,27 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# Name: Tyto - Littérateur
|
# Tyto - Littérateur
|
||||||
# Type: DB for domain
|
#
|
||||||
# Description: Search domain datas and get statuses
|
# Copyright (C) 2023 Cyrille Louarn <echolib+tyto@a-lec.org>
|
||||||
# file: dom.py
|
#
|
||||||
# Folder: /var/lib/tyto/program/
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# By echolib (XMPP: im@echolib.re)
|
# it under the terms of the GNU Affero General Public License
|
||||||
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
|
# as published by the Free Software Foundation, either version 3 of the
|
||||||
|
# License, or of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# XMPP: echolib (im@echolib.re)
|
||||||
|
#
|
||||||
|
# Description: Manage domain configuration
|
||||||
|
# File: /var/lib/tyto/program/dom.py
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
#------------
|
#------------
|
||||||
# funny stats
|
# funny stats
|
||||||
|
@ -17,17 +33,99 @@
|
||||||
|
|
||||||
#**********************************************************************
|
#**********************************************************************
|
||||||
|
|
||||||
import os, sys, importlib, locale
|
import os, sys, importlib, langs
|
||||||
|
|
||||||
lib = 'tyto_domain'
|
lib = 'tyto_domain'
|
||||||
exists = incomplete = active = ready = shortname = False
|
exists = incomplete = active = ready = shortname = False
|
||||||
local_user = articles_db = activated = False
|
local_user = articles_db_d = False
|
||||||
hole = False
|
hole = False
|
||||||
|
|
||||||
# Set current directory
|
# Set current directory
|
||||||
try: in_dir = os.getcwd()
|
try: in_dir = os.getcwd()
|
||||||
except: hole = True
|
except: hole = True
|
||||||
|
|
||||||
|
# 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',
|
||||||
|
'footer_about_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_css_f',
|
||||||
|
'wip_logo_f',
|
||||||
|
'wip_navbar_f',
|
||||||
|
'wip_sidebar_f',
|
||||||
|
'wip_metas_f',
|
||||||
|
'wip_footer_f',
|
||||||
|
'www_css_f',
|
||||||
|
'www_navbar_f',
|
||||||
|
'www_sidebar_f',
|
||||||
|
'www_metas_f',
|
||||||
|
'www_footer_f',
|
||||||
|
'www_logo_f',
|
||||||
|
'www_rss_f',
|
||||||
|
'logo',
|
||||||
|
'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',
|
||||||
|
'footer_about_f'
|
||||||
|
)
|
||||||
|
|
||||||
|
err_val = (()) # Make a list from values error
|
||||||
|
file_unu = (()) # Make a list for files to check
|
||||||
|
file_mod = (()) # male a list for modules files to create
|
||||||
|
dir_new = (()) # Make a list for directories created
|
||||||
|
dir_unu = (()) # Not created, unused
|
||||||
|
|
||||||
|
|
||||||
if not hole:
|
if not hole:
|
||||||
home_dir = os.path.expanduser('~')
|
home_dir = os.path.expanduser('~')
|
||||||
|
|
||||||
|
@ -48,112 +146,52 @@ if not hole:
|
||||||
try: shortname
|
try: shortname
|
||||||
except: shortname = config
|
except: shortname = config
|
||||||
|
|
||||||
if activated:
|
try: active = activated
|
||||||
active = True
|
except: pass
|
||||||
# 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',
|
|
||||||
'footer_about_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_navbar_f',
|
|
||||||
'wip_sidebar_f',
|
|
||||||
'wip_metas_f',
|
|
||||||
'wip_footer_f',
|
|
||||||
'www_navbar_f',
|
|
||||||
'www_sidebar_f',
|
|
||||||
'www_metas_f',
|
|
||||||
'www_footer_f',
|
|
||||||
'wip_logo_f',
|
|
||||||
'www_logo_f',
|
|
||||||
'www_rss_f',
|
|
||||||
'logo',
|
|
||||||
'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',
|
|
||||||
'footer_about_f'
|
|
||||||
)
|
|
||||||
|
|
||||||
err_val = (()) # Make a list from values error
|
|
||||||
dir_new = (()) # Make a list for directories to create
|
|
||||||
file_new = (()) # Make a list for files to check
|
|
||||||
file_mod = (()) # male a list for modules files to create
|
|
||||||
for value in dom_values:
|
for value in dom_values:
|
||||||
try:
|
try:
|
||||||
eval(str(value))
|
eval(str(value))
|
||||||
|
value_set = True
|
||||||
except:
|
except:
|
||||||
err_val = err_val + ((value),)
|
err_val = err_val + ((value),)
|
||||||
|
value_set = False
|
||||||
incomplete = True
|
incomplete = True
|
||||||
active = False
|
active = False
|
||||||
|
|
||||||
|
|
||||||
|
if value.endswith('_d'):
|
||||||
|
if value_set:
|
||||||
|
if not os.path.exists(eval(str(value))):
|
||||||
|
try:
|
||||||
|
os.makedirs(eval(str(value)), exist_ok=True)
|
||||||
|
dir_new = dir_new + ((eval(str(value))),)
|
||||||
|
except:
|
||||||
|
dir_unu = dir_unu + ((eval(str(value))),)
|
||||||
|
|
||||||
|
elif value.endswith('_f'):
|
||||||
|
if value_set:
|
||||||
|
if not os.path.exists(eval(str(value))):
|
||||||
|
if value in create_files:
|
||||||
|
file_mod = file_mod + ((value),)
|
||||||
|
else:
|
||||||
|
file_unu = file_unu + ((eval(str(value))),)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#==============================================#
|
#==============================================#
|
||||||
# When an active and complete domain is needed #
|
# When an active and complete domain is needed #
|
||||||
#----------------------------------------------#
|
#----------------------------------------------#
|
||||||
if not incomplete and active:
|
if not incomplete:
|
||||||
|
wip_html_mods = \
|
||||||
|
(
|
||||||
|
eval(str('wip_navbar_f')),
|
||||||
|
eval(str('wip_sidebar_f')),
|
||||||
|
eval(str('wip_metas_f')),
|
||||||
|
eval(str('wip_footer_f'))
|
||||||
|
)
|
||||||
|
if active:
|
||||||
ready = True
|
ready = True
|
||||||
for value in dom_values:
|
|
||||||
# Check if directory exists and create it
|
|
||||||
if value.endswith('_d') and \
|
|
||||||
not os.path.exists(eval(str(value))):
|
|
||||||
os.makedirs(eval(str(value)), exist_ok=True)
|
|
||||||
dir_new = dir_new + ((eval(str(value))),)
|
|
||||||
|
|
||||||
# Check if file exists
|
|
||||||
if value.endswith('_f') and \
|
|
||||||
not os.path.exists(eval(str(value))):
|
|
||||||
if value in create_files:
|
|
||||||
file_mod = file_mod + ((value),)
|
|
||||||
else:
|
|
||||||
file_new = file_new + ((eval(str(value))),)
|
|
||||||
|
|
||||||
|
|
||||||
#====================================#
|
#====================================#
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
#**********************************************************************
|
#**********************************************************************
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import os, sys, locale, importlib
|
import os, sys, re, locale, importlib
|
||||||
|
|
||||||
import logs, dom, tyto, html, show, langs
|
import logs, dom, tyto, html, show, langs
|
||||||
|
|
||||||
|
@ -85,7 +85,6 @@ def asking(question, yes_no):
|
||||||
# target: 3rd argument #
|
# target: 3rd argument #
|
||||||
#--------------------------#
|
#--------------------------#
|
||||||
def manage(target):
|
def manage(target):
|
||||||
|
|
||||||
if not dom.exists:
|
if not dom.exists:
|
||||||
logs.out("43", '', False)
|
logs.out("43", '', False)
|
||||||
create_domain(target)
|
create_domain(target)
|
||||||
|
@ -100,7 +99,10 @@ def manage(target):
|
||||||
# Create a new domain #
|
# Create a new domain #
|
||||||
#---------------------#
|
#---------------------#
|
||||||
def create_domain(target):
|
def create_domain(target):
|
||||||
if target and not target.startswith('http'):
|
valid_url = ('http://', 'https://')
|
||||||
|
invalid = False
|
||||||
|
|
||||||
|
if target and not target.startswith(valid_url):
|
||||||
logs.out("51", '"%s" -> http(s)://...'%target, False)
|
logs.out("51", '"%s" -> http(s)://...'%target, False)
|
||||||
target = ''
|
target = ''
|
||||||
|
|
||||||
|
@ -108,8 +110,6 @@ def create_domain(target):
|
||||||
|
|
||||||
# Get complete URL from target or ask
|
# Get complete URL from target or ask
|
||||||
#------------------------------------
|
#------------------------------------
|
||||||
valid_url = ('http://', 'https://')
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
www_url = dom.www_url
|
www_url = dom.www_url
|
||||||
except:
|
except:
|
||||||
|
@ -176,7 +176,7 @@ def create_domain(target):
|
||||||
|
|
||||||
if answer:
|
if answer:
|
||||||
if len(answer) == 2: lang_logs = answer.lower()
|
if len(answer) == 2: lang_logs = answer.lower()
|
||||||
else: logs.out("3", answer, True)
|
else: logs.out("3", answer, False)
|
||||||
|
|
||||||
if not tyto.exists('%s/logs_%s.py'%(trans_dir, lang_logs)):
|
if not tyto.exists('%s/logs_%s.py'%(trans_dir, lang_logs)):
|
||||||
lang_logs = 'en'
|
lang_logs = 'en'
|
||||||
|
@ -220,23 +220,37 @@ def create_domain(target):
|
||||||
|
|
||||||
# Get srv root
|
# Get srv root
|
||||||
#-------------
|
#-------------
|
||||||
try:
|
try: srv = dom.srv
|
||||||
srv = dom.srv
|
except: srv = '/var/www'
|
||||||
except:
|
|
||||||
if tyto.exists('/var/www') : srv = '/var/www'
|
|
||||||
else: srv = ''
|
|
||||||
|
|
||||||
answer = asking(' ├ %s%s {%s} '%(
|
answer = asking(' ├ %s%s {%s} '%(
|
||||||
langs.site.form_srv, langs.site.q, srv
|
langs.site.form_srv, langs.site.q, srv
|
||||||
), False)
|
), False)
|
||||||
if answer:
|
|
||||||
if tyto.exists(answer): srv = answer
|
|
||||||
else: logs.out("1", srv, True)
|
|
||||||
elif not srv:
|
|
||||||
logs.out("255", '', True)
|
|
||||||
|
|
||||||
if srvl[-1] == "/": srv = srv[:-1]
|
if answer: srv = answer
|
||||||
|
if not tyto.exists(srv):
|
||||||
|
logs.out("1", srv, False)
|
||||||
|
srv = ''
|
||||||
|
invalid = True
|
||||||
|
elif srv[-1] == "/":
|
||||||
|
srv = srv[:-1]
|
||||||
|
|
||||||
|
|
||||||
|
# Get logo's website
|
||||||
|
#-------------------
|
||||||
|
try: logo = dom.logo
|
||||||
|
except: logo = 'logo.png'
|
||||||
|
|
||||||
|
answer = asking(' ├ %s%s {%s} '%(
|
||||||
|
langs.site.form_logo, langs.site.q, logo
|
||||||
|
), False)
|
||||||
|
|
||||||
|
if answer: logo = answer
|
||||||
|
if not logo: logo='logo.png'
|
||||||
|
|
||||||
|
|
||||||
|
# Set config's directories for servers
|
||||||
|
#-------------------------------------
|
||||||
root_srv_dom = '%s/%s'%(srv, shortname)
|
root_srv_dom = '%s/%s'%(srv, shortname)
|
||||||
srv_wip_tpl = "%s/wip/template/"%root_srv_dom
|
srv_wip_tpl = "%s/wip/template/"%root_srv_dom
|
||||||
srv_www_tpl = "%s/www/template/"%root_srv_dom
|
srv_www_tpl = "%s/www/template/"%root_srv_dom
|
||||||
|
@ -252,11 +266,17 @@ def create_domain(target):
|
||||||
'srv_www_images_d = "%s/www/images/"\n'%root_srv_dom + \
|
'srv_www_images_d = "%s/www/images/"\n'%root_srv_dom + \
|
||||||
'srv_www_files_d = "%s/www/files/"\n'%root_srv_dom + \
|
'srv_www_files_d = "%s/www/files/"\n'%root_srv_dom + \
|
||||||
'\n' + \
|
'\n' + \
|
||||||
'# Servers files\n' + \
|
'# Servers files (wip)\n' + \
|
||||||
|
'wip_logo_f = "%s%s"\n'%(srv_wip_tpl, logo) + \
|
||||||
|
'wip_css_f = "%sstyles.css"\n'%srv_wip_tpl + \
|
||||||
'wip_navbar_f = "%snavbar.html"\n'%srv_wip_tpl + \
|
'wip_navbar_f = "%snavbar.html"\n'%srv_wip_tpl + \
|
||||||
'wip_sidebar_f = "%ssidebar.html"\n'%srv_wip_tpl + \
|
'wip_sidebar_f = "%ssidebar.html"\n'%srv_wip_tpl + \
|
||||||
'wip_metas_f = "%smetas.html"\n'%srv_wip_tpl + \
|
'wip_metas_f = "%smetas.html"\n'%srv_wip_tpl + \
|
||||||
'wip_footer_f = "%sfooter.html"\n'%srv_wip_tpl + \
|
'wip_footer_f = "%sfooter.html"\n'%srv_wip_tpl + \
|
||||||
|
'\n' + \
|
||||||
|
'# Servers files (www)\n' + \
|
||||||
|
'www_logo_f = "%s%s"\n'%(srv_www_tpl, logo) + \
|
||||||
|
'www_css_f = "%sstyles.css"\n'%srv_www_tpl + \
|
||||||
'www_navbar_f = "%snavbar.html"\n'%srv_www_tpl + \
|
'www_navbar_f = "%snavbar.html"\n'%srv_www_tpl + \
|
||||||
'www_sidebar_f = "%ssidebar.html"\n'%srv_www_tpl + \
|
'www_sidebar_f = "%ssidebar.html"\n'%srv_www_tpl + \
|
||||||
'www_metas_f = "%smetas.html"\n'%srv_www_tpl + \
|
'www_metas_f = "%smetas.html"\n'%srv_www_tpl + \
|
||||||
|
@ -265,23 +285,6 @@ def create_domain(target):
|
||||||
tyto.set_file(dom.config, False, set_f)
|
tyto.set_file(dom.config, False, set_f)
|
||||||
|
|
||||||
|
|
||||||
# Get logo's website
|
|
||||||
#-------------------
|
|
||||||
try: logo = dom.logo
|
|
||||||
except: logo = 'logo.png'
|
|
||||||
|
|
||||||
answer = asking(' ├ %s%s {%s} '%(
|
|
||||||
langs.site.form_logo, langs.site.q, logo
|
|
||||||
), False)
|
|
||||||
|
|
||||||
if answer: logo = answer
|
|
||||||
|
|
||||||
set_f = 'wip_logo_f = "%s%s"\n'%(srv_wip_tpl, logo) + \
|
|
||||||
'www_logo_f = "%s%s"'%(srv_www_tpl, logo)
|
|
||||||
|
|
||||||
tyto.set_file(dom.config, False, set_f)
|
|
||||||
|
|
||||||
|
|
||||||
# RSS/Atom filename
|
# RSS/Atom filename
|
||||||
#------------------
|
#------------------
|
||||||
try: rss = dom.rss
|
try: rss = dom.rss
|
||||||
|
@ -304,15 +307,15 @@ def create_domain(target):
|
||||||
# RSS/Atom max items
|
# RSS/Atom max items
|
||||||
#-------------------
|
#-------------------
|
||||||
try: rss_items = dom.rss_items
|
try: rss_items = dom.rss_items
|
||||||
except: rss_items = "100"
|
except: rss_items = 100
|
||||||
|
|
||||||
answer = asking(' ├ %s%s {%s} '%(
|
answer = asking(' ├ %s%s {%s} '%(
|
||||||
langs.site.form_rss_i, langs.site.q, rss_items
|
langs.site.form_rss_i, langs.site.q, rss_items
|
||||||
), False)
|
), False)
|
||||||
|
|
||||||
if answer:
|
if answer: rss_items = answer
|
||||||
if answer.isdigit() and int(answer) > 1: rss_items = answer
|
if not str(rss_items).isdigit() or not int(rss_items) > 1:
|
||||||
else: logs.out("3", answer, True)
|
rss_items = 100
|
||||||
|
|
||||||
set_f = 'rss_items = %d'%int(rss_items)
|
set_f = 'rss_items = %d'%int(rss_items)
|
||||||
tyto.set_file(dom.config, False, set_f)
|
tyto.set_file(dom.config, False, set_f)
|
||||||
|
@ -328,9 +331,8 @@ def create_domain(target):
|
||||||
), False)
|
), False)
|
||||||
|
|
||||||
if answer: title = answer
|
if answer: title = answer
|
||||||
elif not title: logs.out("255", '', True)
|
if not title: invalid = True
|
||||||
|
elif '"' in title: title = title.replace('"', '')
|
||||||
if '"' in title: title = title.replace('"', '')
|
|
||||||
|
|
||||||
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)
|
||||||
|
@ -361,9 +363,8 @@ def create_domain(target):
|
||||||
), False)
|
), False)
|
||||||
|
|
||||||
if answer: about = answer
|
if answer: about = answer
|
||||||
elif not about: logs.out("255", '', True)
|
if not about: invalid = True
|
||||||
|
elif '"' in about: about = about.replace('"', '')
|
||||||
if '"' in about: about = about.replace('"', '')
|
|
||||||
|
|
||||||
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)
|
||||||
|
@ -371,13 +372,16 @@ def create_domain(target):
|
||||||
|
|
||||||
# Get Lang domain for web pages
|
# Get Lang domain for web pages
|
||||||
#------------------------------
|
#------------------------------
|
||||||
|
try: lang_site
|
||||||
|
except: lang_site = lang_sys
|
||||||
|
|
||||||
answer = asking(' ├ %s%s {%s} '%(
|
answer = asking(' ├ %s%s {%s} '%(
|
||||||
langs.site.form_trsite, langs.site.q, lang_site
|
langs.site.form_trsite, langs.site.q, lang_site
|
||||||
), False)
|
), False)
|
||||||
|
|
||||||
if answer:
|
if answer:
|
||||||
if len(answer) == 2: lang_site = answer.lower()
|
if len(answer) == 2: lang_site = answer.lower()
|
||||||
else: logs.out("3", answer, True)
|
else: logs.out("3", answer, False)
|
||||||
|
|
||||||
if not tyto.exists('%s/site_%s.py'%(trans_dir, lang_site)):
|
if not tyto.exists('%s/site_%s.py'%(trans_dir, lang_site)):
|
||||||
lang_site = 'en'
|
lang_site = 'en'
|
||||||
|
@ -396,10 +400,9 @@ def create_domain(target):
|
||||||
), False)
|
), False)
|
||||||
|
|
||||||
if answer: mail = answer
|
if answer: mail = answer
|
||||||
elif not mail: logs.out("255", '', True)
|
|
||||||
|
|
||||||
if not re.search('^\w+@\w+.\w+$', mail):
|
if not re.search('^\w+@\w+.\w+$', mail):
|
||||||
logs.out("3", mail, True)
|
logs.out("3", mail, False)
|
||||||
|
invalid = True
|
||||||
|
|
||||||
set_f = 'mail = "%s"'%mail
|
set_f = 'mail = "%s"'%mail
|
||||||
tyto.set_file(dom.config, False, set_f)
|
tyto.set_file(dom.config, False, set_f)
|
||||||
|
@ -415,9 +418,8 @@ def create_domain(target):
|
||||||
), False)
|
), False)
|
||||||
|
|
||||||
if answer: tags = answer
|
if answer: tags = answer
|
||||||
elif not tags: logs.out("255", '', True)
|
if not tags: invalid = True
|
||||||
|
elif '"' in tags: tags = tags.replace('"', '')
|
||||||
if '"' in tags: tags = tags.replace('"', '')
|
|
||||||
|
|
||||||
set_f = 'tags = "%s"'%tags
|
set_f = 'tags = "%s"'%tags
|
||||||
tyto.set_file(dom.config, False, set_f)
|
tyto.set_file(dom.config, False, set_f)
|
||||||
|
@ -433,8 +435,6 @@ def create_domain(target):
|
||||||
), False)
|
), False)
|
||||||
|
|
||||||
if answer: domlicense = answer
|
if answer: domlicense = answer
|
||||||
elif not domlicense: logs.out("255", '', True)
|
|
||||||
|
|
||||||
if '"' in domlicense: domlicense = domlicense.replace('"', '')
|
if '"' in domlicense: domlicense = domlicense.replace('"', '')
|
||||||
|
|
||||||
set_f = 'license = "%s"'%domlicense
|
set_f = 'license = "%s"'%domlicense
|
||||||
|
@ -451,9 +451,11 @@ def create_domain(target):
|
||||||
langs.site.q, licurl
|
langs.site.q, licurl
|
||||||
), False)
|
), False)
|
||||||
|
|
||||||
|
if answer: licurl = answer
|
||||||
|
if not licurl.startswith(valid_url):
|
||||||
if answer:
|
if answer:
|
||||||
if answer.startswith(valid_url): licurl = answer
|
logs.out("2", '"http(s)://%s"%s'%(licurl, langs.site.q), False)
|
||||||
else: logs.out("2", '"http(s)://%s"%s'%(answer, langs.site.q), True)
|
licurl = ''
|
||||||
|
|
||||||
set_f = 'license_url = "%s"'%licurl
|
set_f = 'license_url = "%s"'%licurl
|
||||||
tyto.set_file(dom.config, False, set_f)
|
tyto.set_file(dom.config, False, set_f)
|
||||||
|
@ -469,9 +471,11 @@ def create_domain(target):
|
||||||
langs.site.q, legalurl
|
langs.site.q, legalurl
|
||||||
), False)
|
), False)
|
||||||
|
|
||||||
|
if answer: legalurl = answer
|
||||||
|
if not legalurl.startswith(valid_url):
|
||||||
if answer:
|
if answer:
|
||||||
if answer.startswith(valid_url): legalurl = answer
|
logs.out("2", '"http(s)://%s"%s'%(legalurl, langs.site.q), False)
|
||||||
else: logs.out("2", '"http(s)://%s"%s'%(answer, langs.site.q), True)
|
legalurl = ''
|
||||||
|
|
||||||
set_f = 'legal_url = "%s"'%legalurl
|
set_f = 'legal_url = "%s"'%legalurl
|
||||||
tyto.set_file(dom.config, False, set_f)
|
tyto.set_file(dom.config, False, set_f)
|
||||||
|
@ -487,9 +491,11 @@ def create_domain(target):
|
||||||
langs.site.q, termsurl
|
langs.site.q, termsurl
|
||||||
), False)
|
), False)
|
||||||
|
|
||||||
|
if answer: termsurl = answer
|
||||||
|
if not termsurl.startswith(valid_url):
|
||||||
if answer:
|
if answer:
|
||||||
if answer.startswith(valid_url): termsurl = answer
|
logs.out("2", '"http(s)://%s"%s'%(termsurl, langs.site.q), False)
|
||||||
else: logs.out("2", '"http(s)://%s"%s'%(answer, langs.site.q), True)
|
termsurl = ''
|
||||||
|
|
||||||
set_f = 'terms_url = "%s"'%termsurl
|
set_f = 'terms_url = "%s"'%termsurl
|
||||||
tyto.set_file(dom.config, False, set_f)
|
tyto.set_file(dom.config, False, set_f)
|
||||||
|
@ -505,7 +511,9 @@ def create_domain(target):
|
||||||
), False)
|
), False)
|
||||||
|
|
||||||
if answer: css = answer.lower()
|
if answer: css = answer.lower()
|
||||||
if not css.isalnum(): logs.out("3", css, True)
|
if not css.isalnum():
|
||||||
|
logs.out("3", css, False)
|
||||||
|
css = 'tyto'
|
||||||
|
|
||||||
set_f = 'css = "%s"'%css
|
set_f = 'css = "%s"'%css
|
||||||
tyto.set_file(dom.config, False, set_f)
|
tyto.set_file(dom.config, False, set_f)
|
||||||
|
@ -521,7 +529,9 @@ def create_domain(target):
|
||||||
), False)
|
), False)
|
||||||
|
|
||||||
if answer: sep = answer
|
if answer: sep = answer
|
||||||
if not len(sep) == 1: logs.out("3", answer, True)
|
if not len(sep) == 1:
|
||||||
|
logs.out("3", answer, False)
|
||||||
|
sep = "-"
|
||||||
|
|
||||||
set_f = 'sep = "%s"'%sep
|
set_f = 'sep = "%s"'%sep
|
||||||
tyto.set_file(dom.config, False, set_f)
|
tyto.set_file(dom.config, False, set_f)
|
||||||
|
@ -557,9 +567,11 @@ def create_domain(target):
|
||||||
langs.site.q, relme
|
langs.site.q, relme
|
||||||
), False)
|
), False)
|
||||||
|
|
||||||
|
if answer: relme = answer
|
||||||
|
if not relme.startswith(valid_url):
|
||||||
if answer:
|
if answer:
|
||||||
if answer.startswith(valid_url): relme = answer
|
logs.out("2", '"http(s)://%s"%s'%(relme, langs.site.q), False)
|
||||||
else: logs.out("2", '"http(s)://%s"%s'%(answer, langs.site.q), True)
|
relmel = ''
|
||||||
|
|
||||||
set_f = 'relme = "%s"'%relme
|
set_f = 'relme = "%s"'%relme
|
||||||
tyto.set_file(dom.config, False, set_f)
|
tyto.set_file(dom.config, False, set_f)
|
||||||
|
@ -576,7 +588,10 @@ def create_domain(target):
|
||||||
), False)
|
), False)
|
||||||
|
|
||||||
if answer: sdb_title = answer
|
if answer: sdb_title = answer
|
||||||
if '"' in sdb_title: sdb_title = sdb_title.replace('"', '')
|
if not sdb_title:
|
||||||
|
sdb_title = ''
|
||||||
|
invalid = True
|
||||||
|
elif '"' in sdb_title: sdb_title = sdb_title.replace('"', '')
|
||||||
|
|
||||||
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)
|
||||||
|
@ -585,22 +600,27 @@ def create_domain(target):
|
||||||
# Sidebar Items
|
# Sidebar Items
|
||||||
#--------------
|
#--------------
|
||||||
try: sdb_items = dom.sidebar_items
|
try: sdb_items = dom.sidebar_items
|
||||||
except: sdb_items = "6"
|
except: sdb_items = 6
|
||||||
|
|
||||||
answer = asking(' ├ [max=16] %s. %s%s {%s} '%(
|
answer = asking(' ├ [max=16] %s. %s%s {%s} '%(
|
||||||
langs.site.sidebar, langs.site.form_sdb_i,
|
langs.site.sidebar, langs.site.form_sdb_i,
|
||||||
langs.site.q, sdb_items
|
langs.site.q, sdb_items
|
||||||
), False)
|
), False)
|
||||||
|
|
||||||
if answer:
|
if answer: sdb_items = answer
|
||||||
if answer.isdigit() and int(answer) in range(1,17):
|
if not str(sdb_items).isdigit() or not int(sdb_items) in range(1,17):
|
||||||
sdb_items = int(answer)
|
sdb_items = 6
|
||||||
else: logs.out("3", answer, True)
|
|
||||||
|
|
||||||
set_f = 'sidebar_items = %d'%int(sdb_items)
|
set_f = 'sidebar_items = %d'%int(sdb_items)
|
||||||
tyto.set_file(dom.config, False, set_f)
|
tyto.set_file(dom.config, False, set_f)
|
||||||
|
|
||||||
|
|
||||||
|
# Domain config invalid, do not activate
|
||||||
|
if invalid:
|
||||||
|
tyto.set_file(dom.config, False, '\nactivated = False')
|
||||||
|
print(langs.site.form_inv)
|
||||||
|
logs.out("2", dom.config, True)
|
||||||
|
|
||||||
# Resumed configuration
|
# Resumed configuration
|
||||||
#-----------------------
|
#-----------------------
|
||||||
try: active = dom.activated
|
try: active = dom.activated
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
# XMPP: echolib (im@echolib.re)
|
# XMPP: echolib (im@echolib.re)
|
||||||
#
|
#
|
||||||
# Description: Create HTML page
|
# Description: Create HTML page
|
||||||
# File: /var/lib/tyto/program/show.py
|
# File: /var/lib/tyto/program/html.py
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
#------------
|
#------------
|
||||||
|
@ -33,7 +33,6 @@
|
||||||
#**********************************************************************
|
#**********************************************************************
|
||||||
|
|
||||||
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
|
||||||
|
@ -62,8 +61,7 @@ def create_metas_page():
|
||||||
metas_page = ''
|
metas_page = ''
|
||||||
scale = 'width=device-width, initial-scale=1.0'
|
scale = 'width=device-width, initial-scale=1.0'
|
||||||
all_tags = dom.tags + ',' + db.tags
|
all_tags = dom.tags + ',' + db.tags
|
||||||
css_file = 'styles.css'
|
css_ref = 'href="%stemplate/%s"'%(db.sub_uri, dom.css)
|
||||||
css_ref = 'href="%stemplate/%s"'%(db.sub_uri, css_file)
|
|
||||||
rss_ref = 'type="application/rss+xml" ' + \
|
rss_ref = 'type="application/rss+xml" ' + \
|
||||||
'href="%s%s" title="RSS 2.0. %s %s %s"'%(
|
'href="%s%s" title="RSS 2.0. %s %s %s"'%(
|
||||||
db.sub_uri, dom.rss,
|
db.sub_uri, dom.rss,
|
||||||
|
@ -80,7 +78,7 @@ def create_metas_page():
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create author and date publish section infos
|
# Create author and date publish section infos
|
||||||
create_html_infos_section('wip')
|
create_html_time_meta('wip')
|
||||||
|
|
||||||
# Set all raw HTML metas
|
# Set all raw HTML metas
|
||||||
#-----------------------
|
#-----------------------
|
||||||
|
@ -117,19 +115,14 @@ def create_metas_page():
|
||||||
# Set main page, with all HTML sections #
|
# Set main page, with all HTML sections #
|
||||||
#---------------------------------------#
|
#---------------------------------------#
|
||||||
def create_main_page(target, article_bottom):
|
def create_main_page(target, article_bottom):
|
||||||
global main_page
|
global main_page, post_html_code
|
||||||
|
|
||||||
if not tyto.exists(dom.wip_footer_f):
|
|
||||||
logs.out("1", dom.wip_footer_f, True)
|
|
||||||
|
|
||||||
if not tyto.exists(dom.wip_metas_f):
|
|
||||||
logs.out("24", '(HTML metas): %s'%dom.wip_metas_f, False)
|
|
||||||
|
|
||||||
# Create link for website's logo
|
# Create link for website's logo
|
||||||
#-------------------------------
|
#-------------------------------
|
||||||
logo_html = '<a href="/"\n' + \
|
logo_html = \
|
||||||
|
'<a href="/"\n' + \
|
||||||
'%stitle="%s %s logo: %s"\n'%(11 * " ",
|
'%stitle="%s %s logo: %s"\n'%(11 * " ",
|
||||||
tyto.trans[1][tyto.n], dom.sep, dom.title
|
langs.site.home, dom.sep, dom.title
|
||||||
) + \
|
) + \
|
||||||
'%sid="site_logo_link">\n'%(11 * " ") + \
|
'%sid="site_logo_link">\n'%(11 * " ") + \
|
||||||
'%s<img src="%stemplate/%s"\n'%(
|
'%s<img src="%stemplate/%s"\n'%(
|
||||||
|
@ -139,6 +132,17 @@ def create_main_page(target, article_bottom):
|
||||||
'%sid="site_logo_image" />\n'%(15 * " ") + \
|
'%sid="site_logo_image" />\n'%(15 * " ") + \
|
||||||
'%s</a>'%(8 * " ")
|
'%s</a>'%(8 * " ")
|
||||||
|
|
||||||
|
post_html_code = ''
|
||||||
|
if dom.article_code:
|
||||||
|
post_html_code = \
|
||||||
|
' <span id="article_code"> ' + \
|
||||||
|
' <a id="article_code_link"\n' + \
|
||||||
|
' href="./%s"\n'%os.path.basename(db.short_src) + \
|
||||||
|
' title="%s">{%s}</a></span>\n'%(
|
||||||
|
langs.site.tyto_psrc,
|
||||||
|
langs.site.source_code
|
||||||
|
)
|
||||||
|
|
||||||
#-----------------------#
|
#-----------------------#
|
||||||
# Create main HTML Page #
|
# Create main HTML Page #
|
||||||
#-----------------------#
|
#-----------------------#
|
||||||
|
@ -156,7 +160,7 @@ def create_main_page(target, article_bottom):
|
||||||
'\n' + \
|
'\n' + \
|
||||||
' <div id="site_infos">\n' + \
|
' <div id="site_infos">\n' + \
|
||||||
' <a href="/"\n' + \
|
' <a href="/"\n' + \
|
||||||
' title="%s"\n'%(tyto.trans[1][tyto.n]) + \
|
' title="%s"\n'%(langs.site.home) + \
|
||||||
' id="site_link">\n' + \
|
' id="site_link">\n' + \
|
||||||
' <h1 id="site_title">%s</h1>\n'%dom.title + \
|
' <h1 id="site_title">%s</h1>\n'%dom.title + \
|
||||||
' </a>\n' + \
|
' </a>\n' + \
|
||||||
|
@ -167,7 +171,17 @@ def create_main_page(target, article_bottom):
|
||||||
'\n' + \
|
'\n' + \
|
||||||
' <article id="article_main">\n' + \
|
' <article id="article_main">\n' + \
|
||||||
' <section id="article_infos">\n' + \
|
' <section id="article_infos">\n' + \
|
||||||
'%s\n'%post_pub + \
|
' <p>\n' + \
|
||||||
|
' <span id="article_title"\n' + \
|
||||||
|
' title="%s %s %s %s %s">%s</span>\n'%(
|
||||||
|
title, langs.site.w_written, db.date, langs.site.by,
|
||||||
|
db.author,
|
||||||
|
langs.site.article
|
||||||
|
) + \
|
||||||
|
'%s'%post_html_code + \
|
||||||
|
'%s\n'%time_html_pub + \
|
||||||
|
' <span id="article_author">%s</span>\n'%db.author + \
|
||||||
|
' </p>\n' + \
|
||||||
' </section>\n' + \
|
' </section>\n' + \
|
||||||
'%s\n'%article_bottom + \
|
'%s\n'%article_bottom + \
|
||||||
' </article>\n' + \
|
' </article>\n' + \
|
||||||
|
@ -182,11 +196,12 @@ def create_main_page(target, article_bottom):
|
||||||
# Create HTML line for article infos section #
|
# Create HTML line for article infos section #
|
||||||
# when wip, and publish #
|
# when wip, and publish #
|
||||||
#--------------------------------------------#
|
#--------------------------------------------#
|
||||||
def create_html_infos_section(process):
|
def create_html_time_meta(process):
|
||||||
# Need to reload the DB to get last time updated
|
# Need to reload the DB to get last time updated
|
||||||
exec(open(db.config).read(), globals())
|
exec(open(db.config).read(), globals())
|
||||||
|
|
||||||
global post_pub, meta_pub, date_raw
|
global time_html_pub, meta_pub, date_raw
|
||||||
|
|
||||||
if process == 'wip':
|
if process == 'wip':
|
||||||
date_raw = date_wip # <time datetime= / meta search_date
|
date_raw = date_wip # <time datetime= / meta search_date
|
||||||
date_pub = date_wip.rsplit(' ')[0]
|
date_pub = date_wip.rsplit(' ')[0]
|
||||||
|
@ -196,47 +211,25 @@ def create_html_infos_section(process):
|
||||||
date_pub = date_www.rsplit(' ')[0]
|
date_pub = date_www.rsplit(' ')[0]
|
||||||
time_pub = date_www.rsplit(' ')[1]
|
time_pub = date_www.rsplit(' ')[1]
|
||||||
|
|
||||||
if tyto.n == 0: # fr
|
if dom.lang_site == 'fr':
|
||||||
date_new = date_pub.rsplit('-')
|
date_new = date_pub.rsplit('-')
|
||||||
date_pub = date_new[2] + '/' + date_new[1] + '/' + date_new[0]
|
date_pub = date_new[2] + '/' + date_new[1] + '/' + date_new[0]
|
||||||
|
|
||||||
# Show source code in article-infos if True in DB
|
|
||||||
post_code = ''
|
|
||||||
if dom.article_code:
|
|
||||||
# Set HTML
|
|
||||||
post_code = \
|
|
||||||
'<span id="article_code"> ' + \
|
|
||||||
'<a id="article_code_link" href="./%s" title="%s">{%s}</a>'%(
|
|
||||||
os.path.basename(db.short_src),
|
|
||||||
tyto.trans[21][tyto.n],
|
|
||||||
tyto.trans[3][tyto.n]
|
|
||||||
) + \
|
|
||||||
' </span>'
|
|
||||||
|
|
||||||
|
|
||||||
# in <article> > section info : line with new date
|
# in <article> > section info : line with new date
|
||||||
post_pub = \
|
time_html_pub = \
|
||||||
'%s<p>'%(8 * ' ') + \
|
' <!--TYTOPUB-->\n' + \
|
||||||
'<span id="article_title" title="%s">Article%s</span> '%(title,
|
' <time datetime="%s">\n'%date_raw + \
|
||||||
post_code
|
' <span id="article_pub"\n' + \
|
||||||
|
' title="%s %s %s">%s %s (%s)</span>\n'%(
|
||||||
|
title, langs.site.w_published, date_pub,
|
||||||
|
langs.site.published, date_pub, time_pub
|
||||||
) + \
|
) + \
|
||||||
'<span title="%s %s">%s</span> '%(tyto.trans[10][tyto.n],
|
' </time> %s\n'%langs.site.by + \
|
||||||
date[0],
|
' <!--/TYTOPUB-->'
|
||||||
tyto.trans[7][tyto.n]
|
|
||||||
) + \
|
|
||||||
'<span id="article_author">%s</span>. %s '%(author,
|
|
||||||
tyto.trans[8][tyto.n]
|
|
||||||
) + \
|
|
||||||
'<time datetime="%s">'%date_raw + \
|
|
||||||
'<span id="article_date">%s</span> %s '%(date_pub,
|
|
||||||
tyto.trans[9][tyto.n]
|
|
||||||
) + \
|
|
||||||
'<span id="article_time">%s</span>'%time_pub + \
|
|
||||||
'</time>' + \
|
|
||||||
'</p>'
|
|
||||||
|
|
||||||
# meta search_date=
|
# meta search_date=
|
||||||
meta_pub = ' <meta name="search_date" content="%s" />\n'%(
|
meta_pub = \
|
||||||
|
' <meta name="search_date" content="%s" />\n'%(
|
||||||
date_raw.rsplit(' ')[0]
|
date_raw.rsplit(' ')[0]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -271,15 +264,14 @@ def create_user_metas(option):
|
||||||
else: user_metas = '%s%s'%(tab, line)
|
else: user_metas = '%s%s'%(tab, line)
|
||||||
|
|
||||||
tyto.set_file(target, True, user_metas)
|
tyto.set_file(target, True, user_metas)
|
||||||
logs.out("33", target, False)
|
logs.out("32", target, False)
|
||||||
|
|
||||||
|
|
||||||
#==================================#
|
#==============================================#
|
||||||
# Create HTML navbar from config #
|
# Create HTML sidebar from file tyto.navbar #
|
||||||
# If no index in src: STOP #
|
# If no index file in src directory: pass # #
|
||||||
# For wip, create if no index.html #
|
# Create empty file in template/ if not exists #
|
||||||
# for publish all/navbar, STOP #
|
#----------------------------------------------#
|
||||||
#----------------------------------#
|
|
||||||
def create_navbar(option):
|
def create_navbar(option):
|
||||||
dom.valid()
|
dom.valid()
|
||||||
|
|
||||||
|
@ -297,7 +289,7 @@ def create_navbar(option):
|
||||||
'%s<nav id="site_menu">\n'%(6 * ' ') + \
|
'%s<nav id="site_menu">\n'%(6 * ' ') + \
|
||||||
'%s<ul id="site_menu_items">'%(8 * ' ')
|
'%s<ul id="site_menu_items">'%(8 * ' ')
|
||||||
|
|
||||||
navbar_lines = open(db.navbar_load, 'r').read()
|
navbar_lines = open(dom.navbar_f, 'r').read()
|
||||||
|
|
||||||
for line in navbar_lines.rsplit('\n'):
|
for line in navbar_lines.rsplit('\n'):
|
||||||
if not line or line.startswith(nolines): continue
|
if not line or line.startswith(nolines): continue
|
||||||
|
@ -368,7 +360,6 @@ def create_navbar(option):
|
||||||
if not tyto.exists(target):
|
if not tyto.exists(target):
|
||||||
tyto.set_file(target, 'New', '')
|
tyto.set_file(target, 'New', '')
|
||||||
logs.out("32", target, False)
|
logs.out("32", target, False)
|
||||||
return
|
|
||||||
logs.out('28', '%s'%langs.log.navbar, False)
|
logs.out('28', '%s'%langs.log.navbar, False)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -387,9 +378,10 @@ def create_navbar(option):
|
||||||
logs.out("32", target, False)
|
logs.out("32", target, False)
|
||||||
|
|
||||||
|
|
||||||
#============================================#
|
#==============================================#
|
||||||
# Create HTML sidebar from file tyto.sidebar #
|
# Create HTML sidebar from file tyto.sidebar #
|
||||||
#--------------------------------------------#
|
# Create empty file in template/ if not exists #
|
||||||
|
#----------------------------------------------#
|
||||||
def create_sidebar(option):
|
def create_sidebar(option):
|
||||||
dom.valid()
|
dom.valid()
|
||||||
|
|
||||||
|
@ -406,7 +398,7 @@ def create_sidebar(option):
|
||||||
# Set HTML sidebar
|
# Set HTML sidebar
|
||||||
sidebar_list = ''
|
sidebar_list = ''
|
||||||
sidebar_html = \
|
sidebar_html = \
|
||||||
'<aside>\n' + \
|
'<aside id="sidebar">\n' + \
|
||||||
' <h1 id="sidebar_title">%s</h1>\n' + \
|
' <h1 id="sidebar_title">%s</h1>\n' + \
|
||||||
' <ul id="sidebar_list">\n' + \
|
' <ul id="sidebar_list">\n' + \
|
||||||
'%s' + \
|
'%s' + \
|
||||||
|
@ -485,7 +477,6 @@ def create_sidebar(option):
|
||||||
if not tyto.exists(target):
|
if not tyto.exists(target):
|
||||||
tyto.set_file(target, 'New', '')
|
tyto.set_file(target, 'New', '')
|
||||||
logs.out("32", target, False)
|
logs.out("32", target, False)
|
||||||
return
|
|
||||||
logs.out('28', '%s'%langs.log.sidebar, False)
|
logs.out('28', '%s'%langs.log.sidebar, False)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -511,16 +502,14 @@ def create_sidebar(option):
|
||||||
|
|
||||||
#===================================================#
|
#===================================================#
|
||||||
# Create footer.html from _configs/tyto.footer.html #
|
# Create footer.html from _configs/tyto.footer.html #
|
||||||
# Opiton 'pub' force create (when publish) #
|
#----------------------------------------------=====#
|
||||||
#---------------------------------------------------#
|
|
||||||
def create_user_footer(option):
|
def create_user_footer(option):
|
||||||
dom.valid()
|
dom.valid()
|
||||||
|
|
||||||
if option == 'wip': target = dom.wip_footer_f
|
if option == 'wip': target = dom.wip_footer_f
|
||||||
elif option == 'www': target = dom.www_footer_f
|
elif option in pub_opts: target = dom.www_footer_f
|
||||||
elif option == 'pub': target = dom.www_footer_f
|
|
||||||
|
|
||||||
if not option == 'pub' and tyto.exists(target):
|
if option == 'www' and tyto.exists(target):
|
||||||
form.asking(' ├ %s. %s%s '%(
|
form.asking(' ├ %s. %s%s '%(
|
||||||
langs.site.footer, langs.site.form_rep, langs.site.q
|
langs.site.footer, langs.site.form_rep, langs.site.q
|
||||||
), True)
|
), True)
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
#**********************************************************************
|
#**********************************************************************
|
||||||
|
|
||||||
import os
|
import os, langs
|
||||||
|
|
||||||
def tyto(target):
|
def tyto(target):
|
||||||
noinfos = False
|
noinfos = False
|
||||||
|
@ -46,51 +46,5 @@ def tyto(target):
|
||||||
noinfo = True
|
noinfo = True
|
||||||
print(':< No .../.local/tyto')
|
print(':< No .../.local/tyto')
|
||||||
|
|
||||||
# Show Usage
|
print(':', langs.site.args_helps)
|
||||||
print(
|
|
||||||
'\n# New domain:\n'
|
|
||||||
' - Create your domain folder, and go in\n'
|
|
||||||
' - Create domain with "tyto new domain [URL]"\n'
|
|
||||||
' - Create article\'s file in articles/ directory\n'
|
|
||||||
' - Use these actions on article\'s file: Check > wip > publish\n'
|
|
||||||
' ! Config\'s files are in _configs/ directory\n'
|
|
||||||
' and used to create HTML file in your template\n'
|
|
||||||
' Your template files (css, logo...) go to wip/template/ server\n\n'
|
|
||||||
'# Usage: tyto [action] [target] \n'
|
|
||||||
' - [action] according to [target]:\n'
|
|
||||||
' edit : Edit article\'s file\n'
|
|
||||||
' edit-db : Edit article\'s database (TAKE CARE !)\n'
|
|
||||||
' edit-wip: Edit html file in wip server\n'
|
|
||||||
' edit_www: Edit html file in www server\n'
|
|
||||||
' new : Create new (domain, sidebar/footer... config\'s file)\n'
|
|
||||||
' show : Show content of config\'s file\n'
|
|
||||||
' show-about: Show content of custom footer config\n'
|
|
||||||
' show-db : Show content of article\'s database\n'
|
|
||||||
' show-wip: Show HTML file in wip server\n'
|
|
||||||
' show-www: Show HTML file in www server\n\n'
|
|
||||||
' check : Check if article is valid\n'
|
|
||||||
' wip : Create page in wip server\n'
|
|
||||||
' publish : Create page in www server\n\n'
|
|
||||||
' - [target] according to [action]\n'
|
|
||||||
' all : process (updated) valid articles\n'
|
|
||||||
' again : process ALL valid articles\n'
|
|
||||||
' newer : [wip/publish] convert only newer articles\n'
|
|
||||||
' template: - Create navbar/sidebar/metas/footer in www server\n'
|
|
||||||
' - Copy other wip/template/ files to www server\n'
|
|
||||||
' domain : Create/Show config file\n'
|
|
||||||
' [file] : URI of an article\'s file (autocompletion is your friend)\n'
|
|
||||||
' footer : Create/Show footer HTML config\'s file\n'
|
|
||||||
' metas : Create/Show metas HTML config\'s file\n'
|
|
||||||
' navbar : Create/Show navbar config\'s file\n'
|
|
||||||
' sidebar : Create/Show sidebar config\'s file\n'
|
|
||||||
' stats : Create statistics file in root srv\n\n'
|
|
||||||
'# Examples:\n'
|
|
||||||
' - Check article\'s syntax: tyto check mysubdir/index.tyto\n'
|
|
||||||
' - Create default _configs/tyto.sidebar: tyto new sidebar\n'
|
|
||||||
' - Edit _configs/tyto.navbar: tyto edit navbar\n'
|
|
||||||
' - Edit index.html in www server: tyto edit-www index.tyto\n'
|
|
||||||
' - Create sidebar.html in wip server: tyto wip sidebar\n'
|
|
||||||
' - Show sidebar.html in wip server: tyto show-wip sidebar\n'
|
|
||||||
' - Create navbar.html in www server: tyto publish navbar\n'
|
|
||||||
' - Show navbar.html in www server: tyto show-www navbar\n'
|
|
||||||
)
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ def out(nbr, value, out):
|
||||||
'6' : ' ╞ %s%s%s > %s'%(CR, langs.log.sep_inv, CS, value),
|
'6' : ' ╞ %s%s%s > %s'%(CR, langs.log.sep_inv, CS, value),
|
||||||
'7' : ' ╘ %s%s%s > %s'%(CR, langs.log.post_inv, CS, value),
|
'7' : ' ╘ %s%s%s > %s'%(CR, langs.log.post_inv, CS, value),
|
||||||
'8' : ' ╞ %s%s%s %s'%(CR, langs.log.mark_np, CS, value),
|
'8' : ' ╞ %s%s%s %s'%(CR, langs.log.mark_np, CS, value),
|
||||||
'9' : ' ╞ Article %shas changed%s. Check it first'%(CR, CS),
|
'9' : ' ╞ %s%s%s > %s'%(CR, langs.log.post_chg, CS, value),
|
||||||
'10' : ' ╘ %s%s%s'%(CR, langs.log.dom_no, CS),
|
'10' : ' ╘ %s%s%s'%(CR, langs.log.dom_no, CS),
|
||||||
'11' : ' ╘ %s%s%s > %s'%(CR, langs.log.err_arg, CS, value),
|
'11' : ' ╘ %s%s%s > %s'%(CR, langs.log.err_arg, CS, value),
|
||||||
'12' : ' ╞ %s%s%s > %s'%(CR, langs.log.post_inc, CS, value),
|
'12' : ' ╞ %s%s%s > %s'%(CR, langs.log.post_inc, CS, value),
|
||||||
|
@ -49,8 +49,8 @@ def out(nbr, value, out):
|
||||||
'16' : ' ╞ %s%s%s "%s = ?"'%(CR, langs.log.unused_c, CS, value),
|
'16' : ' ╞ %s%s%s "%s = ?"'%(CR, langs.log.unused_c, CS, value),
|
||||||
'17' : ' ╞ %s%s%s "%s ?"'%(CR, langs.log.unused_v, CS, value),
|
'17' : ' ╞ %s%s%s "%s ?"'%(CR, langs.log.unused_v, CS, value),
|
||||||
'18' : ' ╘ %s%s%s > %s'%(CR, langs.log.unused_p, CS, value),
|
'18' : ' ╘ %s%s%s > %s'%(CR, langs.log.unused_p, CS, value),
|
||||||
'19' : ' ╞ Article %swip%s on: %s'%(CG, CS, value),
|
'19' : ' ╞ %s%s%s %s'%(CG, langs.log.was_wip, CS, value),
|
||||||
'20' : ' ╞ %s%s%s %s'%(CG, langs.log.check_on, CS, value),
|
'20' : ' ╞ %s%s%s %s'%(CG, langs.log.was_chk, CS, value),
|
||||||
'21' : ' ╘ %s%s%s > %s'%(CG, langs.log.post_val, CS, value),
|
'21' : ' ╘ %s%s%s > %s'%(CG, langs.log.post_val, CS, value),
|
||||||
'22' : ' ╞ %s%s%s %s'%(CY, langs.log.symb_np, CS, value),
|
'22' : ' ╞ %s%s%s %s'%(CY, langs.log.symb_np, CS, value),
|
||||||
'23' : ' ╞ %s%s%s > %s'%(CY, langs.log.db_inv, CS, value),
|
'23' : ' ╞ %s%s%s > %s'%(CY, langs.log.db_inv, CS, value),
|
||||||
|
@ -61,6 +61,7 @@ def out(nbr, value, out):
|
||||||
'28' : ' ╘ %s (%s)'%(langs.log.ntd, value),
|
'28' : ' ╘ %s (%s)'%(langs.log.ntd, value),
|
||||||
'29' : ' ╞ %sEmpty configuration%s %s'%(CY, CS, value),
|
'29' : ' ╞ %sEmpty configuration%s %s'%(CY, CS, value),
|
||||||
'30' : ' ╞ %s%s%s > %s'%(CY, langs.log.nywip, CS, value),
|
'30' : ' ╞ %s%s%s > %s'%(CY, langs.log.nywip, CS, value),
|
||||||
|
'31' : ' ╘ %s%s%s'%(CR, langs.log.nomods, CS),
|
||||||
'32' : ' ╞══ %s%s%s > %s'%(CG, langs.log.file_c, CS, value),
|
'32' : ' ╞══ %s%s%s > %s'%(CG, langs.log.file_c, CS, value),
|
||||||
'33' : ' ╞══ %s%s%s > %s'%(CG, langs.log.dir_c, CS, value),
|
'33' : ' ╞══ %s%s%s > %s'%(CG, langs.log.dir_c, CS, value),
|
||||||
'34' : ' ╞══ %s%s%s > %s'%(CG, langs.log.file_n, CS, value),
|
'34' : ' ╞══ %s%s%s > %s'%(CG, langs.log.file_n, CS, value),
|
||||||
|
@ -73,6 +74,7 @@ def out(nbr, value, out):
|
||||||
'43' : ' ╒ %s%s%s'%(CY, langs.log.dom_no, CS),
|
'43' : ' ╒ %s%s%s'%(CY, langs.log.dom_no, CS),
|
||||||
'44' : ' ╞ %s%s%s "tyto check %s"'%(CY, langs.log.check_m, CS, value),
|
'44' : ' ╞ %s%s%s "tyto check %s"'%(CY, langs.log.check_m, CS, value),
|
||||||
'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,
|
||||||
'255' : ' ╘ %s'%langs.log.laterout
|
'255' : ' ╘ %s'%langs.log.laterout
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License
|
# it under the terms of the GNU Affero General Public License
|
||||||
# as published by the Free Software Foundation, either version 3 of the License, or
|
# as published by the Free Software Foundation, either version 3 of the
|
||||||
# of the License, or (at your option) any later version.
|
# License, or of the License, or (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
#**********************************************************************
|
#**********************************************************************
|
||||||
|
|
||||||
import os, sys, importlib
|
import os, sys, importlib
|
||||||
import args, logs, dom, db, form, tyto, check, stats, langs
|
import args, logs, langs, dom, db, form, tyto, check, html, stats
|
||||||
|
|
||||||
#========================#
|
#========================#
|
||||||
# Read lines from a file #
|
# Read lines from a file #
|
||||||
|
@ -62,7 +62,7 @@ def read_lines(f, alone):
|
||||||
else: decor = '├'
|
else: decor = '├'
|
||||||
print(' %s─%s─┘'%(decor, sp_max * '─'))
|
print(' %s─%s─┘'%(decor, sp_max * '─'))
|
||||||
|
|
||||||
dom.valid()
|
if not f == dom.config: dom.valid()
|
||||||
|
|
||||||
|
|
||||||
#======================#
|
#======================#
|
||||||
|
@ -178,9 +178,13 @@ def manage(target):
|
||||||
|
|
||||||
|
|
||||||
# If edit article and hash changed, ask to check
|
# If edit article and hash changed, ask to check
|
||||||
if args.action == "edit" and post_src:
|
if args.action == "edit":
|
||||||
new_hash = tyto.get_filesum(file, True)
|
new_hash = tyto.get_filesum(file, True)
|
||||||
if curr_hash != new_hash:
|
|
||||||
|
if curr_hash == new_hash: return
|
||||||
|
|
||||||
|
# Launch process for some changed file
|
||||||
|
#-------------------------------------
|
||||||
if file == post_src:
|
if file == post_src:
|
||||||
form.asking(' ├ %s%s '%(
|
form.asking(' ├ %s%s '%(
|
||||||
langs.site.post_chg, langs.site.q
|
langs.site.post_chg, langs.site.q
|
||||||
|
@ -190,3 +194,8 @@ def manage(target):
|
||||||
importlib.reload(db)
|
importlib.reload(db)
|
||||||
check.manage(post_src)
|
check.manage(post_src)
|
||||||
|
|
||||||
|
elif file == dom.sidebar_f: html.create_sidebar('wip')
|
||||||
|
elif file == dom.navbar_f: html.create_navbar('wip')
|
||||||
|
elif file == dom.metas_f: html.create_user_metas('wip')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,14 +23,14 @@ def domain():
|
||||||
if dom.hole: logs.out("13", '', True)
|
if dom.hole: logs.out("13", '', True)
|
||||||
elif not dom.shortname: return
|
elif not dom.shortname: return
|
||||||
elif dom.incomplete: logs.out("41", dom.shortname, False)
|
elif dom.incomplete: logs.out("41", dom.shortname, False)
|
||||||
elif dom.activated: logs.out("42", dom.shortname, False)
|
elif dom.active: logs.out("42", dom.shortname, False)
|
||||||
elif not dom.activated: logs.out("40", dom.shortname, False)
|
elif not dom.active: logs.out("40", dom.shortname, False)
|
||||||
|
|
||||||
if dom.incomplete:
|
# Show unused values
|
||||||
for err_val in dom.err_val:
|
for err_val in dom.err_val:
|
||||||
logs.out("16", err_val, False)
|
logs.out("16", err_val, False)
|
||||||
|
|
||||||
# Missing directories was created
|
# Missing directories (was created)
|
||||||
for dir_new in dom.dir_new:
|
for dir_new in dom.dir_new:
|
||||||
logs.out("33", dir_new, False)
|
logs.out("33", dir_new, False)
|
||||||
|
|
||||||
|
@ -47,11 +47,27 @@ def domain():
|
||||||
for value in dom.file_mod:
|
for value in dom.file_mod:
|
||||||
create_files[value]('form')
|
create_files[value]('form')
|
||||||
|
|
||||||
|
for file_mods in dom.wip_html_mods:
|
||||||
|
if not tyto.exists(file_mods):
|
||||||
|
logs.out("1", file_mods, False)
|
||||||
|
|
||||||
#==============================#
|
#==============================#
|
||||||
# On demand with status action #
|
# On demand with status action #
|
||||||
#------------------------------#
|
#------------------------------#
|
||||||
def check(target):
|
def check(target):
|
||||||
|
conf_err = False
|
||||||
|
|
||||||
if target == "domain":
|
if target == "domain":
|
||||||
for file_new in dom.file_new:
|
if dom.dir_unu or dom.file_unu:
|
||||||
logs.out("24", file_new, False)
|
logs.out("60", '', False)
|
||||||
|
|
||||||
|
for dir_unu in dom.dir_unu:
|
||||||
|
logs.out("1", dir_unu, False)
|
||||||
|
conf_err = True
|
||||||
|
|
||||||
|
for file_unu in dom.file_unu:
|
||||||
|
logs.out("24", file_unu, False)
|
||||||
|
|
||||||
|
if conf_err:
|
||||||
|
logs.out("31", '', True)
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,27 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# Name: Tyto - Littérateur
|
# Tyto - Littérateur
|
||||||
# Type: Global functions for Tyto
|
#
|
||||||
# Description: Settings, Tools and
|
# Copyright (C) 2023 Cyrille Louarn <echolib+tyto@a-lec.org>
|
||||||
# file: tyto.py
|
#
|
||||||
# Folder: /var/lib/tyto/program/
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# By echolib (XMPP: im@echolib.re)
|
# it under the terms of the GNU Affero General Public License
|
||||||
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
|
# as published by the Free Software Foundation, either version 3 of the
|
||||||
|
# License, or of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# XMPP: echolib (im@echolib.re)
|
||||||
|
#
|
||||||
|
# Description: Tools and some seetings.
|
||||||
|
# File: /var/lib/tyto/program/tyto.py
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
#------------
|
#------------
|
||||||
# funny stats
|
# funny stats
|
||||||
|
@ -19,47 +35,14 @@
|
||||||
|
|
||||||
import os, sys, subprocess, locale, base64, datetime, shutil
|
import os, sys, subprocess, locale, base64, datetime, shutil
|
||||||
from hashlib import blake2b
|
from hashlib import blake2b
|
||||||
|
|
||||||
import args, dom, logs
|
import args, dom, logs
|
||||||
|
|
||||||
# TEMP
|
|
||||||
lang = 'fr'
|
|
||||||
if lang.lower() == 'fr': n = 0
|
|
||||||
else: n = 1
|
|
||||||
#--
|
|
||||||
|
|
||||||
# :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'
|
||||||
Tytoweb = 'https://tyto.echolib.re'
|
Tytoweb = 'https://tyto.echolib.re'
|
||||||
stats_f = 'tyto_statoolinfos.conf'
|
stats_f = 'tyto_statoolinfos.conf'
|
||||||
|
|
||||||
# Translations French/English
|
|
||||||
trans = [
|
|
||||||
('À l\'affiche !', 'Featured !'), # 0
|
|
||||||
('Accueil', 'Home'), # 1
|
|
||||||
('Licence', 'License'), # 2
|
|
||||||
('Code source', 'Source code'), # 3
|
|
||||||
('Dépôt officiel du code source de %s'%Tyto , '%s\'s official source code repository'%Tyto),
|
|
||||||
('Site web officiel du logiciel libre %s'%Tyto, '%s\'s official website'),
|
|
||||||
('L\'article', 'The article'), # 6
|
|
||||||
('écrit par', 'written by'), # 7
|
|
||||||
('Publié le', 'Published the'), # 8 date for section HTML (article_infos)
|
|
||||||
('à', 'at'), # 9 time format
|
|
||||||
('rédigé le', 'created the'), # 10
|
|
||||||
('À Propos de', 'About'), # 11
|
|
||||||
('Générateur :', 'Generator:'), # 12
|
|
||||||
('Contacter par courriel', 'Contact by mail'), # 13
|
|
||||||
('Courriel', 'Mail'), # 14
|
|
||||||
('C.G.U.', 'T.o.U'), # 15
|
|
||||||
('Mentions légales', 'Legal Notice'), # 16
|
|
||||||
('Conditions Générales d\'Utilisation', 'Terms of Use'), # 17
|
|
||||||
('Loi', 'Law'), # 18
|
|
||||||
('Articles de', 'Articles from'), # 19
|
|
||||||
('Lire l\'article:', 'Read the article:'), #20
|
|
||||||
('Voir le code source au format Tyto de cet article', 'See this article\'s source code in Tyto format') #21 (title)
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
# Needed header tags
|
# Needed header tags
|
||||||
needed_header_tags = \
|
needed_header_tags = \
|
||||||
|
@ -96,20 +79,21 @@ opt_tags_check_uri = \
|
||||||
)
|
)
|
||||||
|
|
||||||
# Set all tags used in article's header
|
# Set all tags used in article's header
|
||||||
headers = (
|
headers = \
|
||||||
'title:',
|
(
|
||||||
'about:',
|
'title:',
|
||||||
'author:',
|
'about:',
|
||||||
'tags:',
|
'author:',
|
||||||
'date:',
|
'tags:',
|
||||||
'link:',
|
'date:',
|
||||||
'image:',
|
'link:',
|
||||||
'file:',
|
'image:',
|
||||||
'abbr:',
|
'file:',
|
||||||
'raw:',
|
'abbr:',
|
||||||
'#',
|
'raw:',
|
||||||
'snpic:',
|
'#',
|
||||||
)
|
'snpic:',
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# Words and template Tags (paragraphs, lists, bold, strong...)
|
# Words and template Tags (paragraphs, lists, bold, strong...)
|
||||||
|
@ -206,8 +190,8 @@ def exists(uri):
|
||||||
# False = URI #
|
# False = URI #
|
||||||
#-----------------------#
|
#-----------------------#
|
||||||
def get_filesum(path, src):
|
def get_filesum(path, src):
|
||||||
if not exists(path):
|
#if not src and not exists(path):
|
||||||
logs.out("1", path, True)
|
# logs.out("1", path, True)
|
||||||
|
|
||||||
file_sum = blake2b(digest_size=4)
|
file_sum = blake2b(digest_size=4)
|
||||||
|
|
||||||
|
|
|
@ -38,50 +38,22 @@
|
||||||
|
|
||||||
import os, re, sys, locale, shutil, importlib, time
|
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, dom, db, tyto, html, form, stats
|
|
||||||
|
|
||||||
# load locale translation
|
|
||||||
trans_dir = '/var/lib/tyto/translations'
|
|
||||||
sys.path.insert(0, trans_dir)
|
|
||||||
|
|
||||||
# System language
|
|
||||||
try: lang_sys = locale.getdefaultlocale()[0].split('_')[0]
|
|
||||||
except: lang_sys = 'en'
|
|
||||||
|
|
||||||
# Get default system language
|
|
||||||
# or set "en" (english) if no translation file
|
|
||||||
try:
|
|
||||||
lang_site = lang_sys
|
|
||||||
os.path.exists('%s/site_%s.py'%(trans_dir, lang_site))
|
|
||||||
except:
|
|
||||||
lang_site = 'en'
|
|
||||||
|
|
||||||
# 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))
|
|
||||||
tr = importlib.import_module('site_%s'%lang_site, package=None)
|
|
||||||
except:
|
|
||||||
tr = importlib.import_module('site_%s'%lang_site, package=None)
|
|
||||||
|
|
||||||
|
|
||||||
#=========================================#
|
#=========================================#
|
||||||
# Manage wip action with option as target #
|
# Manage wip action with option as target #
|
||||||
#-----------------------------------------#
|
#-----------------------------------------#
|
||||||
def manage_wip(target):
|
def manage(target):
|
||||||
global post_db, hash_post, target_all
|
|
||||||
|
|
||||||
# Check if can process
|
|
||||||
dom.valid()
|
dom.valid()
|
||||||
|
|
||||||
|
global post_db, hash_post, target_all
|
||||||
|
|
||||||
# wip_article(db.post_src) ; return # Force wip without checking
|
# wip_article(db.post_src) ; return # Force wip without checking
|
||||||
|
|
||||||
# Target is footer, sidebar, navbar, metas
|
if not target:
|
||||||
#-----------------------------------------
|
logs.out("5", '[target]', True)
|
||||||
if target in args.pass_targets:
|
|
||||||
|
elif target in args.pass_targets:
|
||||||
do = {
|
do = {
|
||||||
'all' : wip_all,
|
'all' : wip_all,
|
||||||
'again' : wip_all,
|
'again' : wip_all,
|
||||||
|
@ -100,10 +72,14 @@ def manage_wip(target):
|
||||||
# Per article with target
|
# Per article with target
|
||||||
#------------------------
|
#------------------------
|
||||||
# Exit with these conditions
|
# Exit with these conditions
|
||||||
if not target: logs.out("5", '', True)
|
if not db.post:
|
||||||
if not db.exists: sys.exit(1)
|
logs.out("1", db.uri_file, True)
|
||||||
if not db.config: logs.out("25", db.uri_file, True)
|
|
||||||
if db.old_chk: logs.out("9", db.uri_file, True)
|
elif not db.exists:
|
||||||
|
logs.out("28", '%s %s'%(args.action, args.target), True)
|
||||||
|
|
||||||
|
elif db.old_chk:
|
||||||
|
logs.out("9", db.uri_file, True)
|
||||||
|
|
||||||
# Article has changed or wip file missing
|
# Article has changed or wip file missing
|
||||||
if db.old_wip or not db.file_wip:
|
if db.old_wip or not db.file_wip:
|
||||||
|
@ -112,7 +88,7 @@ def manage_wip(target):
|
||||||
# wip is up-to-date: ask to wip again
|
# wip is up-to-date: ask to wip again
|
||||||
else:
|
else:
|
||||||
logs.out("19", db.date_wip, False)
|
logs.out("19", db.date_wip, False)
|
||||||
form.asking(' ├ [%s] %s%s '%(db.title, tr.wip_new, tr.q), True)
|
form.asking(' ├ [%s] %s%s '%(db.title, langs.site.wip_new, langs.site.q), True)
|
||||||
wip_article(db.uri_file)
|
wip_article(db.uri_file)
|
||||||
|
|
||||||
|
|
||||||
|
@ -819,7 +795,7 @@ def convert_list(markdown_str):
|
||||||
index = -1
|
index = -1
|
||||||
|
|
||||||
# Cut string with \n's
|
# Cut string with \n's
|
||||||
strlist = markdown_str.split("\n")
|
strlist = markdown_slangs.site.split("\n")
|
||||||
|
|
||||||
# Find items
|
# Find items
|
||||||
for i in range(len(strlist)):
|
for i in range(len(strlist)):
|
||||||
|
|
|
@ -22,25 +22,28 @@ unused_r = "Unused ressource"
|
||||||
unused_c = "Unused database value"
|
unused_c = "Unused database value"
|
||||||
db_inv = "Corrupted article's database"
|
db_inv = "Corrupted article's database"
|
||||||
err_arg = "Argument error"
|
err_arg = "Argument error"
|
||||||
no_arg = "Unused argument with"
|
no_arg = "Unused argument"
|
||||||
|
no_fidi = "Black Hole: no file or directory here"
|
||||||
dom_ina = "Inactive domain"
|
dom_ina = "Inactive domain"
|
||||||
dom_inc = "Incomplete domain"
|
dom_inc = "Incomplete domain"
|
||||||
dom_act = "Active domain"
|
dom_act = "Active domain"
|
||||||
data_inc = "Incomplete data"
|
data_inc = "Incomplete data"
|
||||||
data_inv = "Invalid data"
|
data_inv = "Invalid data"
|
||||||
dom_no = "No domain found"
|
dom_no = "No domain found"
|
||||||
no_fidi = "Blask Hole: no file or directory here"
|
|
||||||
file_c = "File created"
|
file_c = "File created"
|
||||||
file_n = "File changed"
|
file_n = "File changed"
|
||||||
file_e = "File exists"
|
file_e = "File exists"
|
||||||
dir_c = "Directory created"
|
dir_c = "Directory created"
|
||||||
dir_e = "Directory exists"
|
dir_e = "Directory exists"
|
||||||
|
|
||||||
check_on = "Article was check the"
|
was_chk = "Article 'check'"
|
||||||
|
was_wip = "Article already 'wip'"
|
||||||
check_m = "Check manually"
|
check_m = "Check manually"
|
||||||
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"
|
||||||
|
post_chg = "Article changed: 'check' it first"
|
||||||
sep_inv = "Unused separator in article"
|
sep_inv = "Unused separator in article"
|
||||||
unused_v = "Unused value in article"
|
unused_v = "Unused value in article"
|
||||||
unused_p = "Empty article"
|
unused_p = "Empty article"
|
||||||
|
@ -52,5 +55,9 @@ nyfile = "file not yet created"
|
||||||
nycheck = "Article not yet checked"
|
nycheck = "Article not yet checked"
|
||||||
nywip = "Article not yet wip"
|
nywip = "Article not yet wip"
|
||||||
add = "Add:"
|
add = "Add:"
|
||||||
|
nomods = "Create HTML modules first"
|
||||||
|
status_r = "Checking unused ressources..."
|
||||||
|
was_wip = "Article already 'wip'"
|
||||||
|
|
||||||
|
|
||||||
laterout = "Maybe later..."
|
laterout = "Maybe later..."
|
||||||
|
|
|
@ -23,25 +23,27 @@ unused_r = "Ressource manquante"
|
||||||
unused_c = "Valeur de la base de donnée manquante"
|
unused_c = "Valeur de la base de donnée manquante"
|
||||||
db_inv = "Base de donnée de l'article corrompue"
|
db_inv = "Base de donnée de l'article corrompue"
|
||||||
err_arg = "Erreur d'argument"
|
err_arg = "Erreur d'argument"
|
||||||
no_arg = "Argument manquant avec"
|
no_arg = "Argument manquant"
|
||||||
|
no_fidi = "Trou Noir: aucun fichier ou dossier ici"
|
||||||
dom_ina = "Domaine inactif"
|
dom_ina = "Domaine inactif"
|
||||||
dom_inc = "Domaine incomplet"
|
dom_inc = "Domaine incomplet"
|
||||||
dom_act = "Domaine actif"
|
dom_act = "Domaine actif"
|
||||||
data_inc = "Donnée incomplète"
|
data_inc = "Donnée incomplète"
|
||||||
data_inv = "Donnée invalide"
|
data_inv = "Donnée invalide"
|
||||||
dom_no = "Aucun domaine trouvé"
|
dom_no = "Aucun domaine trouvé"
|
||||||
no_fidi = "Trou Noir: aucun fichier ou dossier ici"
|
|
||||||
file_c = "Fichier créé"
|
file_c = "Fichier créé"
|
||||||
file_n = "Fichier modifié"
|
file_n = "Fichier modifié"
|
||||||
file_e = "Fichier présent"
|
file_e = "Fichier présent"
|
||||||
dir_c = "Dossier créé"
|
dir_c = "Dossier créé"
|
||||||
dir_e = "Dossier présent"
|
dir_e = "Dossier présent"
|
||||||
|
|
||||||
check_on = "Article vérifié le"
|
was_chk = "Article déjà vérifié"
|
||||||
|
was_wip = "Article déjà 'wip'"
|
||||||
check_m = "Vérifier manuellement"
|
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"
|
||||||
|
post_chg = "Article modifié : commencer par 'check'"
|
||||||
sep_inv = "Séparateur manquant dans l'article"
|
sep_inv = "Séparateur manquant dans l'article"
|
||||||
unused_v = "Valeur manquante dans l'article"
|
unused_v = "Valeur manquante dans l'article"
|
||||||
unused_p = "L'article est vide"
|
unused_p = "L'article est vide"
|
||||||
|
@ -53,6 +55,7 @@ nyfile = "Fichier pas encore créé"
|
||||||
nycheck = "Article pas encore 'check'"
|
nycheck = "Article pas encore 'check'"
|
||||||
nywip = "Article pas encore 'wip'"
|
nywip = "Article pas encore 'wip'"
|
||||||
add = "Ajout:"
|
add = "Ajout:"
|
||||||
|
nomods = "Créer d'abord les modules HTML"
|
||||||
|
status_r = "Vérification des ressources manquantes..."
|
||||||
|
|
||||||
laterout = "Pour plus tard..."
|
laterout = "Pour plus tard..."
|
||||||
|
|
|
@ -21,6 +21,7 @@ This is a python file, so... DO NOT REMOVE:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
# Generic
|
# Generic
|
||||||
|
article = "Article"
|
||||||
sidebar = 'Sidebar'
|
sidebar = 'Sidebar'
|
||||||
navbar = 'Navbar'
|
navbar = 'Navbar'
|
||||||
metas = 'Metas Tags'
|
metas = 'Metas Tags'
|
||||||
|
@ -28,6 +29,7 @@ footer = 'Footer'
|
||||||
title = 'Title'
|
title = 'Title'
|
||||||
File = 'File'
|
File = 'File'
|
||||||
name = 'Name'
|
name = 'Name'
|
||||||
|
by = 'par'
|
||||||
q = '?'
|
q = '?'
|
||||||
i = '!'
|
i = '!'
|
||||||
pp = ":"
|
pp = ":"
|
||||||
|
@ -39,6 +41,11 @@ source_code = "Source code"
|
||||||
home = "Home"
|
home = "Home"
|
||||||
go_home = "Go to Homepage"
|
go_home = "Go to Homepage"
|
||||||
read = "Read"
|
read = "Read"
|
||||||
|
tyto_psrc = "Show this article's source code in Tyto format"
|
||||||
|
w_written = "was written the"
|
||||||
|
w_published = "was published the"
|
||||||
|
written = "written the"
|
||||||
|
published = "wpublished the"
|
||||||
|
|
||||||
# Sidebar
|
# Sidebar
|
||||||
site_sdb_t = "Featured..."
|
site_sdb_t = "Featured..."
|
||||||
|
@ -83,6 +90,10 @@ form_ready = ' │\n' + \
|
||||||
' ├──────────────────────────────────────┐\n' + \
|
' ├──────────────────────────────────────┐\n' + \
|
||||||
' │ Domain is ready. Have fun, writers ! │\n' + \
|
' │ Domain is ready. Have fun, writers ! │\n' + \
|
||||||
' └──────────────────────────────────────┘'
|
' └──────────────────────────────────────┘'
|
||||||
|
form_inv = ' │\n' + \
|
||||||
|
' ├─────────────────────────────────────┐\n' + \
|
||||||
|
' │ Domain is INVALID. Try form again ! │\n' + \
|
||||||
|
' └─────────────────────────────────────┘'
|
||||||
|
|
||||||
form_opt = "[Optional]"
|
form_opt = "[Optional]"
|
||||||
form_url = "URL to official website?"
|
form_url = "URL to official website?"
|
||||||
|
@ -215,3 +226,54 @@ footer_about_doc = \
|
||||||
'# - begin with "#"\n' + \
|
'# - begin with "#"\n' + \
|
||||||
'# - Do NOT copy to template directory\n' + \
|
'# - Do NOT copy to template directory\n' + \
|
||||||
'# %s\n'%(20 * "-")
|
'# %s\n'%(20 * "-")
|
||||||
|
|
||||||
|
# Help with Tyto commands
|
||||||
|
args_helps = """\n# New domain:
|
||||||
|
- Create your domain folder, and go in
|
||||||
|
- Create domain with 'tyto new domain [URL]'
|
||||||
|
- Create article\'s file in articles/ directory
|
||||||
|
- Use these actions on article\'s file: Check > wip > publish
|
||||||
|
! Config\'s files are in _configs/ directory
|
||||||
|
and used to create HTML file in your template
|
||||||
|
Your template files (css, logo...) go to wip/template/ server\n
|
||||||
|
# Usage: tyto [action] [target]
|
||||||
|
- [action] > according to [target]:
|
||||||
|
edit : Edit a file (article, config's module)
|
||||||
|
edit-about: specific for (footer), or like [edit-db]
|
||||||
|
edit-db : Edit a config file (domain, article (TAKE CARE !))
|
||||||
|
edit-wip : Edit html file in wip server
|
||||||
|
edit_www : Edit html file in www server
|
||||||
|
new : Create new (domain, sidebar/footer... config's file)
|
||||||
|
show : Show content file (article, config's module)
|
||||||
|
show-about: specific for (footer), or like [show-db]
|
||||||
|
show-db : Show content of article\'s database
|
||||||
|
show-wip : Show content of HTML file in wip server
|
||||||
|
show-www : Show content of HTML file in www server\n
|
||||||
|
check : Check if article is valid and ready to convert
|
||||||
|
wip : Create HTML page in wip server
|
||||||
|
publish : Create HTML page in www server\n
|
||||||
|
- [target] > according to [action]
|
||||||
|
all : process (updated) valid articles
|
||||||
|
again : process again ALL valid articles
|
||||||
|
newer : [wip/publish] convert only newer articles
|
||||||
|
template : - Create new navbar/sidebar/metas/footer in www server
|
||||||
|
- Copy other wip/template/ files to www server
|
||||||
|
domain : Create/Show domain config's file
|
||||||
|
[file] : URI of an article's file (autocompletion's friend)
|
||||||
|
footer : Create/Show footer HTML config's file
|
||||||
|
metas : Create/Show metas HTML config's file
|
||||||
|
navbar : Create/Show navbar config's file
|
||||||
|
sidebar : Create/Show sidebar config's file
|
||||||
|
stats : Create statistics file in root server\n
|
||||||
|
# Examples:
|
||||||
|
- Check article's syntax: tyto check mysubdir/index.tyto
|
||||||
|
- Create default _configs/tyto.sidebar: tyto new sidebar
|
||||||
|
- Edit _configs/tyto.navbar: tyto edit navbar
|
||||||
|
(each edition launches process if file changed like:
|
||||||
|
- check
|
||||||
|
- (navbar, sidebar, metas, footer) : create file on wip server)
|
||||||
|
- Edit index.html in www server: tyto edit-www index.tyto
|
||||||
|
- Create sidebar.html in wip server: tyto wip sidebar
|
||||||
|
- Show footer.html in wip server: tyto show-wip footer
|
||||||
|
- Create metas.html in www server: tyto publish metas
|
||||||
|
- Show navbar.html in www server: tyto show-www navbar"""
|
||||||
|
|
|
@ -21,13 +21,15 @@ Ceci est un fichier python, donc... NE PAS ENLEVER :
|
||||||
'''
|
'''
|
||||||
|
|
||||||
# Generic
|
# Generic
|
||||||
|
article = "Article"
|
||||||
sidebar = 'Barre Latérale'
|
sidebar = 'Barre Latérale'
|
||||||
navbar = 'Barre de navigation'
|
navbar = 'Barre de navigation'
|
||||||
metas = 'Balises Metas'
|
metas = 'Balises Metas'
|
||||||
footer = "Pied de Page"
|
footer = 'Pied de Page'
|
||||||
title = 'Titre'
|
title = 'Titre'
|
||||||
File = 'Fichier'
|
File = 'Fichier'
|
||||||
name = 'Nom'
|
name = 'Nom'
|
||||||
|
by = 'par'
|
||||||
q = ' ?'
|
q = ' ?'
|
||||||
i = ' !'
|
i = ' !'
|
||||||
pp = " :"
|
pp = " :"
|
||||||
|
@ -39,6 +41,11 @@ source_code = "Code source"
|
||||||
home = "Accueil"
|
home = "Accueil"
|
||||||
go_home = "Aller à la page d'accueil"
|
go_home = "Aller à la page d'accueil"
|
||||||
read = "À lire"
|
read = "À lire"
|
||||||
|
tyto_psrc = "Voir le code source au format Tyto de cet article"
|
||||||
|
w_written = "a été écrit le"
|
||||||
|
w_published = "a été publié le"
|
||||||
|
written = "écrit le"
|
||||||
|
published = "publié le"
|
||||||
|
|
||||||
# Barre latérale
|
# Barre latérale
|
||||||
site_sdb_t = "À l'affiche..."
|
site_sdb_t = "À l'affiche..."
|
||||||
|
@ -84,6 +91,10 @@ form_ready = ' │\n' + \
|
||||||
' ├─────────────────────────────────────────┐\n' + \
|
' ├─────────────────────────────────────────┐\n' + \
|
||||||
' │ Le domaine est prêt. Amusez-vous bien ! │\n' + \
|
' │ Le domaine est prêt. Amusez-vous bien ! │\n' + \
|
||||||
' └─────────────────────────────────────────┘'
|
' └─────────────────────────────────────────┘'
|
||||||
|
form_inv = ' │\n' + \
|
||||||
|
' ├───────────────────────────────────────────┐\n' + \
|
||||||
|
' │ Le Domaine est INVALIDE. Essayez encore ! │\n' + \
|
||||||
|
' └───────────────────────────────────────────┘'
|
||||||
|
|
||||||
form_opt = "[Optionnel]"
|
form_opt = "[Optionnel]"
|
||||||
form_url = "URL du site web officiel"
|
form_url = "URL du site web officiel"
|
||||||
|
@ -216,3 +227,54 @@ footer_about_doc = \
|
||||||
'# - commencent par "#"\n' + \
|
'# - commencent par "#"\n' + \
|
||||||
'# - Ne PAS copier ce fichier dans le dossier template\n' + \
|
'# - Ne PAS copier ce fichier dans le dossier template\n' + \
|
||||||
'# %s\n'%(20 * "-")
|
'# %s\n'%(20 * "-")
|
||||||
|
|
||||||
|
# Help with Tyto commands
|
||||||
|
args_helps = """\n# New domain:
|
||||||
|
- Create your domain folder, and go in
|
||||||
|
- Create domain with 'tyto new domain [URL]'
|
||||||
|
- Create article\'s file in articles/ directory
|
||||||
|
- Use these actions on article\'s file: Check > wip > publish
|
||||||
|
! Config\'s files are in _configs/ directory
|
||||||
|
and used to create HTML file in your template
|
||||||
|
Your template files (css, logo...) go to wip/template/ server\n
|
||||||
|
# Usage: tyto [action] [target]
|
||||||
|
- [action] > according to [target]:
|
||||||
|
edit : Edit a file (article, config's module)
|
||||||
|
edit-about: specific for (footer), or like [edit-db]
|
||||||
|
edit-db : Edit a config file (domain, article (TAKE CARE !))
|
||||||
|
edit-wip : Edit html file in wip server
|
||||||
|
edit_www : Edit html file in www server
|
||||||
|
new : Create new (domain, sidebar/footer... config's file)
|
||||||
|
show : Show content file (article, config's module)
|
||||||
|
show-about: specific for (footer), or like [show-db]
|
||||||
|
show-db : Show content of article\'s database
|
||||||
|
show-wip : Show content of HTML file in wip server
|
||||||
|
show-www : Show content of HTML file in www server\n
|
||||||
|
check : Check if article is valid and ready to convert
|
||||||
|
wip : Create HTML page in wip server
|
||||||
|
publish : Create HTML page in www server\n
|
||||||
|
- [target] > according to [action]
|
||||||
|
all : process (updated) valid articles
|
||||||
|
again : process again ALL valid articles
|
||||||
|
newer : [wip/publish] convert only newer articles
|
||||||
|
template : - Create new navbar/sidebar/metas/footer in www server
|
||||||
|
- Copy other wip/template/ files to www server
|
||||||
|
domain : Create/Show domain config's file
|
||||||
|
[file] : URI of an article's file (autocompletion's friend)
|
||||||
|
footer : Create/Show footer HTML config's file
|
||||||
|
metas : Create/Show metas HTML config's file
|
||||||
|
navbar : Create/Show navbar config's file
|
||||||
|
sidebar : Create/Show sidebar config's file
|
||||||
|
stats : Create statistics file in root server\n
|
||||||
|
# Examples:
|
||||||
|
- Check article's syntax: tyto check mysubdir/index.tyto
|
||||||
|
- Create default _configs/tyto.sidebar: tyto new sidebar
|
||||||
|
- Edit _configs/tyto.navbar: tyto edit navbar
|
||||||
|
(each edition launches process if file changed like:
|
||||||
|
- check
|
||||||
|
- (navbar, sidebar, metas, footer) : create file on wip server)
|
||||||
|
- Edit index.html in www server: tyto edit-www index.tyto
|
||||||
|
- Create sidebar.html in wip server: tyto wip sidebar
|
||||||
|
- Show footer.html in wip server: tyto show-wip footer
|
||||||
|
- Create metas.html in www server: tyto publish metas
|
||||||
|
- Show navbar.html in www server: tyto show-www navbar"""
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
# Home Domain
|
||||||
|
directory = ""
|
||||||
|
database = ""
|
||||||
|
|
||||||
|
# Local user configuration
|
||||||
|
lang_sys = "SYS"
|
||||||
|
local_user = ""
|
||||||
|
lang_logs = "SYS"
|
||||||
|
articles_db_d = ""
|
||||||
|
|
||||||
|
# Working directories
|
||||||
|
articles_d = ""
|
||||||
|
files_d = ""
|
||||||
|
images_d = ""
|
||||||
|
modules_d = ""
|
||||||
|
|
||||||
|
# Modules files
|
||||||
|
navbar_f = ""
|
||||||
|
sidebar_f = ""
|
||||||
|
metas_f = ""
|
||||||
|
footer_f = ""
|
||||||
|
footer_about_f = ""
|
||||||
|
|
||||||
|
# Domain
|
||||||
|
shortname = ""
|
||||||
|
www_url = ""
|
||||||
|
wip_url = ""
|
||||||
|
|
||||||
|
# Servers directories
|
||||||
|
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 = ""
|
||||||
|
|
||||||
|
# Servers files
|
||||||
|
wip_navbar_f = ""
|
||||||
|
wip_sidebar_f = ""
|
||||||
|
wip_metas_f = ""
|
||||||
|
wip_footer_f = ""
|
||||||
|
www_navbar_f = ""
|
||||||
|
www_sidebar_f = ""
|
||||||
|
www_metas_f = ""
|
||||||
|
www_footer_f = ""
|
||||||
|
wip_logo_f = ""
|
||||||
|
www_logo_f = ""
|
||||||
|
www_rss_f = ""
|
||||||
|
|
||||||
|
# Domain user's settings
|
||||||
|
logo = "logo.png"
|
||||||
|
rss = "rss.xml"
|
||||||
|
rss_items = 100
|
||||||
|
title = ""
|
||||||
|
date = ""
|
||||||
|
about = ""
|
||||||
|
lang_site = "SYS"
|
||||||
|
mail = ""
|
||||||
|
tags = ""
|
||||||
|
license = ""
|
||||||
|
license_url = ""
|
||||||
|
legal_url = ""
|
||||||
|
terms_url = ""
|
||||||
|
css = "tyto"
|
||||||
|
sep = "-"
|
||||||
|
article_code = False
|
||||||
|
relme = ""
|
||||||
|
sidebar_title = ""
|
||||||
|
sidebar_items = 6
|
||||||
|
|
||||||
|
activated = False
|
Loading…
Reference in New Issue