remove document parts leftovers; saving document template rendering to disk

itempage
Castro0o 5 years ago
parent 239bd2cb08
commit 2636d37b97

@ -74,9 +74,6 @@ with open(os.path.join(wd, 'templates/index.html')) as document_html:
with open(os.path.join(wd, 'templates/document.html')) as document_html: with open(os.path.join(wd, 'templates/document.html')) as document_html:
document_template = Template(document_html.read()) document_template = Template(document_html.read())
with open(os.path.join(wd, 'templates/document_part.html')) as document_html:
document_part_template = Template(document_html.read())
all_document_parts = '' # to append all content all_document_parts = '' # to append all content
documentslist = [] documentslist = []
document_images = [] document_images = []
@ -95,7 +92,6 @@ for answer in site.ask(query):
img_local = os.path.join(imgdir, img_info.get('filename')) img_local = os.path.join(imgdir, img_info.get('filename'))
# TODO: join document_part + document
# TODO: look into the template structure of images : columns and rows # TODO: look into the template structure of images : columns and rows
document_images.append(img_local) document_images.append(img_local)
@ -113,28 +109,27 @@ for answer in site.ask(query):
content=all_document_parts) # render document template content=all_document_parts) # render document template
# print(document_html) # print(document_html)
# htmlpage_fn = "{}.html".format( htmlpage_fn = "{}.html".format(
# remove_nonwords(printout_dict.get('Title')[0]) remove_nonwords(printout_dict.get('Title')[0])
# ) )
# with open(os.path.join(static_html, htmlpage_fn), 'w') as htmlfile: with open(os.path.join(static_html, htmlpage_fn), 'w') as htmlfile:
# htmlfile.write(document_html) htmlfile.write(document_html)
# all_document_parts = '' # Reset all_document_parts
# # add info to documentslist for index creation # add info to documentslist for index creation
# documentslist.append({'file': htmlpage_fn, documentslist.append({'file': htmlpage_fn,
# 'title': printout_dict.get('Title'), 'title': printout_dict.get('Title'),
# 'date': printout_dict.get('Date'), 'date': printout_dict.get('Date'),
# 'creator': printout_dict.get('Creator') 'creator': printout_dict.get('Creator')
# }) })
# reset document_images list # reset document_images list
document_images = [] document_images = []
# # RENDER index.html from documentslist # RENDER index.html from documentslist
# index_html = index_template.render(index='Index', index_html = index_template.render(index='Index',
# query=query, query=query,
# documentslist=documentslist) documentslist=documentslist)
# with open(os.path.join(static_html, 'index.html'), 'w') as htmlfile: with open(os.path.join(static_html, 'index.html'), 'w') as htmlfile:
# htmlfile.write(index_html) htmlfile.write(index_html)

Loading…
Cancel
Save