fixes. error out for publish navbar if unused index

This commit is contained in:
Cyrille L 2023-03-06 13:09:34 +01:00
parent a1fbf3a1a5
commit 596c06d265
4 changed files with 16 additions and 11 deletions

View File

@ -653,7 +653,6 @@ def check_content(post_bottom):
if tpl1 != tpl2:
logs.out("22", '"%s", "%s"'%(tag[0], tag[1]), False)
post_err = True
#===============================================#

View File

@ -386,9 +386,10 @@ def create_navbar(option):
continue
# Check if an index.[ext] and index.html exist and log
index_src = False
index_wip = False
index_www = False
index_src = False
index_wip = False
index_www = False
e_www_index = False
for f in os.listdir(dir_uri):
# An index file must be in the directory
if f.startswith("index."):
@ -404,6 +405,7 @@ def create_navbar(option):
www_index = '%s%s/index.html'%(db.srv_www, direc)
if not os.path.exists(www_index):
logs.out('26', 'in "%s": %s'%(direc, www_index), False)
e_www_index = True
continue
else:
index_www = True
@ -414,6 +416,9 @@ def create_navbar(option):
logs.out("26", 'in "%s": %s'%(direc, dir_uri), False)
continue
if e_www_index:
logs.out("1", '(index article)', True)
# Add link to HTML structure
navbar_new = True
menu_item = '\n%s<li class="site_menu_item">\n'%(10 * ' ') + \
@ -447,10 +452,10 @@ def create_navbar(option):
if not res in ['y', 'Y']:
logs.out("255", '', True)
# Close HTML tags
menu_html = '\n%s\n%s</ul>\n%s</nav>\n'%(menu_html, 8 * ' ', 6 * ' ')
tyto.set_file(target, True, menu_html)
print(' ├ Create file: %s'%target)
# Close HTML tags
menu_html = '\n%s\n%s</ul>\n%s</nav>\n'%(menu_html, 8 * ' ', 6 * ' ')
tyto.set_file(target, 'New', menu_html)
print(' ├ Create file: %s'%target)
#========================================================#

View File

@ -36,7 +36,7 @@ def out(nbr, value, out):
'4' : ':< %sCannot create file%s: %s'%(CR, CS, value),
'5' : ':< %sUnused argument%s: [file]'%(CR, CS),
'6' : ':< %sUnused "%s"%s in article'%(CR, value, CS),
'7' : ':< Article is %snot valid yet%s'%(CR, CS),
'7' : ':< Article %snot valid yet%s'%(CR, CS),
'8' : ':< %sNot paired%s: %s'%(CR, CS, value),
'9' : ':< Article %shas changed%s. Check it first'%(CR, CS),
'10' : ':< %sUnused domain configuration%s: %s'%(CR, CS, value),
@ -46,7 +46,7 @@ def out(nbr, value, out):
'14' : ':< %sMismatch%s program start'%(CR, CS),
'19' : ':D Article %swip%s on: %s'%(CG, CS, value),
'20' : ':D Article %scheck%s on: %s'%(CG, CS, value),
'21' : ':D %sValid%s article. Ready to wip'%(CG, CS),
'21' : ':D Article %sValid%s. Ready to wip'%(CG, CS),
'22' : ':? %sNot paired%s symbols: %s'%(CY, CS, value),
'23' : ':? %sCorrupted database%s: %s'%(CY, CS, value),
'24' : ':? %sUnused resource%s %s'%(CY, CS, value),

View File

@ -79,7 +79,8 @@ def manage_wip(target):
if not db.db_exists: logs.out("25", db.uri_file, True)
# Exit if article has changed
if db.hash_chk != db.hash_post: logs.out("9", target, True)
if db.hash_chk != db.hash_post:
logs.out("9", db.uri_file, True)
# Compare and check file
if db.hash_wip != db.hash_chk: # Article has changed