Preparing check process, head tags in article
This commit is contained in:
parent
c530449369
commit
fed0227968
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
#================================#
|
#================================#
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
@ -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.about[0], post.about[1]): return
|
||||||
if not is_ol_tag(post.date[0], post.date[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.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 False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
def valid_date():
|
||||||
|
|
||||||
|
|
|
@ -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 #
|
||||||
|
|
Loading…
Reference in New Issue