[1.9.17] - Working on 'check', check set header post tags file
This commit is contained in:
parent
1aab0bd8fe
commit
ad632fc63d
|
@ -9,6 +9,10 @@ Tyto - Littérateur
|
||||||
|
|
||||||
# CURRENTLY IN DEV !
|
# CURRENTLY IN DEV !
|
||||||
|
|
||||||
|
## [1.9.17]
|
||||||
|
- working on 'check' process
|
||||||
|
- - dev on checking file used in some post header tags
|
||||||
|
|
||||||
## [1.9.16]
|
## [1.9.16]
|
||||||
- working on 'check' process
|
- working on 'check' process
|
||||||
- - dev: post database values (lots are missing)
|
- - dev: post database values (lots are missing)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# Version: 1.9.16
|
# Version: 1.9.17
|
||||||
# Updated: 2023-10-03 1696344805
|
# Updated: 2023-10-03 1696349064
|
||||||
# Tyto - Littérateur
|
# Tyto - Littérateur
|
||||||
|
|
||||||
# Copyright (C) 2023 Cyrille Louarn <echolib+tyto@a-lec.org>
|
# Copyright (C) 2023 Cyrille Louarn <echolib+tyto@a-lec.org>
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -32,7 +32,7 @@
|
||||||
# file program :
|
# file program :
|
||||||
#--------------------------
|
#--------------------------
|
||||||
|
|
||||||
import sys
|
import sys, os
|
||||||
from dateutil.parser import parse
|
from dateutil.parser import parse
|
||||||
|
|
||||||
import args, domain, langs, debug, post, tools
|
import args, domain, langs, debug, post, tools
|
||||||
|
@ -306,8 +306,10 @@ def ml_tag_values(ln, tag, stats):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Check value2 link for some tags (file, image...)
|
# Check value2 link for some tags (file, image...)
|
||||||
if tag in post.value2s_uri():
|
if tag in post.value2s_uri \
|
||||||
if not is_value2_file_exists(ln+2, tag)
|
and not value2.startswith(post.value2s_ext_uris):
|
||||||
|
if not is_value2_file_exists(ln+2, tag, value2):
|
||||||
|
return False
|
||||||
|
|
||||||
# Convert values to HTML (put in post database)
|
# Convert values to HTML (put in post database)
|
||||||
html_value = '<a href="%s" class="%s" target="%s" alt="%s">%s</a>'%(
|
html_value = '<a href="%s" class="%s" target="%s" alt="%s">%s</a>'%(
|
||||||
|
@ -334,18 +336,39 @@ def ml_tag_values(ln, tag, stats):
|
||||||
|
|
||||||
#================================#
|
#================================#
|
||||||
# Check value2 uri for some tags #
|
# Check value2 uri for some tags #
|
||||||
|
# uri starts with: #
|
||||||
|
# - @... for generic articles/ #
|
||||||
|
# - /... for root work directory #
|
||||||
|
# - ... for post directory #
|
||||||
#--------------------------------#
|
#--------------------------------#
|
||||||
def is_value2_file_exists(ln, tag):
|
def is_value2_file_exists(ln, tag, value2):
|
||||||
# check first char if "@" to check file in generic folders
|
# uri "@..." means generic folders
|
||||||
print("post: value2", ln, value2)
|
if value2[0].startswith("@"):
|
||||||
|
# Set defaut directory for files in /files
|
||||||
|
wrk_df = domain.wrk_files
|
||||||
|
|
||||||
|
# Set directory for images in /images
|
||||||
|
if tag == post.ml_tags[1]: # image:
|
||||||
|
wrk_df = domain.wrk_images
|
||||||
|
|
||||||
# Set defaut directory for files in /files
|
value2 = value2[1:]
|
||||||
wrk_df = domain.wrk_file
|
|
||||||
|
# uri "/..." means from wrk root folder
|
||||||
# Set directory for images in /images
|
elif value2[0].startswith("/"):
|
||||||
if tag == post.ml_tags[1]: # image:
|
wrk_df = domain.wrk_articles
|
||||||
wrk_df = domain.wrk_images
|
value2 = value2[1:]
|
||||||
|
|
||||||
|
# uri "..." means from legacy post folder
|
||||||
|
else:
|
||||||
|
wrk_df = os.path.dirname(post.uri) + "/"
|
||||||
|
|
||||||
|
# Check if file exists
|
||||||
|
file_uri = wrk_df + value2
|
||||||
|
if not os.path.exists(file_uri):
|
||||||
|
post.error = \
|
||||||
|
debug.out(5, "%s) %s"%(ln, tag), file_uri, True, 2, False)
|
||||||
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -474,12 +497,10 @@ def titles():
|
||||||
|
|
||||||
# Count Tyto Comments
|
# Count Tyto Comments
|
||||||
elif line.startswith("#"):
|
elif line.startswith("#"):
|
||||||
print("?? tyto_coms", line)
|
|
||||||
post.stats_tyto_text_coms += 1
|
post.stats_tyto_text_coms += 1
|
||||||
|
|
||||||
# Count HTML comments
|
# Count HTML comments
|
||||||
elif line.startswith(post.text_comments):
|
elif line.startswith(post.text_comments):
|
||||||
print("?? html_coms", line)
|
|
||||||
post.stats_html_coms += 1
|
post.stats_html_coms += 1
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -181,6 +181,7 @@ ml_marks = {
|
||||||
|
|
||||||
# Markers with uri in value2
|
# Markers with uri in value2
|
||||||
value2s_uri = (ml_tags[1], ml_tags[2], ml_tags[3])
|
value2s_uri = (ml_tags[1], ml_tags[2], ml_tags[3])
|
||||||
|
value2s_ext_uris = ("http", "ftp")
|
||||||
|
|
||||||
# text_contents
|
# text_contents
|
||||||
# =============
|
# =============
|
||||||
|
|
Loading…
Reference in New Issue