This commit is contained in:
Cyrille L 2023-04-27 01:01:01 +02:00
parent fb3d7dd384
commit 32acda6fab
18 changed files with 204 additions and 140 deletions

View File

@ -6,9 +6,11 @@ Tyto - Littérateur
- Changelog: https://git.a-lec.org/echolib/tyto-litterateur/-/blob/master/CHANGELOG.md
- License: https://git.a-lec.org/echolib/tyto-litterateur/-/blob/master/LICENSE
## {0.10.3]
## {0.10.4]
- pre 1.0
- Lots of fixes
- Added some variables in domain config
- creating with tyto new filename ensure unicode
- Other fixes
## [0.10.2]
- Cite in a text > `[_` + `_]`

View File

@ -4,6 +4,26 @@ Pour obtenir de l'aide, taper juste la commande tyto
## Répertoire de code du projet Tyto
https://git.a-lec.org/echolib/tyto-litterateur
## Documentation officielle
https://tyto.echolib.re (en cours de construction)
## Démarrage "rapide"
````
mkdir -p MONDOMAIN
cd MONDOMAIN
tyto new domain URL
tyto new index
# À ce stade, voir la doc "écrire"
tyto edit index.tyto
tyto check index.tyto
tyto wip index.tyto
# Publier !
tyto publish template
tyto publish index.tyto
```
## Comment définir les métas
```
# Obligatoires uniques
@ -14,9 +34,10 @@ author: Auteur
tags: mot-clé-1,mot 2,
date: YYYY-MM-DD (AAAA-MM-JJ)
# L'image doit être configurée avec le même Nom
# dans les marqueurs multiples
# Pour snpic, l'image doit être configurée avec le même Nom
# qu'un marqueur d'entête "image:"
# Utilise l'image précisée comme "avatar" dans les réseaux sociaux
# Et dans le flux RSS
snpic: Nom

4
debian/control vendored
View File

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

View File

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

View File

