navbar creation. Complete rewrite

This commit is contained in:
Cyrille L 2023-03-06 15:27:05 +01:00
parent 1d3322c75b
commit 7bffa6d667
1 changed files with 1 additions and 60 deletions

View File

@ -455,65 +455,6 @@ def create_navbar(option):
return return
# Ask to replace (except from 'publish template')
if not option == 'pub' and os.path.exists(target):
ask_html = ' ├ Replace %s ? '%target
res = ''
try:
res = input(ask_html)
except KeyboardInterrupt:
print('')
logs.out("255", '', True)
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, 'New', menu_html)
print(' ├ Create file: %s'%target)
'''
# An index file must be in the src directory
for f in os.listdir(dir_uri):
print('>>> f=', f)
if f.startswith("index."):
if option == 'wip':
if not os.path.exists(wip_index):
logs.out('26', 'in wip "%s/": %s'%(direc, wip_index), False)
continue
elif option == 'www':
if not os.path.exists(www_index):
logs.out('26', 'in www "%s/": %s'%(direc, www_index), False)
e_www_index = True
continue
else:
logs.out("26", 'in src "%s/": %s'%(direc, dir_uri), False)
e_src_index = True
# Add link to HTML structure
navbar_new = True
menu_item = '\n%s<li class="site_menu_item">\n'%(10 * ' ') + \
'%s<a class="site_menu_link"\n'%(12 * ' ') + \
'%s'%title + \
'%shref="/%s/">%s</a>\n'%(
15 * ' ', direc, direc
) + \
'%s</li>'%(10 * ' ')
menu_html = '%s%s'%(menu_html, menu_item)
if e_src_index or e_www_index:
logs.out("1", '(index article)', True)
# Nothing to do
if not navbar_new:
if not navbar_has:
logs.out('29', '(navbar): %s'%db.navbar_load, False)
return
else:
logs.out('28', '(navbar)', False)
return
# Ask to replace (except from 'publish template') # Ask to replace (except from 'publish template')
if not option == 'pub' and os.path.exists(target): if not option == 'pub' and os.path.exists(target):
ask_html = ' ├ Replace %s ? '%target ask_html = ' ├ Replace %s ? '%target
@ -531,7 +472,7 @@ def create_navbar(option):
menu_html = '\n%s\n%s</ul>\n%s</nav>\n'%(menu_html, 8 * ' ', 6 * ' ') menu_html = '\n%s\n%s</ul>\n%s</nav>\n'%(menu_html, 8 * ' ', 6 * ' ')
tyto.set_file(target, 'New', menu_html) tyto.set_file(target, 'New', menu_html)
print(' ├ Create file: %s'%target) print(' ├ Create file: %s'%target)
'''
#========================================================# #========================================================#
# Create metas.html from _configs/tyto.metas.html # # Create metas.html from _configs/tyto.metas.html #