From 6f141b6c30fc05c8a1f6015a8cc892d8d7f1b2db Mon Sep 17 00:00:00 2001
From: Cyrille L
Date: Wed, 15 Feb 2023 10:44:22 +0100
Subject: [PATCH] updated code for new arguments in wip/publish + html "meta"
with date
---
src/var/lib/tyto/program/html.py | 19 +++++++++-----
src/var/lib/tyto/program/publish.py | 15 ++++++-----
src/var/lib/tyto/program/show.py | 40 ++++++++++++++++++++---------
src/var/lib/tyto/program/wip.py | 18 ++++++-------
4 files changed, 56 insertions(+), 36 deletions(-)
diff --git a/src/var/lib/tyto/program/html.py b/src/var/lib/tyto/program/html.py
index 933571b..7d22024 100644
--- a/src/var/lib/tyto/program/html.py
+++ b/src/var/lib/tyto/program/html.py
@@ -79,13 +79,15 @@ def create_metas_page():
icon_ref = 'type="image/png" href="%stemplate/%s"'%(
db.sub_uri, icon_file
)
- en_date = tyto.set_en_date(db.date[0])
relme = '' # External URL in metas (if exists in config domain)
if db.domain_relme:
relme = '\n '%(
db.domain_relme
)
+ # Create author and date publish section infos
+ create_html_infos_section('wip')
+
# Set all raw HTML metas
#-----------------------
global metas
@@ -101,7 +103,7 @@ def create_metas_page():
' \n'%db.author + \
' \n'%db.about + \
' \n'%all_tags + \
- ' \n'%en_date + \
+ '%s'%meta_pub + \
' \n'%db.http_www + \
' \n'%(rss_ref) + \
' \n'%css_ref + \
@@ -143,9 +145,6 @@ def create_main_page(target, article_bottom):
'%salt="logo: %s"\n'%(15 * " ", db.domain_title) + \
'%sid="site_logo_image" />\n'%(15 * " ") + \
'%s'%(8 * " ")
-
- # Create author and date publish section infos
- create_html_infos_section('wip')
#-----------------------#
# Create main HTML Page #
@@ -194,9 +193,9 @@ def create_html_infos_section(process):
# Need to reload the DB to get last time updated
exec(open(db.post_db).read(), globals())
- global post_pub
+ global post_pub, meta_pub, date_raw
if process == 'wip':
- date_raw = date_wip # ' + \
'
'
+
+ # meta search_date=
+ meta_pub = ' \n'%(
+ date_raw.rsplit(' ')[0]
+ )
#========================================================#
diff --git a/src/var/lib/tyto/program/publish.py b/src/var/lib/tyto/program/publish.py
index 51d3d78..5438066 100644
--- a/src/var/lib/tyto/program/publish.py
+++ b/src/var/lib/tyto/program/publish.py
@@ -17,7 +17,7 @@
#**********************************************************************
-import os, sys, shutil
+import os, sys, shutil, importlib
import db, logs, html, tyto
@@ -25,7 +25,7 @@ import db, logs, html, tyto
# Manage action, get post db #
# check if publish can be done #
#------------------------------#
-def manage_publish(target, option):
+def manage_publish(target):
err_pub = False # Default (publish)
if not db.db_exists:
logs.out("25", db.uri_file, True)
@@ -72,20 +72,21 @@ def manage_publish(target, option):
def replace_line_pub():
- # Need to reload the DB to get last time updated
- exec(open(db.post_db).read(), globals())
+ # Load config
+ importlib.reload(db)
html.create_html_infos_section('publish')
- new_line = html.post_pub
newfile = ''
wip_html_post = open(db.post_wip, 'r').read()
for line in wip_html_post.rsplit('\n'):
if line.startswith('%s show: target', target)
diff --git a/src/var/lib/tyto/program/wip.py b/src/var/lib/tyto/program/wip.py
index 53504ec..7cc213f 100644
--- a/src/var/lib/tyto/program/wip.py
+++ b/src/var/lib/tyto/program/wip.py
@@ -20,7 +20,7 @@
import os, re, shutil
import logs, db, tyto, html
-def manage_wip(target, option):
+def manage_wip(target):
global post_db, hash_post
# Domain configuration must exist and active
@@ -30,7 +30,7 @@ def manage_wip(target, option):
#-----------------------------------------
# Option 'Again' to wip again, based on DB
#-----------------------------------------
- if option == 'Again':
+ if target == 'all':
ask = ''
ask = input(":? wip again all already converted articles ? ")
if not ask in ['y', 'Y']:
@@ -57,12 +57,7 @@ def manage_wip(target, option):
# Exit if article has changed
if db.hash_chk != db.hash_post: logs.out("9", target, True)
-
- # In any case, if Force
- if option == 'Force':
- wip_article(db.uri_file)
- return
-
+
# Compare and check file
if db.hash_wip != db.hash_chk:
wip_article(db.uri_file)
@@ -71,8 +66,11 @@ def manage_wip(target, option):
logs.out("24", '(wip article): %s'%db.post_wip, False)
wip_article(db.uri_file)
else:
- logs.out("19", db.date_wip, True)
-
+ logs.out("19", db.date_wip, False)
+ ask = ''
+ ask = input(' ├ Create new wip page ? ')
+ if not ask in ['y', 'Y']: return
+ wip_article(db.uri_file)
#===================#
# Start wip modules #