@ -87,6 +87,8 @@ br.DOMAIN {
a.link {
}
a.link-file {
}
a.anchor_link {
}

View File

@ -100,8 +100,10 @@ def check_module(target):
if not os.path.exists(t):
logs.out("24", t, False)
unused_f = True
if not unused_f:
logs.out("28", "%s"%langs.log.all_ok, False)
except:
logs.out("28", "%s + %s"%(args.action, target), True)

View File

@ -91,6 +91,7 @@ dom_values = \
'srv_www_tpl_d',
'srv_www_images_d',
'srv_www_files_d',
'wip_favicon_f',
'wip_css_f',
'wip_logo_f',
'wip_navbar_f',
@ -98,14 +99,16 @@ dom_values = \
'wip_metas_f',
'wip_footer_f',
'wip_stats_f',
'www_css_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',
@ -140,11 +143,6 @@ create_files = \
wip_html_mods = ()
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:
home_dir = os.path.expanduser('~')
@ -186,6 +184,7 @@ if not hole:
try: active = activated
except: pass
# Check set values configuration
if not corrupt:
for value in dom_values:
try:
@ -197,14 +196,6 @@ if not hole:
incomplete = True
active = False
if 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 #
@ -256,12 +247,14 @@ if not hole:
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')),
@ -272,6 +265,12 @@ if not hole:
eval(str('www_rss_f')),
)
statistics = \
(
eval(str('wip_stats_f')),
eval(str('www_stats_f')),
)
modules = \
{
"metas" : metas,
@ -279,10 +278,12 @@ if not hole:
"sidebar" : sidebars,
"footer" : footers,
"template": templates,
"stats" : statistics,
}
templates_files_wip = \
(
eval(str('wip_favicon_f')),
eval(str('wip_logo_f')),
eval(str('wip_css_f')),
eval(str('wip_navbar_f')),
@ -294,6 +295,7 @@ if not hole:
templates_files_www = \
(
eval(str('www_favicon_f')),
eval(str('www_logo_f')),
eval(str('www_css_f')),
eval(str('www_navbar_f')),

View File

@ -244,7 +244,28 @@ def create_domain(target):
), False)
if answer: logo = answer
if not logo: logo='logo.png'
# Get css file name
#------------------
try: css_file = dom.css_file
except: css_file = "styles.css"
answer = asking('%s%s {%s} '%(
langs.site.form_css_f, langs.site.q, css_file
), False)
if answer: css_file = answer
# Get favicon file name
#----------------------
try: favicon_file = dom.favicon_file
except: favicon_file = "favicon.png"
answer = asking('%s%s {%s} '%(
langs.site.form_fav_f, langs.site.q, favicon_file
), False)
if answer: favicon_file = answer
# Set config's directories for servers
@ -269,8 +290,9 @@ def create_domain(target):
'srv_www_files_d = "%s/www/files/"\n'%root_srv_dom + \
'\n' + \
'# Servers files (wip)\n' + \
'wip_favicon_f = "%s%s"\n'%(srv_wip_tpl, favicon_file) + \
'wip_logo_f = "%s%s"\n'%(srv_wip_tpl, logo) + \
'wip_css_f = "%sstyles.css"\n'%srv_wip_tpl + \
'wip_css_f = "%s%s"\n'%(srv_wip_tpl, css_file) + \
'wip_navbar_f = "%snavbar.html"\n'%srv_wip_tpl + \
'wip_sidebar_f = "%ssidebar.html"\n'%srv_wip_tpl + \
'wip_metas_f = "%smetas.html"\n'%srv_wip_tpl + \
@ -278,8 +300,9 @@ def create_domain(target):
'wip_stats_f = "%s"\n'%stats_wip_f + \
'\n' + \
'# Servers files (www)\n' + \
'www_favicon_f = "%s%s"\n'%(srv_www_tpl, favicon_file) + \
'www_logo_f = "%s%s"\n'%(srv_www_tpl, logo) + \
'www_css_f = "%sstyles.css"\n'%srv_www_tpl + \
'www_css_f = "%s%s"\n'%(srv_www_tpl, css_file) + \
'www_navbar_f = "%snavbar.html"\n'%srv_www_tpl + \
'www_sidebar_f = "%ssidebar.html"\n'%srv_www_tpl + \
'www_metas_f = "%smetas.html"\n'%srv_www_tpl + \
@ -300,10 +323,12 @@ def create_domain(target):
if answer: www_rss = answer
set_f = 'www_rss_f = "%s/www/%s"\n'%(root_srv_dom, rss) + \
set_f = \
'www_rss_f = "%s/www/%s"\n'%(root_srv_dom, rss) + \
'\n# Domain user\'s settings\n' + \
'favicon = "%s"\n'%favicon_file + \
'logo = "%s"\n'%logo + \
'styles = "styles.css"\n' + \
'styles = "%s"\n'%css_file + \
'rss = "%s"\n'%rss
tyto.set_file(dom.config, False, set_f)
@ -434,7 +459,7 @@ def create_domain(target):
# Get License domain
#-------------------
try: domlicense = dom.license
except: domlicense = 'CC BY-NC-SA 3.0'
except: domlicense = 'gfdl-1.3'
answer = asking('%s%s {%s} '%(
langs.site.form_lic, langs.site.q, domlicense
@ -450,7 +475,9 @@ def create_domain(target):
# Get License URL (optional)
#---------------------------
try: licurl = dom.license_url
except: licurl = ''
except:
if domlicense == "gfdl-1.3":
licurl = "https://www.gnu.org/licenses/fdl-1.3.txt"
answer = asking('%s [http(s)://...] %s%s {%s} '%(
langs.site.form_opt, langs.site.form_licurl,

View File

@ -78,9 +78,8 @@ def create_metas_page():
db.sub_uri, dom.rss,
dom.title, dom.sep, dom.shortname
)
icon_file = 'favicon.png'
icon_ref = 'type="image/png" href="%stemplate/%s"'%(
db.sub_uri, icon_file
db.sub_uri, dom.favicon
)
relme = '' # External URL in metas (if exists in config domain)
if dom.relme:

View File

@ -34,6 +34,7 @@
#**********************************************************************
import sys
from unidecode import unidecode
import args, dom, logs, langs, form, html, tyto, show
@ -61,9 +62,15 @@ def manage(target):
actions[target](option)
# article target
#---------------
# article target name
#--------------------
else:
if args.target.endswith(".tyto"):
args.target = args.target.replace(".tyto", '')
u = unidecode(args.target, "utf-8")
args.target = unidecode(u)
filepost = "%s%s.tyto"%(dom.articles_d, args.target)
if tyto.exists(filepost):
logs.out("81", filepost, True)

View File

@ -156,12 +156,13 @@ def check_to_publish(process):
if process == 'all': return
elif process == 'one': sys.exit(err_pub)
#===============#
# Let's publish #
#---------------#
def publish_article():
# Copy wip page to www page
if not os.makedirs('%s%s'%(dom.srv_www, db.direc_src), exist_ok=True):
if os.makedirs('%s%s'%(dom.srv_www, db.direc_src), exist_ok=True):
logs.out("33", '%s%s'%(dom.srv_www, db.direc_src), False)
# Replace in DB hash_wip and date_wip

View File

@ -120,20 +120,6 @@ def domain():
html.create_user_footer('new')
'''
create_files = \
{
'navbar_f' : form.create_navbar,
'sidebar_f' : form.create_sidebar,
'metas_f' : form.create_metas,
'footer_f' : form.create_footer,
'footer_about_f': form.create_footer_about
}
for value in dom.file_mod:
create_files[value]('form')
'''
#==============================#
# On demand with status action #
#------------------------------#
@ -145,6 +131,7 @@ def check(target):
# Domain statuses
elif target == "domain":
# Check unused files in servers
logs.out("60", '', False)
check_domain_files("wip")
check_domain_files("www")
return
@ -194,16 +181,17 @@ def check(target):
elif not db.exists:
logs.out("25", db.uri_file, True)
#
#
#
#=====================#
# Check servers files #
#---------------------#
def check_domain_files(srv):
if srv == "www": template_files = dom.templates_files_www
elif srv == "wip": template_files = dom.templates_files_wip
else: return
dom_err = False
print('\n [%s]'%srv)
print(' [%s]'%srv)
for f in template_files:
if not tyto.exists(f):
dom_err = True

View File

@ -281,6 +281,8 @@ def wip_static():
#---------------------------------------------------------------#
def replace_in_post(src, html):
global post_bottom
if src in post_bottom:
post_bottom = post_bottom.replace(src, html)
@ -377,17 +379,17 @@ def wip_links():
#----------------------------------------------------
if db.uniq_files > 0:
for i in range(1, db.uniq_files + 1):
link = 'db.file_%s'%i
link_css = "link_file"
link_name = eval(link)[0][2:]
link_anc = eval(link)[1]
link_title = eval(link)[2]
link_set = link_html%(
link_css, link_anc, link_title, "%s", link_name
flink = 'db.file_%s'%i
flink_css = "link_file"
flink_name = eval(flink)[0][2:]
flink_anc = eval(flink)[1]
flink_title = eval(flink)[2]
flink_set = link_html%(
flink_css, flink_anc, flink_title, "%s", flink_name
)
replace_in_post(eval(link)[0]+'+', link_set%link_tb)
replace_in_post(eval(link)[0], link_set%link_ts)
replace_in_post(eval(flink)[0]+'+', flink_set%link_tb)
replace_in_post(eval(flink)[0], flink_set%link_ts)
# Convert simple links
@ -962,8 +964,10 @@ def wip_fileraws(target):
for i in range(1, db.uniq_raws + 1):
raw = 'db.raw_%s'%i
raw_file = open('%s%s'%(dom.articles_d, eval(raw)[1])).read()
raw_alt = ""
if eval(raw)[2]:
raw_alt = ' # %s'%eval(raw)[2]
raw_inc = '<!--Tyto_Include file%s-->'%raw_alt
for line in raw_file.rsplit('\n'):

View File

@ -57,11 +57,9 @@ unused_p = "Article vide"
nywip = "Article pas encore 'wip'"
was_wip = "Article déjà 'wip'"
# www
was_pub = "Article déjà publié"
# Misc
post_nfd = "Page non présente"
post_yfd = "Page présente"

View File

@ -18,7 +18,6 @@
# - "\n"
# - "+ \"
# Generic
article = "Article"
sidebar = 'Sidebar'
@ -115,36 +114,38 @@ form_inv = ' │\n' + \
' └─────────────────────────────────────┘'
form_opt = "[Optional]"
form_url = "URL to official website?"
form_wip = "URL to 'wip' website?"
form_url = "URL to official website"
form_wip = "URL to 'wip' website"
form_db_new = "Created new database"
form_trlog = "[2 char.] Logs language?"
form_srv = "Local server directory?"
form_logo = "Logo filename?"
form_rss_f = "Atom/RSS filename?"
form_rss_i = "Atom/RSS articles' number?"
form_title = "Website title?"
form_date = "Domain creation year?"
form_about = "Domain Description?"
form_mail = "Webmaster's mail?"
form_tags = "[comma separated] Domain tags?"
form_lic = "Domain License?"
form_licurl = "License URL?"
form_legal = "Legal Notice URL?"
form_terms = "Terms of Use URL?"
form_css = "[alnum] CSS Prefix?"
form_sep = "[1 char.] Pages titles separator?"
form_pscode = "Show Article source code?"
form_relme = 'rel="me" URL?'
form_trsite = "[2 char.] Website language?"
form_sdb_i = "Article number?"
form_activ = "Activate and prepare domain?"
form_trlog = "[2 char.] Logs language"
form_srv = "Local server directory"
form_logo = "Logo filename"
form_fav_f = "Favicon filename !(.png)"
form_css_f = "CSS filename"
form_rss_f = "Atom/RSS filename"
form_rss_i = "Atom/RSS articles' number"
form_title = "Website title"
form_date = "Domain creation year"
form_about = "Domain Description"
form_mail = "Webmaster's mail"
form_tags = "[comma separated] Domain tags"
form_lic = "Domain License"
form_licurl = "License URL"
form_legal = "Legal Notice URL"
form_terms = "Terms of Use URL"
form_css = "[alnum] CSS Prefix"
form_sep = "[1 char.] Pages titles separator"
form_pscode = "Show Article source code"
form_relme = 'rel="me" URL'
form_trsite = "[2 char.] Website language"
form_sdb_i = "Article number"
form_activ = "Activate and prepare domain"
form_dir_e = "Directory exists"
form_dir_c = "Directory created"
form_file_e = "File exists"
form_file_c = "File created"
form_reset = "Reset configuration?"
form_reset = "Reset configuration"
form_rep = "Replace HTML file"

View File

@ -67,7 +67,6 @@ mail_to = "Contacter par %s l'administrateur de"%mail.lower()
feed = "Flux"
generator = "Generateur"
# Misc for Tyto
#--------------
# Check
@ -94,7 +93,6 @@ reg_domains = 'Domaines enregistrés'
# Formulaire
#----------------------------------------------------------------------
form_edit = "Éditer le domaine avec le formulaire"
form_start = ' ├───────────────────────────────────────────────┐\n' + \
' │ Configurer un domaine pour le dossier courant │\n' + \
' │ Répondre O/o = Oui. Entrer garde le {default}\n' + \
@ -122,6 +120,8 @@ form_db_new = "Nouvelle base de données crée"
form_trlog = "[2 car.] Langue des messages"
form_srv = "Dossier du serveur local"
form_logo = "Nom du fichier du logo"
form_fav_f = "Nom du fichier favicon !(.png)"
form_css_f = "Nom du fichier CSS"
form_rss_f = "Nom du fichier Atom/RSS"
form_rss_i = "Nombre d'articles Atom/RSS"
form_title = "Titre du site web"

View File

@ -3,9 +3,9 @@ directory = ""
database = ""
# Local user configuration
lang_sys = "SYS"
lang_sys = ""
local_user = ""
lang_logs = "SYS"
lang_logs = ""
articles_db_d = ""
# Working directories
@ -27,8 +27,8 @@ www_url = ""
wip_url = ""
# Servers directories
srv_root = ""
srv_domain = ""
srv_root = "/var/www/"
srv_domain = "
srv_wip = ""
srv_wip_tpl_d = ""
srv_wip_images_d = ""
@ -38,36 +38,46 @@ srv_www_tpl_d = ""
srv_www_images_d = ""
srv_www_files_d = ""
# Servers files
# Servers files (wip)
wip_favicon_f = ""
wip_logo_f = ""
wip_css_f = ""
wip_navbar_f = ""
wip_sidebar_f = ""
wip_metas_f = ""
wip_footer_f = ""
wip_stats_f = ""
# Servers files (www)
www_favicon_f = ""
www_logo_f = ""
www_css_f = ""
www_navbar_f = ""
www_sidebar_f = ""
www_metas_f = ""
www_footer_f = ""
wip_logo_f = ""
www_logo_f = ""
www_stats_f = ""
www_rss_f = ""
# Domain user's settings
favicon = "favicon.png"
logo = "logo.png"
styles = "styles.css"
rss = "rss.xml"
rss_items = 100
title = ""
date = ""
about = ""
lang_site = "SYS"
lang_site = ""
mail = ""
tags = ""
license = ""
license = "gfdl-1.3"
license_url = ""
legal_url = ""
terms_url = ""
css = "tyto"
sep = "-"
article_code = False
article_code = True
relme = ""
sidebar_title = ""
sidebar_items = 6