Preparing check process, head tags in article

This commit is contained in:
Cyrille L 2023-09-30 17:49:56 +02:00
parent c530449369
commit fed0227968
3 changed files with 36 additions and 10 deletions

View File

@ -49,12 +49,12 @@ def get_action():
# Target arguments #
#------------------#
def get_target():
global target, multiple
global target, targets
try: target = sys.argv[2]
except: target = ""
multiple = False
if target == "all": multiple = True
targets = False
if target == "all": targets = True
#================================#

View File

@ -55,7 +55,7 @@ def ready():
#-------------------------------------------#
def manage(action, target):
# target is "all"
if args.multiple:
if args.targets:
multiple_targets
return
@ -76,17 +76,27 @@ def is_article(target):
sys.exit(post.error)
head_contents()
validators()
if post.error != 0:
if args.multiple:
if args.targets:
return # Let other articles pass
sys.exit(post.error)
print("pass", post.error, args.multiple)
#
#
#
def validators():
targets = args.targets
post.error == 0 and ol_tags() or tools.exit(targets, post.error)
#===========================================#
# # Create a loop to get all .tyto articles #
# Create a loop to get all .tyto articles #
#-------------------------------------------#
def multiple_targets():
ready()
@ -95,7 +105,7 @@ def multiple_targets():
#=======================#
# check header contents #
#-----------------------#
def head_contents():
def ol_tags():
for ln, line in enumerate(post.head_contents.rsplit("\n"), 1):
if not line or line.isspace() or line.startswith("#"): continue
@ -123,7 +133,7 @@ def head_contents():
if not is_ol_tag(post.about[0], post.about[1]): return
if not is_ol_tag(post.date[0], post.date[1]): return
if not is_ol_tag(post.author[0], post.author[1]): return
if not is_ol_tag(post.tags[0], post.tags[1]): return
if not is_ol_tag(post.tags[0], post.tags[1]): return
#===========================================#
@ -157,3 +167,10 @@ def is_ol_tag(tag, value):
return False
return True
#
#
#
def valid_date():

View File

@ -33,10 +33,19 @@
#--------------------------
from hashlib import blake2b
import os, configparser, datetime, time
import sys, os, configparser, datetime, time
import debug, domain
#
#
#
def exit(targets, error):
if targets: return
sys.exit(error)
#==============================#
# Set and return date and time #
# With local options from lang #