some fixes

This commit is contained in:
Cyrille L 2023-01-18 00:38:56 +01:00
parent 8b00709200
commit a71e2e58e6
2 changed files with 20 additions and 20 deletions

View File

@ -459,12 +459,14 @@ def check_headers(post_header):
)
# snpic (set image to share to social networks)
#----------------------------------------------
if snpic_name: continue
tag = tyto.headers[11] # snpic:
if line.startswith(tag):
snpic_name = post_header[ln - 1].rsplit(tag)[1].lstrip()
for ln, line in enumerate(post_header, 1):
if re.search(r"^image:\s+hello$", line):
if re.search(r"^image:\s+%s$"%snpic_name, line):
image_uri = post_header[ln].lstrip()
check_file_uri('image', image_uri, ln + 1)
snshare = True
@ -519,7 +521,7 @@ def check_file_uri(filetype, filename, ln):
fileuri = domain_files + filename[1: len(filename)]
elif filename.startswith('/'):
fileuri = domain_articles + filename[1: len(filename)]
fileuri = tyto.post_dir + filename[1: len(filename)]
else:
fileuri = tyto.post_dir + filename
@ -604,23 +606,22 @@ def check_content(post_bottom):
# Check for all match _TAGS:NAME from content in header
#------------------------------------------------------
set_tags = ()
for ln, line in enumerate(post_bottom):
for tag in tyto.content_tags:
htag = tag[1: len(tag)]
if line.startswith(tag):
tag_id = line.rsplit(':', 1)[1].rsplit(' ')[0]
for htag in tyto.head_tags:
match = False
for hline in post_header:
if hline.startswith(htag):
htag_id = hline.rsplit(':', 1)[1].lstrip()
if htag_id == tag_id:
match = True
break
ptag = '_%s'%htag
if not match:
tyto.exiting("10", "%s %s"%(htag, tag_id), True)
if line.startswith(ptag):
ptag_set = line.rsplit(':', 1)[1].lstrip() # Get set tag
if ptag_set in set_tags: continue
for hline in post_header:
if re.search(r"^%s\s+%s$"%(htag,ptag_set), hline):
match = True
set_tags = (ptag_set)
if match: continue
else: tyto.exiting("10", "%s %s"%(htag, ptag_set), True)
# Template Tags (warning for not paired symbols)

View File

@ -178,9 +178,8 @@ quote_tags = [
('_lang:', 'lang')
]
# Tags to check for header in content
content_tags = ("_image:", '_raw:')
# Tags to check in header in content _TAG
head_tags = ("image:", "raw:")
#=======#
# TOOLS #