sidebar: create sidebar.html in wip/template
This commit is contained in:
parent
0fa06f997f
commit
4e864d0d1e
|
@ -66,7 +66,7 @@ def post_IDs(file_post):
|
|||
# Set HTML file from file_post
|
||||
file_html = file_post.replace('.tyto','.html')
|
||||
if file_html.endswith('index.html'):
|
||||
file_html = file_html.remplace('index.html', '')
|
||||
file_html = file_html.replace('index.html', '')
|
||||
|
||||
# Complete URL post file
|
||||
global post_url
|
||||
|
|
|
@ -196,7 +196,7 @@ def html_main_page(wip_html):
|
|||
' <h1 id="sidebar-title">%s</h1>\n'%domain.domain_sdb_title + \
|
||||
' <ul id="list-posts"\n' + \
|
||||
' aria-label="$domain_sidebar_title">\n' + \
|
||||
' <!--# include virtual="/template/sidebar.html" -->\n' + \
|
||||
'<!--# include virtual="/template/sidebar.html" -->\n' + \
|
||||
' </ul>\n' + \
|
||||
' </nav>\n' + \
|
||||
' </div>\n' + \
|
||||
|
|
|
@ -82,18 +82,23 @@ def loop_sidebar(create):
|
|||
msg_log = 'Sidebar > Not created. Mismatch some article\'s URI'
|
||||
log.append_f(domain.tyto_logs, msg_log, 1)
|
||||
else:
|
||||
|
||||
print('>', sdb_posts, posts_uri)
|
||||
|
||||
# Create sidebar.html
|
||||
file = open(sidebar_file, 'w')
|
||||
file.close()
|
||||
|
||||
for item, post in sdb_posts, posts_uri:
|
||||
i = 0
|
||||
for item in sdb_posts:
|
||||
db_article = '%s%s.conf'%(domain.domain_db, item)
|
||||
if os.path.exists(db_article):
|
||||
print("OK for",item, post)
|
||||
print("OK for",item, posts_uri[i])
|
||||
create_sdb_item(db_article)
|
||||
else:
|
||||
msg_log = 'Sidebar > Article not yet ready: %s'%post
|
||||
msg_log = 'Sidebar > Article not yet ready: %s'%posts_uri[i]
|
||||
log.append_f(domain.tyto_logs, msg_log, 1)
|
||||
i += 1
|
||||
|
||||
|
||||
#==========================================#
|
||||
|
@ -142,7 +147,7 @@ def create_sdb_item(db_article):
|
|||
|
||||
with open(sidebar_file, 'a') as file:
|
||||
for line in sdb_html_item.rsplit('\n'):
|
||||
file.write('%s%s\n'%(8*' ', line))
|
||||
file.write('%s%s\n'%(16*' ', line))
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -121,11 +121,16 @@ def manage_wip(file_post, Force):
|
|||
print('> Article HTML:\n', wip_html)
|
||||
|
||||
# Create file to wip srv (replace file, if exists)
|
||||
wip_file = '%s%s'%(domain.srv_wip, file_post.replace('.tyto','.html'))
|
||||
wip_file = file_post.replace('.tyto','.html')
|
||||
wip_uri = '%s%s'%(domain.srv_wip, wip_file)
|
||||
wip_dir = wip_uri.replace(os.path.basename(wip_uri), '')
|
||||
if os.path.exists(wip_file):
|
||||
os.remove(wip_file)
|
||||
|
||||
page_file = open(wip_file, 'w')
|
||||
# Create sub folder if needed
|
||||
os.makedirs(wip_dir, exist_ok=True)
|
||||
|
||||
page_file = open(wip_uri, 'w')
|
||||
page_file.write(wip_html)
|
||||
page_file.close()
|
||||
|
||||
|
|
Loading…
Reference in New Issue