[1.9.35]
This commit is contained in:
parent
238b886bea
commit
119ba6e25f
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -10,6 +10,16 @@ Tyto - Littérateur
|
|||
|
||||
# CURRENTLY IN DEV (in devel branch) !
|
||||
|
||||
## [1.9.35]
|
||||
- Working on creating modules
|
||||
- - Todo last: metas
|
||||
- check
|
||||
- - target: domain, wip, www to check directories and files
|
||||
- - - domain: create .raw modules and wip modules (.html)
|
||||
- wip
|
||||
- - html values are now in wip.py
|
||||
- fixes and more...
|
||||
|
||||
## [1.9.34]
|
||||
- Working on creating modules
|
||||
- - fixes typos codes
|
||||
|
|
|
@ -7,15 +7,18 @@ This program can ve tested but not at all usable. Lots of work to do...
|
|||
tyto
|
||||
```
|
||||
# Create new domain
|
||||
- create a domain directory, line www.domain.tld
|
||||
- create a domain directory, like www.domain.tld
|
||||
- Go to this directory
|
||||
- type `tyto new domain`
|
||||
- type `tyto check domain`
|
||||
- create in new directory domain ".../articles/", an article (see tuto below)
|
||||
- type `check myfile.tyto` (or use "wip" instead of check)
|
||||
|
||||
|
||||
## Working on
|
||||
- 'wip' action processes
|
||||
- Create HTML full page from article
|
||||
- Create/Manage modules (header, navbar, sidebar, footer)
|
||||
- Create/Manage modules (metas, header, navbar, sidebar, footer)
|
||||
|
||||
## ToDo
|
||||
- thinking about creating an auto top article menu from titles
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Package: tyto
|
||||
Version: 1.9.33
|
||||
Version: 1.9.35
|
||||
Section: custom
|
||||
Priority: optional
|
||||
Architecture: all
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
# Version: 1.9.34
|
||||
# Version: 1.9.35
|
||||
# Updated: 2023-10-18 1697613100
|
||||
# Tyto - Littérateur
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -64,6 +64,39 @@ def manage(action, target):
|
|||
# target is not "all"
|
||||
ready()
|
||||
target.endswith(".tyto") and is_article(target)
|
||||
target == "domain" and wrk_domain()
|
||||
target in ("wip", "www") and srv_domain(target)
|
||||
|
||||
#==========================================#
|
||||
# Check some things used by current domain #
|
||||
#------------------------------------------#
|
||||
def wrk_domain():
|
||||
wrk_template_files()
|
||||
wip.get_modules("wip")
|
||||
|
||||
if post.error != 0:
|
||||
sys.exit(post.error)
|
||||
|
||||
|
||||
#==========================================================#
|
||||
# Warn if unused registred file in wrk template/ directory #
|
||||
#----------------------------------------------------------#
|
||||
def wrk_template_files():
|
||||
for key, uri in domain.cf.items("USER_TEMPLATE_FILES"):
|
||||
if not os.path.exists(uri):
|
||||
debug.out(5, key, uri, True, 1, False)
|
||||
|
||||
|
||||
#==================================#
|
||||
# Check wip and www dirs and files #
|
||||
#----------------------------------#
|
||||
def srv_domain(target):
|
||||
for section in ("%s_DIRS"%target.upper(), "%s_FILES"%target.upper()):
|
||||
if section.endswith("DIRS"): err = 6
|
||||
else: err = 5
|
||||
for key, uri in domain.cf.items(section):
|
||||
if not os.path.exists(uri):
|
||||
debug.out(err, key, uri, True, 1, False)
|
||||
|
||||
|
||||
#================================#
|
||||
|
|
|
@ -197,8 +197,11 @@ def cf_set(section, key, default):
|
|||
|
||||
# Optional key
|
||||
elif not default:
|
||||
if not val: return default
|
||||
else: default = val
|
||||
if not val:
|
||||
cf.set(section, key, default)
|
||||
return default
|
||||
else:
|
||||
default = val
|
||||
|
||||
# Force set default value
|
||||
if val != default:
|
||||
|
@ -234,17 +237,18 @@ def cf_update_values(write):
|
|||
tags = cf_set("DOMAIN", "tags", "tags")
|
||||
license = cf_set("DOMAIN", "lincese", "")
|
||||
if not license:
|
||||
license = cf_set("DOMAIN", "lincese", "gfdl-1.3")
|
||||
license_url = cf_set("DOMAIN", "lincese_url",
|
||||
"https://www.gnu.org/licenses/fdl-1.3.txt")
|
||||
elif not license == "gfdl-1.3":
|
||||
license_url = cf_set("DOMAIN", "lincese_url","")
|
||||
license = cf_set("DOMAIN", "license", "gfdl-1.3")
|
||||
license_url = cf_set("DOMAIN", "license_url",
|
||||
"https://www.gnu.org/licenses/fdl-1.3.txt")
|
||||
elif not license == "gfdl-1.3" and \
|
||||
license_url == "https://www.gnu.org/licenses/fdl-1.3.txt":
|
||||
license_url = cf_set("DOMAIN", "license_url", "")
|
||||
|
||||
# Optional
|
||||
global legals_url, terms_url, statuses_url
|
||||
legals_url = cf_set("DOMAIN", "legals_url", "")
|
||||
terms_url = cf_set("DOMAIN", "terms_url", "")
|
||||
statuses_url = cf_set("DOMAIN", "statuses_url", "")
|
||||
# [WEBSITE_FOOTER]
|
||||
global legals_url, terms_url, bylaws_url
|
||||
legals_url = cf_set("WEBSITE_FOOTER", "legals_url", "")
|
||||
terms_url = cf_set("WEBSITE_FOOTER", "terms_url", "")
|
||||
bylaws_url = cf_set("WEBSITE_FOOTER", "bylaws_url", "")
|
||||
|
||||
|
||||
# [SERVER]
|
||||
|
@ -613,9 +617,6 @@ tags =
|
|||
mail =
|
||||
license = gfdl-1.3
|
||||
license_url = https://www.gnu.org/licenses/fdl-1.3.txt
|
||||
legals_url =
|
||||
terms_url =
|
||||
statuses_url =
|
||||
|
||||
[WEBSITE]
|
||||
www_url =
|
||||
|
@ -627,6 +628,11 @@ article_code = yes
|
|||
static = no
|
||||
navbar = yes
|
||||
|
||||
[WEBSITE_FOOTER]
|
||||
legals_url =
|
||||
terms_url =
|
||||
bylaws_url =
|
||||
|
||||
[WEBSITE_MODULES]
|
||||
navbar = yes
|
||||
sidebar_title =
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
# File: /var/lib/tyto/program/tyto.py
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
import forms
|
||||
import forms, wip
|
||||
|
||||
#
|
||||
# Arguments in command line #
|
||||
|
@ -116,65 +116,4 @@ quote = """<blockquote class="%s"%s%s%s>%s
|
|||
%s
|
||||
</blockquote>"""
|
||||
|
||||
page_tpl = """<!-- %s -->
|
||||
<!Doctype html>
|
||||
<html lang="%s">
|
||||
<head>
|
||||
%s
|
||||
</head>
|
||||
<body>
|
||||
<div id="site_container">
|
||||
|
||||
%s
|
||||
|
||||
%s
|
||||
|
||||
<!-- div contains <article> and <aside> -->
|
||||
<div id="site_article_aside">
|
||||
<article id="site_article">
|
||||
<header id="site_article_header">
|
||||
<h1 id="site_article_title">%s</h1>
|
||||
</header>
|
||||
%s
|
||||
<footer id="site_article_footer">
|
||||
%s
|
||||
</footer>
|
||||
</article>
|
||||
%s
|
||||
</div> <!-- site_article_aside -->
|
||||
|
||||
</div> <!-- #site_container -->
|
||||
</body>
|
||||
</html>"""
|
||||
|
||||
module_header = """<!-- Header (logo, description) -->
|
||||
<header id="site_header">
|
||||
<div id="site_logo">
|
||||
<a id="site_logo_link" href="%s" title="%s">
|
||||
<img id="site_logo_image" src="%s" alt="%s" title="%s">
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div id="site_infos">
|
||||
<p id="site_infos_title">%s</p>
|
||||
<p id="site_infos_text">%s</p>
|
||||
</div<
|
||||
</header>"""
|
||||
|
||||
module_navbar = """<!-- Website Menu navbar -->
|
||||
<nav id="site_menu">
|
||||
<menu id="site_menu_items">
|
||||
%s
|
||||
</menu>
|
||||
</nav>"""
|
||||
|
||||
module_sidebar = """<!-- Website Sidebar -->
|
||||
<aside id="site_sidebar">
|
||||
<ul id="site_sidebar_items">
|
||||
%s
|
||||
</ul>
|
||||
</aside>
|
||||
"""
|
||||
|
||||
module_footer = """<!-- Website footer-->
|
||||
"""
|
||||
|
|
|
@ -105,10 +105,7 @@ def convert(target):
|
|||
for key, directory in domain.cf.items("WIP_DIRS"):
|
||||
tools.create_dirs(directory)
|
||||
|
||||
# Warn if unused registred file in wrk template/ directory
|
||||
for key, uri in domain.cf.items("USER_TEMPLATE_FILES"):
|
||||
os.path.exists(uri) or \
|
||||
debug.out(5, key, uri, True, 1, False)
|
||||
check.wrk_template_files()
|
||||
|
||||
# Check/Create modules files
|
||||
# navbar, sidebar, header, footer
|
||||
|
@ -614,9 +611,6 @@ def modules_db():
|
|||
mods_cf.read(db_mods_uri)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#============================================#
|
||||
# Check / Create modules files (.raw + .html #
|
||||
# process: "wip" or "www" #
|
||||
|
@ -629,10 +623,11 @@ def get_modules(srv):
|
|||
global modules
|
||||
|
||||
# Modules settings
|
||||
fill_footer_raw()
|
||||
modules = \
|
||||
{
|
||||
"header" : {
|
||||
"raw" : tyto.module_header%(
|
||||
"raw" : module_header%(
|
||||
"/template/%s"%domain.logo, domain.about,
|
||||
"/template/%s"%domain.logo, domain.about, domain.about,
|
||||
domain.title,
|
||||
|
@ -668,7 +663,12 @@ def get_modules(srv):
|
|||
"set" : sidebar_check,
|
||||
},
|
||||
"footer" : {
|
||||
"raw" : tyto.module_footer,
|
||||
"raw" : module_footer%(
|
||||
domain.title,
|
||||
domain.about,
|
||||
footer_items,
|
||||
footer_cpr
|
||||
),
|
||||
"wrk" : domain.wrk_footer,
|
||||
"wip" : domain.wip_footer,
|
||||
"www" : domain.www_footer,
|
||||
|
@ -696,6 +696,7 @@ def get_modules(srv):
|
|||
|
||||
else:
|
||||
tools.create_file(modules[mod]["wrk"], modules[mod]["raw"])
|
||||
cur_raw_id = tools.get_filesum(modules[mod]["wrk"], True)
|
||||
mods_cf.set(mod.upper(), "raw", cur_raw_id)
|
||||
mods_cf_write = True
|
||||
create_html_module = True
|
||||
|
@ -706,9 +707,10 @@ def get_modules(srv):
|
|||
|
||||
# Create HTML module if needed (raw updated, or unused html file)
|
||||
if create_html_module:
|
||||
print(">> HTML", mod)
|
||||
if not modules[mod]["set"](srv):
|
||||
return False
|
||||
modules[mod]["set"](srv)
|
||||
|
||||
if post.error != 0:
|
||||
return False
|
||||
|
||||
if mods_cf_write:
|
||||
with open(db_mods_uri, "w") as f:
|
||||
|
@ -773,8 +775,8 @@ def navbar_html_create(srv):
|
|||
with open(domain.wrk_navbar, "r") as f:
|
||||
navbar_raw = f.read().rsplit("\n")
|
||||
navbar_html = "<!-- Website Menu Directories -->"
|
||||
html_line = '<li class="site_menu_item"%s>' + \
|
||||
'<a class="%s site_menu_link" href="%s">%s</a></li>'
|
||||
html_line = '<li class="site_menu_item"%s>' + \
|
||||
'<a class="%s site_menu_link" href="%s">%s</a></li>'
|
||||
|
||||
for ln, line in enumerate(navbar_raw, 1):
|
||||
if line.lstrip().startswith("#") or \
|
||||
|
@ -841,7 +843,7 @@ def navbar_html_create(srv):
|
|||
debug.out(9, 'Navbar', domain.wrk_navbar, True, 2, False)
|
||||
return False
|
||||
|
||||
tools.create_file(modules["navbar"][srv], tyto.module_navbar%navbar_html)
|
||||
tools.create_file(modules["navbar"][srv], module_navbar%navbar_html)
|
||||
|
||||
return True
|
||||
|
||||
|
@ -960,10 +962,58 @@ def sidebar_html_create(srv):
|
|||
return False
|
||||
|
||||
|
||||
tools.create_file(modules["sidebar"][srv], tyto.module_sidebar%sidebar_html)
|
||||
tools.create_file(modules["sidebar"][srv], module_sidebar%sidebar_html)
|
||||
return True
|
||||
|
||||
|
||||
#===============================#
|
||||
# Get datas and fill footer raw #
|
||||
#-------------------------------#
|
||||
def fill_footer_raw():
|
||||
global footer_items, footer_cpr
|
||||
|
||||
# Create list items
|
||||
footer_items = "<!-- Domain items -->"
|
||||
item = \
|
||||
'<li class="site_footer_item">' + \
|
||||
'<a class="tyto site_footer_item_link" href="%s" title="%s %s">%s</a>'+ \
|
||||
'</li>'
|
||||
|
||||
# Specific to License
|
||||
if not domain.license: domain.license = "Copyleft"
|
||||
if not domain.license_url: domain.license_url = "/"
|
||||
show_license = "%s%s %s"%(langs.site.license, langs.logs.pp, domain.license)
|
||||
|
||||
footer_items = "%s\n%s"%(
|
||||
footer_items,
|
||||
item%(
|
||||
domain.license_url,
|
||||
langs.site.license_title, domain.title,
|
||||
show_license
|
||||
)
|
||||
)
|
||||
|
||||
# Loop to [WEBSITE_FOOTER] and make link from key_url
|
||||
for key, link in domain.cf.items("WEBSITE_FOOTER"):
|
||||
if link:
|
||||
keyname = key.rsplit("_url")[0]
|
||||
footer_items = "%s\n%s"%(
|
||||
footer_items,
|
||||
item%(
|
||||
link,
|
||||
getattr(langs.site, "%s_title"%keyname), domain.title,
|
||||
getattr(langs.site, keyname)
|
||||
)
|
||||
)
|
||||
|
||||
# Create copyright line
|
||||
cur_date = tools.nowdate().rsplit("-")[0]
|
||||
dom_date = domain.date.rsplit("-")[0]
|
||||
if cur_date != dom_date: dates = "%s-%s"%(dom_date, cur_date)
|
||||
else: dates = cur_date
|
||||
footer_cpr = 'Copyright © %s %s'%(dates, domain.title)
|
||||
|
||||
|
||||
#================================================#
|
||||
# Create footer.html in server (wip/ or www/) #
|
||||
# Remove empty lines and those starting with "#" #
|
||||
|
@ -991,6 +1041,7 @@ def footer_html_create(srv):
|
|||
#======#
|
||||
# MAIN #=======================================================================
|
||||
#======#
|
||||
# modules .ini configuration file
|
||||
ini_mods = """
|
||||
[HEADER]
|
||||
raw =
|
||||
|
@ -1004,3 +1055,83 @@ raw =
|
|||
[FOOTER]
|
||||
raw =
|
||||
"""
|
||||
|
||||
# HTML templates
|
||||
module_header = """<!-- Header (logo, description) -->
|
||||
<header id="site_header">
|
||||
<div id="site_logo">
|
||||
<a id="site_logo_link" href="%s" title="%s">
|
||||
<img id="site_logo_image" src="%s" alt="%s" title="%s">
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div id="site_infos">
|
||||
<p id="site_infos_title">%s</p>
|
||||
<p id="site_infos_text">%s</p>
|
||||
</div<
|
||||
</header>
|
||||
"""
|
||||
|
||||
module_navbar = """<!-- Website Menu navbar -->
|
||||
<nav id="site_menu" aria-labelledby="navigation-1">
|
||||
<menu id="site_menu_items">
|
||||
%s
|
||||
</menu>
|
||||
</nav>
|
||||
"""
|
||||
|
||||
module_sidebar = """<!-- Website Sidebar -->
|
||||
<aside id="site_sidebar">
|
||||
<nav id="site_sidebar_menu" aria-labelledby="navigation-2">
|
||||
<ul id="site_sidebar_items">
|
||||
%s
|
||||
</ul>
|
||||
</nav>
|
||||
</aside>
|
||||
"""
|
||||
|
||||
module_footer = """<!-- Website footer-->
|
||||
<footer id="site_footer">
|
||||
<div id="site_footer_infos">
|
||||
<p id="site_footer_title">%s</p>
|
||||
<p id="site_footer_about">%s</p>
|
||||
</div>
|
||||
<nav id="site_footer_menu" aria-labelledby="navigation-3">
|
||||
<ul id="site_footer_items">
|
||||
%s
|
||||
</ul>
|
||||
</nav>
|
||||
<p id="site_footer_copyright">%s</p>
|
||||
</footer>
|
||||
"""
|
||||
|
||||
page_tpl = """<!-- %s -->
|
||||
<!Doctype html>
|
||||
<html lang="%s">
|
||||
<head>
|
||||
%s
|
||||
</head>
|
||||
<body>
|
||||
<div id="site_container">
|
||||
|
||||
%s
|
||||
|
||||
%s
|
||||
|
||||
<!-- div contains <article> and <aside> -->
|
||||
<main id="site_article_aside">
|
||||
<article id="site_article">
|
||||
<header id="site_article_header">
|
||||
<h1 id="site_article_title">%s</h1>
|
||||
</header>
|
||||
%s
|
||||
<footer id="site_article_footer">
|
||||
%s
|
||||
</footer>
|
||||
</article>
|
||||
%s
|
||||
</main> <!-- site_article_aside -->
|
||||
|
||||
</div> <!-- #site_container -->
|
||||
</body>
|
||||
</html>"""
|
||||
|
|
|
@ -12,7 +12,7 @@ div#site_container {}
|
|||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Header (Logo, Description)
|
||||
* Header (Wensite Logo, Description)
|
||||
*/
|
||||
header#site_header {}
|
||||
/* Website Logo */
|
||||
|
@ -26,7 +26,7 @@ p#site_infos_text {}
|
|||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Website Menu navbar
|
||||
* Menu navbar (Website)
|
||||
*/
|
||||
nav#site_menu {}
|
||||
menu#site_menu_items {}
|
||||
|
@ -36,7 +36,7 @@ a.site_menu_link {}
|
|||
|
||||
|
||||
/* div contains <article> and <aside> */
|
||||
div#site_article_aside {}
|
||||
main#site_article_aside {}
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
|
@ -127,9 +127,10 @@ img.tyto {}
|
|||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Sidebar navigation
|
||||
* Sidebar (Website)
|
||||
*/
|
||||
aside#site_sidebar {}
|
||||
nav#site_sidebar_menu {}
|
||||
ul#site_sidebar_items {}
|
||||
li.site_sidebar_item {}
|
||||
/* Around div.site_sidebar_block */
|
||||
|
@ -140,3 +141,18 @@ p.site_sidebar_title {}
|
|||
footer.site_sidebar_footer {}
|
||||
img.site_sidebar_image {}
|
||||
p.site_sidebar_about {}
|
||||
|
||||
|
||||
/* ============================================================================
|
||||
* Footer (Website)
|
||||
*/
|
||||
footer#site_footer {}
|
||||
div#site_footer_infos {}
|
||||
p#site_footer_title {}
|
||||
p#site_footer_about {}
|
||||
nav#site_footer_menu {}
|
||||
ul#site_footer_items {}
|
||||
li.site_footer_item {}
|
||||
/* Also a.tyto */
|
||||
a.site_footer_item_link {}
|
||||
p#site_footer_copyright {}
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -34,7 +34,8 @@
|
|||
ok = ("yes", "y")
|
||||
|
||||
# Form
|
||||
q = " ?"
|
||||
q = "?"
|
||||
pp = ":"
|
||||
configure_domain = "Configure domain"
|
||||
domain_title = "Domain title"
|
||||
domain_date = "Creation date"
|
||||
|
@ -106,7 +107,7 @@ tyto [action] [target] [options]
|
|||
start : activate domain (default "no" when created)
|
||||
stop : deactivate domain
|
||||
show : [domains]
|
||||
check :
|
||||
check : [domain, wip, www, [name].tyto]
|
||||
wip :
|
||||
publish :
|
||||
|
||||
|
@ -120,6 +121,8 @@ tyto [action] [target] [options]
|
|||
tags : [set]: domain tags (added to all articles)
|
||||
lang :
|
||||
server : [set]: server local URI
|
||||
wip : [check] Directories and files
|
||||
www : [check] Directories and files
|
||||
|
||||
[options] ; multi-set
|
||||
--force, -F : force doing things...
|
||||
|
|
|
@ -35,6 +35,7 @@ ok = ("oui", "o")
|
|||
|
||||
# Form
|
||||
q = " ?"
|
||||
pp = " :"
|
||||
configure_domain = "Configurer le domaine"
|
||||
domain_title = "Titre du domaine"
|
||||
domain_date = "Date de création"
|
||||
|
@ -106,7 +107,7 @@ tyto [action] [target] [options]
|
|||
start : activer le domaine (défaut "no" à la création)
|
||||
stop : désactiver le domaine
|
||||
show : [domains]
|
||||
check :
|
||||
check : [domain, wip, www, [name].tyto]
|
||||
wip :
|
||||
publish :
|
||||
|
||||
|
@ -120,6 +121,8 @@ tyto [action] [target] [options]
|
|||
tags : [set]: étiquettes du domaine (ajoutées aux articles)
|
||||
lang :
|
||||
server : [set]: URI du serveur local
|
||||
wip : [check] dossiers et fichiers
|
||||
www : [check] dossiers et fichiers
|
||||
|
||||
[options] ; multiples
|
||||
--force, -F : forcer à faire quelque chose...
|
||||
|
|
|
@ -31,4 +31,13 @@
|
|||
# Note: python file
|
||||
|
||||
sidebar_title = "Featured posts"
|
||||
sitemap = "sitemap"
|
||||
sitemap = "sitemap"
|
||||
|
||||
license = "License"
|
||||
license_title = "Website %s of"%license
|
||||
legals = "Legal Mentions"
|
||||
legal_title = "%s of"%legals
|
||||
terms = "Terms of Service"
|
||||
terms_title = "%s of"%terms
|
||||
bylaws = "Bylaws"
|
||||
bylaws_title = "%s of"%bylaws
|
||||
|
|
|
@ -28,7 +28,16 @@
|
|||
# - Copier ce contenu dedans, et traduire les variables
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
# Rappel: Fichier au format python
|
||||
# Note: Fichier au format python
|
||||
|
||||
sidebar_title = "Articles recommandés"
|
||||
sitemap = "Plan du site"
|
||||
sitemap = "Plan du site"
|
||||
|
||||
license = "Licence"
|
||||
license_title = "%s du site web de"%license
|
||||
legals = "Mentions légales"
|
||||
legal_title = "%s de"%legals
|
||||
terms = "C.G.U"
|
||||
terms_title = "%s de"%terms
|
||||
bylaws = "Statuts"
|
||||
bylaws_title = "%s de"%bylaws
|
||||
|
|
Loading…
Reference in New Issue