This commit is contained in:
Cyrille L 2023-11-11 23:49:40 +01:00
parent 119ba6e25f
commit d1bed4c17b
13 changed files with 158 additions and 16 deletions

View File

@ -10,6 +10,11 @@ Tyto - Littérateur
# CURRENTLY IN DEV (in devel branch) !
## [1.9.36]
- fix translations modules
- added metas module
- added command "show metas" to see those already set in page with post
## [1.9.35]
- Working on creating modules
- - Todo last: metas

2
debian/control vendored
View File

@ -1,5 +1,5 @@
Package: tyto
Version: 1.9.35
Version: 1.9.36
Section: custom
Priority: optional
Architecture: all

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python3
# Version: 1.9.35
# Updated: 2023-10-18 1697613100
# Version: 1.9.36
# Updated: 2023-11-11 1699742831
# Tyto - Littérateur
# Copyright (C) 2023 Cyrille Louarn <echolib+tyto@a-lec.org>

View File

@ -33,7 +33,7 @@
#--------------------------
import os
import domain, debug
import domain, debug, wip
#====================================#
@ -42,7 +42,8 @@ import domain, debug
#------------------------------------#
def manage(action, target):
do = {
"domains": all_domains,
"domains" : all_domains,
"metas" : metas_post,
}
do[target]()
@ -63,3 +64,10 @@ def all_domains():
except:
debug.out(104, "False", domain.ult_dlf_uri, True, 1, False)
#====================================#
# Show article metas used in page #
# Not included, default set by users #
#------------------------------------#
def metas_post():
print(wip.metas_post)

View File

