html: in-dev of sidebar fonction : create sidebar.html in wip/template
This commit is contained in:
parent
56bfa10767
commit
0fa06f997f
|
@ -58,6 +58,7 @@ def loop_sidebar(create):
|
||||||
max_items = int(domain.domain_sdb_items) + 1
|
max_items = int(domain.domain_sdb_items) + 1
|
||||||
counter = 0 # To not set more than set in config
|
counter = 0 # To not set more than set in config
|
||||||
sdb_loaded = (open(domain.domain_sdb_load)).read()
|
sdb_loaded = (open(domain.domain_sdb_load)).read()
|
||||||
|
|
||||||
for line in sdb_loaded.rsplit('\n'):
|
for line in sdb_loaded.rsplit('\n'):
|
||||||
if create : print(line)
|
if create : print(line)
|
||||||
elif line.startswith('#'): continue
|
elif line.startswith('#'): continue
|
||||||
|
@ -81,6 +82,10 @@ def loop_sidebar(create):
|
||||||
msg_log = 'Sidebar > Not created. Mismatch some article\'s URI'
|
msg_log = 'Sidebar > Not created. Mismatch some article\'s URI'
|
||||||
log.append_f(domain.tyto_logs, msg_log, 1)
|
log.append_f(domain.tyto_logs, msg_log, 1)
|
||||||
else:
|
else:
|
||||||
|
# Create sidebar.html
|
||||||
|
file = open(sidebar_file, 'w')
|
||||||
|
file.close()
|
||||||
|
|
||||||
for item, post in sdb_posts, posts_uri:
|
for item, post in sdb_posts, posts_uri:
|
||||||
db_article = '%s%s.conf'%(domain.domain_db, item)
|
db_article = '%s%s.conf'%(domain.domain_db, item)
|
||||||
if os.path.exists(db_article):
|
if os.path.exists(db_article):
|
||||||
|
@ -135,7 +140,7 @@ def create_sdb_item(db_article):
|
||||||
' </a>\n' + \
|
' </a>\n' + \
|
||||||
'</li>'
|
'</li>'
|
||||||
|
|
||||||
with open(sidebar_file, 'w') as file:
|
with open(sidebar_file, 'a') as file:
|
||||||
for line in sdb_html_item.rsplit('\n'):
|
for line in sdb_html_item.rsplit('\n'):
|
||||||
file.write('%s%s\n'%(8*' ', line))
|
file.write('%s%s\n'%(8*' ', line))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue