some fixes
This commit is contained in:
parent
8b00709200
commit
a71e2e58e6
|
@ -459,12 +459,14 @@ def check_headers(post_header):
|
||||||
)
|
)
|
||||||
|
|
||||||
# snpic (set image to share to social networks)
|
# snpic (set image to share to social networks)
|
||||||
|
#----------------------------------------------
|
||||||
if snpic_name: continue
|
if snpic_name: continue
|
||||||
tag = tyto.headers[11] # snpic:
|
tag = tyto.headers[11] # snpic:
|
||||||
if line.startswith(tag):
|
if line.startswith(tag):
|
||||||
snpic_name = post_header[ln - 1].rsplit(tag)[1].lstrip()
|
snpic_name = post_header[ln - 1].rsplit(tag)[1].lstrip()
|
||||||
|
|
||||||
for ln, line in enumerate(post_header, 1):
|
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()
|
image_uri = post_header[ln].lstrip()
|
||||||
check_file_uri('image', image_uri, ln + 1)
|
check_file_uri('image', image_uri, ln + 1)
|
||||||
snshare = True
|
snshare = True
|
||||||
|
@ -519,7 +521,7 @@ def check_file_uri(filetype, filename, ln):
|
||||||
fileuri = domain_files + filename[1: len(filename)]
|
fileuri = domain_files + filename[1: len(filename)]
|
||||||
|
|
||||||
elif filename.startswith('/'):
|
elif filename.startswith('/'):
|
||||||
fileuri = domain_articles + filename[1: len(filename)]
|
fileuri = tyto.post_dir + filename[1: len(filename)]
|
||||||
|
|
||||||
else:
|
else:
|
||||||
fileuri = tyto.post_dir + filename
|
fileuri = tyto.post_dir + filename
|
||||||
|
@ -604,23 +606,22 @@ def check_content(post_bottom):
|
||||||
|
|
||||||
# Check for all match _TAGS:NAME from content in header
|
# Check for all match _TAGS:NAME from content in header
|
||||||
#------------------------------------------------------
|
#------------------------------------------------------
|
||||||
|
set_tags = ()
|
||||||
for ln, line in enumerate(post_bottom):
|
for ln, line in enumerate(post_bottom):
|
||||||
for tag in tyto.content_tags:
|
for htag in tyto.head_tags:
|
||||||
htag = tag[1: len(tag)]
|
|
||||||
|
|
||||||
if line.startswith(tag):
|
|
||||||
tag_id = line.rsplit(':', 1)[1].rsplit(' ')[0]
|
|
||||||
|
|
||||||
match = False
|
match = False
|
||||||
for hline in post_header:
|
ptag = '_%s'%htag
|
||||||
if hline.startswith(htag):
|
|
||||||
htag_id = hline.rsplit(':', 1)[1].lstrip()
|
|
||||||
if htag_id == tag_id:
|
|
||||||
match = True
|
|
||||||
break
|
|
||||||
|
|
||||||
if not match:
|
if line.startswith(ptag):
|
||||||
tyto.exiting("10", "%s %s"%(htag, tag_id), True)
|
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)
|
# Template Tags (warning for not paired symbols)
|
||||||
|
|
|
@ -178,9 +178,8 @@ quote_tags = [
|
||||||
('_lang:', 'lang')
|
('_lang:', 'lang')
|
||||||
]
|
]
|
||||||
|
|
||||||
# Tags to check for header in content
|
# Tags to check in header in content _TAG
|
||||||
content_tags = ("_image:", '_raw:')
|
head_tags = ("image:", "raw:")
|
||||||
|
|
||||||
|
|
||||||
#=======#
|
#=======#
|
||||||
# TOOLS #
|
# TOOLS #
|
||||||
|
|
Loading…
Reference in New Issue