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