lots of new littles things. Better wip management
This commit is contained in:
parent
0bc41f2660
commit
9a407e8e61
|
@ -54,7 +54,9 @@ options = {
|
||||||
'-R' : "Remove", 'remove' : "Remove",
|
'-R' : "Remove", 'remove' : "Remove",
|
||||||
'-n' : "New", 'new' : "New",
|
'-n' : "New", 'new' : "New",
|
||||||
'-e' : "Edit", 'edit' : "Edit",
|
'-e' : "Edit", 'edit' : "Edit",
|
||||||
'-F' : "Force", 'force' : "Force"
|
'-F' : "Force", 'force' : "Force",
|
||||||
|
'-s' : "Show",
|
||||||
|
'-d' : 'DB'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set Argument 2 or 3
|
# Set Argument 2 or 3
|
||||||
|
|
|
@ -28,6 +28,7 @@ import tyto
|
||||||
if tyto.domain_exists: exec(open(tyto.domain_conf).read())
|
if tyto.domain_exists: exec(open(tyto.domain_conf).read())
|
||||||
|
|
||||||
post_err = False
|
post_err = False
|
||||||
|
date_wip = hash_wip = date_www = hash_www = ''
|
||||||
|
|
||||||
|
|
||||||
#=========================#
|
#=========================#
|
||||||
|
@ -48,8 +49,20 @@ def manage_check(target, option):
|
||||||
if option == 'Edit':
|
if option == 'Edit':
|
||||||
tyto.edit_file(tyto.uri_root)
|
tyto.edit_file(tyto.uri_root)
|
||||||
return
|
return
|
||||||
|
elif option == 'Show':
|
||||||
|
article_raw = open(tyto.uri_root).read()
|
||||||
|
for line in article_raw.rsplit('\n'):
|
||||||
|
print(line)
|
||||||
|
return
|
||||||
|
|
||||||
if db_exists:
|
if db_exists:
|
||||||
|
# Just read the DB from command
|
||||||
|
if option == 'DB':
|
||||||
|
article_db = open(tyto.post_db).read()
|
||||||
|
for line in article_db.rsplit('\n'):
|
||||||
|
print(line)
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
exec(open(tyto.post_db).read(),globals())
|
exec(open(tyto.post_db).read(),globals())
|
||||||
try:
|
try:
|
||||||
|
@ -64,6 +77,7 @@ def manage_check(target, option):
|
||||||
|
|
||||||
# Specific to inline-code: check markers on same line
|
# Specific to inline-code: check markers on same line
|
||||||
check_icodes(article.rsplit('\n'))
|
check_icodes(article.rsplit('\n'))
|
||||||
|
|
||||||
# Protect inline-codes
|
# Protect inline-codes
|
||||||
tyto.protect_icodes(post_bottom, article_bottom)
|
tyto.protect_icodes(post_bottom, article_bottom)
|
||||||
post_bottom = tyto.protect_article.rsplit('\n')
|
post_bottom = tyto.protect_article.rsplit('\n')
|
||||||
|
@ -609,12 +623,13 @@ def create_database():
|
||||||
'wip_uri = "%s%s"\n'%(srv_wip, web_uri) + \
|
'wip_uri = "%s%s"\n'%(srv_wip, web_uri) + \
|
||||||
'www_uri = "%s%s"\n'%(srv_www, web_uri) + \
|
'www_uri = "%s%s"\n'%(srv_www, web_uri) + \
|
||||||
'http_uri = "%s"\n'%tyto.web_uri + \
|
'http_uri = "%s"\n'%tyto.web_uri + \
|
||||||
|
'\n' + \
|
||||||
'date_chk = "%s"\n'%tyto.nowdate() + \
|
'date_chk = "%s"\n'%tyto.nowdate() + \
|
||||||
'hash_chk = "%s"\n'%tyto.hash_post + \
|
'hash_chk = "%s"\n'%tyto.hash_post + \
|
||||||
'date_wip = ""\n' + \
|
'date_wip = "%s"\n'%date_wip + \
|
||||||
'hash_wip = ""\n' + \
|
'hash_wip = "%s"\n'%hash_wip + \
|
||||||
'date_www = ""\n' + \
|
'date_www = "%s"\n'%date_www + \
|
||||||
'hash_www = ""\n' + \
|
'hash_www = "%s"\n'%hash_www + \
|
||||||
'\n# Post configuration from needed tags\n' + \
|
'\n# Post configuration from needed tags\n' + \
|
||||||
'title = "%s"\n'%title + \
|
'title = "%s"\n'%title + \
|
||||||
'about = "%s"\n'%about + \
|
'about = "%s"\n'%about + \
|
||||||
|
|
|
@ -29,7 +29,7 @@ def manage_domain(target, option):
|
||||||
print(":D Edit domain configuration file:", tyto.domain_conf)
|
print(":D Edit domain configuration file:", tyto.domain_conf)
|
||||||
tyto.edit_file(tyto.domain_conf)
|
tyto.edit_file(tyto.domain_conf)
|
||||||
|
|
||||||
if option == 'New':
|
elif option == 'New':
|
||||||
if not tyto.domain_exists:
|
if not tyto.domain_exists:
|
||||||
create_domain(target)
|
create_domain(target)
|
||||||
else:
|
else:
|
||||||
|
@ -38,6 +38,12 @@ def manage_domain(target, option):
|
||||||
if ask in ['y', 'Y']: create_domain(target)
|
if ask in ['y', 'Y']: create_domain(target)
|
||||||
else: tyto.exiting("255", '', True)
|
else: tyto.exiting("255", '', True)
|
||||||
|
|
||||||
|
elif option == 'DB' or option == 'Show':
|
||||||
|
if tyto.domain_exists:
|
||||||
|
domain_db = open(tyto.domain_conf).read()
|
||||||
|
for line in domain_db.rsplit('\n'):
|
||||||
|
print(line)
|
||||||
|
|
||||||
|
|
||||||
#=====================#
|
#=====================#
|
||||||
# Check target if URL #
|
# Check target if URL #
|
||||||
|
|
|
@ -392,7 +392,7 @@ def protect_bcodes_quotes(process, post_bottom, article_bottom):
|
||||||
|
|
||||||
# Count titles for check
|
# Count titles for check
|
||||||
# Pass if line is a comment
|
# Pass if line is a comment
|
||||||
if not in_bcode or not in_quote:
|
if not in_bcode and not in_quote:
|
||||||
if line.startswith(titles_tags):
|
if line.startswith(titles_tags):
|
||||||
if process == 'check':
|
if process == 'check':
|
||||||
nbr_titles += 1
|
nbr_titles += 1
|
||||||
|
@ -404,6 +404,7 @@ def protect_bcodes_quotes(process, post_bottom, article_bottom):
|
||||||
else: bcode = '%s\n%s'%(bcode, line)
|
else: bcode = '%s\n%s'%(bcode, line)
|
||||||
|
|
||||||
elif in_quote:
|
elif in_quote:
|
||||||
|
if line.startswith('#'): continue
|
||||||
if not quote: quote = line
|
if not quote: quote = line
|
||||||
else: quote = '%s\n%s'%(quote, line)
|
else: quote = '%s\n%s'%(quote, line)
|
||||||
|
|
||||||
|
@ -482,13 +483,13 @@ def exiting(nbr, value, out):
|
||||||
'6' : ':< %sUnused "%s"%s in article'%(CR, CS, value),
|
'6' : ':< %sUnused "%s"%s in article'%(CR, CS, value),
|
||||||
'7' : ':< Article is %snot valid yet%s'%(CR, CS),
|
'7' : ':< Article is %snot valid yet%s'%(CR, CS),
|
||||||
'8' : ':< %sNot paired%s: %s'%(CR, CS, value),
|
'8' : ':< %sNot paired%s: %s'%(CR, CS, value),
|
||||||
'9' : ':D Article has changed (wip is old)',
|
'9' : ':< Article %shas changed%s. Check it first'%(CR, CS),
|
||||||
'10' : ':< %sUnused "%s"%s in article\'s header'%(CR, value, CS),
|
'10' : ':< %sUnused "%s"%s in article\'s header'%(CR, value, CS),
|
||||||
'20' : ':D %sUp-to-date%s article on: %s'%(CG, CS, value),
|
'20' : ':D %sUp-to-date%s article on: %s'%(CG, CS, value),
|
||||||
'21' : ':D %sValid%s article to wip'%(CG, CS),
|
'21' : ':D %sValid%s article. Ready to wip'%(CG, CS),
|
||||||
'22' : ':? %sNot paired%s symbols: %s'%(CY, CS, value),
|
'22' : ':? %sNot paired%s symbols: %s'%(CY, CS, value),
|
||||||
'23' : ':? %sCorrupted database%s: %s'%(CY, CS, value),
|
'23' : ':? %sCorrupted database%s: %s'%(CY, CS, value),
|
||||||
'24' : ':? %sMissing wip file%s: %s'%(CY, CS, value),
|
'24' : ':? %sfile missing%s (wip article): %s'%(CY, CS, value),
|
||||||
'255' : ':| Maybe later...'
|
'255' : ':| Maybe later...'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,30 +29,23 @@ def manage_wip(target, option):
|
||||||
if not db_exists:
|
if not db_exists:
|
||||||
tyto.exiting("4", '', True)
|
tyto.exiting("4", '', True)
|
||||||
|
|
||||||
# Has DB: conditions to process
|
|
||||||
is_wip = True
|
|
||||||
is_new = False
|
|
||||||
is_file = True
|
|
||||||
do_wip = False
|
|
||||||
|
|
||||||
# Load DB
|
# Load DB
|
||||||
exec(open(tyto.post_db).read(),globals())
|
exec(open(tyto.post_db).read(),globals())
|
||||||
|
|
||||||
|
# Exit if article has changed
|
||||||
|
if hash_chk != tyto.hash_post: tyto.exiting("9", '', True)
|
||||||
|
|
||||||
# In any case, if Force
|
# In any case, if Force
|
||||||
if option == 'Force':
|
if option == 'Force':
|
||||||
wip_article(target)
|
wip_article(target)
|
||||||
return
|
return
|
||||||
|
|
||||||
# Compare and check file
|
# Compare and check file
|
||||||
if not hash_wip == hash_chk: is_wip = False ; do_wip = True
|
if hash_wip != hash_chk:
|
||||||
if not hash_wip == tyto.hash_post: is_new = True ; do_wip = True
|
wip_article(target)
|
||||||
if not os.path.exists(wip_uri): is_file = False ; do_wip = True
|
else:
|
||||||
|
if not os.path.exists(wip_uri):
|
||||||
if do_wip:
|
tyto.exiting("24", wip_uri, False)
|
||||||
# Show message if wip was done
|
|
||||||
if hash_wip:
|
|
||||||
if not is_file: tyto.exiting("24", wip_uri, False)
|
|
||||||
if is_new: tyto.exiting("9", '', False)
|
|
||||||
wip_article(target)
|
wip_article(target)
|
||||||
else:
|
else:
|
||||||
tyto.exiting("20", date_wip, True)
|
tyto.exiting("20", date_wip, True)
|
||||||
|
|
Loading…
Reference in New Issue