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 # # Target arguments #
#------------------# #------------------#
def get_target(): def get_target():
global target, multiple global target, targets
try: target = sys.argv[2] try: target = sys.argv[2]
except: target = "" except: target = ""
multiple = False targets = False
if target == "all": multiple = True if target == "all": targets = True
#================================# #================================#

View File

@ -55,7 +55,7 @@ def ready():
#-------------------------------------------# #-------------------------------------------#
def manage(action, target): def manage(action, target):
# target is "all" # target is "all"
if args.multiple: if args.targets:
multiple_targets multiple_targets
return return
@ -76,17 +76,27 @@ def is_article(target):
sys.exit(post.error) sys.exit(post.error)
head_contents() validators()
if post.error != 0: if post.error != 0:
if args.multiple: if args.targets:
return # Let other articles pass return # Let other articles pass
sys.exit(post.error) sys.exit(post.error)
print("pass", post.error, args.multiple) 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(): def multiple_targets():
ready() ready()
@ -95,7 +105,7 @@ def multiple_targets():
#=======================# #=======================#
# check header contents # # check header contents #
#-----------------------# #-----------------------#
def head_contents(): def ol_tags():
for ln, line in enumerate(post.head_contents.rsplit("\n"), 1): for ln, line in enumerate(post.head_contents.rsplit("\n"), 1):
if not line or line.isspace() or line.startswith("#"): continue if not line or line.isspace() or line.startswith("#"): continue
@ -157,3 +167,10 @@ def is_ol_tag(tag, value):
return False return False
return True return True
#
#
#
def valid_date():

View File

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