@ -626,6 +626,18 @@ def get_modules(srv):
fill_footer_raw()
modules = \
{
"metas" : {
"raw" : langs.logs.metas_header%(
domain.title, domain.wrk_articles,
domain.wrk_metas,
domain.wip_metas,
domain.www_metas
),
"wrk" : domain.wrk_metas,
"wip" : domain.wip_metas,
"www" : domain.www_metas,
"set" : metas_html_create
},
"header" : {
"raw" : module_header%(
"/template/%s"%domain.logo, domain.about,
@ -701,8 +713,8 @@ def get_modules(srv):
mods_cf_write = True
create_html_module = True
# Unused module HTML file
if not os.path.exists(modules[mod][srv]):
# Unused module HTML file or "--force" option
if not os.path.exists(modules[mod][srv]) or args.force:
create_html_module = True
# Create HTML module if needed (raw updated, or unused html file)
@ -719,6 +731,26 @@ def get_modules(srv):
return True
#================================================#
# Create metas.html in server (wip/ or www/) #
# Only use line starting with "<meta" or "<link" #
# modules/tyto_metas.raw has default contents #
#------------------------------------------------#
def metas_html_create(srv):
includes = ("<meta ", "<link ")
with open(domain.wrk_metas, "r") as f:
metas_raw = f.read().rsplit("\n")
metas_html = "<!-- Generic Website metas -->"
for line in metas_raw:
if line.lstrip().startswith(includes):
metas_html = "%s\n%s"%(metas_html, line)
tools.create_file(modules["metas"][srv], metas_html)
return True
#================================================#
# Create header.html in server (wip/ or www/) #
# Remove empty lines and those starting with "#" #
@ -1043,6 +1075,9 @@ def footer_html_create(srv):
#======#
# modules .ini configuration file
ini_mods = """
[METAS]
raw =
[HEADER]
raw =
@ -1057,6 +1092,40 @@ raw =
"""
# HTML templates
#------------------------------------------------------------------------------
metas_post = """<!-- Metas/links from domain and article -->
<meta name="generator" content="Tyto - Littérateur">
<!-- metas generated from domain -->
<meta name="url" content="%s">
<meta name="language" content="%s">
<meta name="reply-to" content="%s">
<meta name="copyright" content="%s">
<!-- metas generated from article -->
<meta name="title" content="%s">
<meta name="author" content="%s">
<meta name="description" content="%s">
<meta name="keywords" content="%s">
<!-- metas links to template files -->
<link rel="canonical" href="%s">
<link rel="stylesheet" href="%stemplate/%s">
<link rel="shortcut icon" type="image/%s" href="%stemplate/%s">
<link rel="alternate" type="application/rss+xml" href="%s/%s" title="RSS 2.0 (%s)">
<!-- Open Graph data -->
<meta property="og:site_name" content="%s">
<meta property="og:title" content="%s">
<meta property="og:type" content="article">
<meta property="og:url" content="%s">
<meta property="og:description" content="%s">
<meta property="og:image" content="%s">%s
<!-- Publication date and title -->
<meta itemprop="datePublished" content="%s" id="date">
<title>%s (%s) %s %s</title>"""
module_header = """<!-- Header (logo, description) -->
<header id="site_header">
<div id="site_logo">

View File

@ -106,7 +106,7 @@ tyto [action] [target] [options]
set : set website lang, domain values (title, server...)
start : activate domain (default "no" when created)
stop : deactivate domain
show : [domains]
show : [domains, metas]
check : [domain, wip, www, [name].tyto]
wip :
publish :
@ -131,8 +131,36 @@ tyto [action] [target] [options]
"""
#
# Modules (navbar, sidebar...)
# Modules (metas, navbar, sidebar...)
#
metas_header = """#
#=========================================================#
# HTML Metas cnfiguration file used by Tyto - Littérateur #
#---------------------------------------------------------#
#
# Domain Name : %s
# Domain URI : %s
# WRK : %s
# WIP : %s
# WWW : %s
# How to configure this file:
# - Add/Edit/Remove HTML metas
# ! These HTML metas are included in all website pages
# ! Supported HTML metas : (<meta ... and <link ...)
# ! One HTML meta per lines
# ? Type "tyto show metas" to show all others to be added
#------------------------------------------------------------------------------
<meta charset="UTF-8">
<meta name="robots" content="all">
<meta name="medium" content="website">
<meta name="revisit-after" content="3 days">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
"""
navbar_header = """#
#=====================================================#
# Navbar cnfiguration file used by Tyto - Littérateur #
@ -157,6 +185,7 @@ navbar_header = """#
# news !
# about/website
#------------------------------------------------------------------------------
"""
sidebar_header = """#
@ -179,4 +208,5 @@ sidebar_header = """#
# index.tyto
# dir/index.tyto
#------------------------------------------------------------------------------
"""

View File

@ -106,7 +106,7 @@ tyto [action] [target] [options]
set : définir la langue du site web, du domaine (titre, serveur...)
start : activer le domaine (défaut "no" à la création)
stop : désactiver le domaine
show : [domains]
show : [domains, metas]
check : [domain, wip, www, [name].tyto]
wip :
publish :
@ -131,12 +131,40 @@ tyto [action] [target] [options]
"""
#
# Modules (navbar, sidebar...)
# Modules (metas, navbar, sidebar...)
#
metas_header = """#
#========================================================================#
# Fichier de configuration des metas HTML utilisé par Tyto - Littérateur #
#------------------------------------------------------------------------#
#
# Nom du domaine : %s
# URI du domaine : %s
# WRK : %s
# WIP : %s
# WWW : %s
# Comment configurer ce fichier :
# - Ajouter/modifier/supprimer ces balises metas HTML
# ! Ces balises seront utilisées sur TOUTES les pages du site
# ! Balises HTML supportées : (<meta.. et <link...)
# ! Une balise par ligne
# ? Taper "tyto show metas" pour voir toutes celles ajoutées
#------------------------------------------------------------------------------
<meta charset="UTF-8">
<meta name="robots" content="all">
<meta name="medium" content="website">
<meta name="revisit-after" content="3 days">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
"""
navbar_header = """#
#=============================================================================#
# Fichier de config de la barre de menu utilisé par Tyto - Littérateur #
#-----------------------------------------------------------------------------#
#======================================================================#
# Fichier de config de la barre de menu utilisé par Tyto - Littérateur #
#----------------------------------------------------------------------#
#
# Nom du domaine : %s
# URI du domaine : %s
@ -157,6 +185,7 @@ navbar_header = """#
# news
# a-propos/website
#------------------------------------------------------------------------------
"""
sidebar_header = """#
@ -179,4 +208,5 @@ sidebar_header = """#
# index.tyto
# dir/index.tyto
#------------------------------------------------------------------------------
"""

View File

@ -36,7 +36,7 @@ sitemap = "sitemap"
license = "License"
license_title = "Website %s of"%license
legals = "Legal Mentions"
legal_title = "%s of"%legals
legals_title = "%s of"%legals
terms = "Terms of Service"
terms_title = "%s of"%terms
bylaws = "Bylaws"

View File

@ -36,7 +36,7 @@ sitemap = "Plan du site"
license = "Licence"
license_title = "%s du site web de"%license
legals = "Mentions légales"
legal_title = "%s de"%legals
legals_title = "%s de"%legals
terms = "C.G.U"
terms_title = "%s de"%terms
bylaws = "Statuts"