diff --git a/query2html.py b/query2html.py index d00dc70..0d51119 100644 --- a/query2html.py +++ b/query2html.py @@ -96,6 +96,11 @@ for answer in site.ask(query): pagetext_html = pandoc(pwd=wd, content=pagetext, format_in='mediawiki', format_out='html') img_local = os.path.join(imgdir, img_info.get('filename')) + # Todo: Create list of all images from document + # TODO: join document_part + document + # TODO: look into the template structure of images : columns and rows + + # RENDER document part document_part_html = document_part_template.render( printout_dict=printout_dict, diff --git a/sandbox/jinja_tutorial.py b/sandbox/jinja_tutorial.py new file mode 100644 index 0000000..10eb21c --- /dev/null +++ b/sandbox/jinja_tutorial.py @@ -0,0 +1,15 @@ +import os +from jinja2 import Template + +wd = os.path.dirname(os.path.abspath(__file__)) # working directory + +# read template files +with open(os.path.join(wd, '../templates/scatch.html')) as document_html: + template = Template(document_html.read()) + +imgs_list = ['images/01.jpg', 'images/02.jpg', 'images/03.jpg'] + +template_render = template.render(title=':) Hello Sandra', + imgs=imgs_list + ) +print(template_render) \ No newline at end of file diff --git a/templates/scatch.html b/templates/scatch.html new file mode 100644 index 0000000..0ca2714 --- /dev/null +++ b/templates/scatch.html @@ -0,0 +1,13 @@ +

{{ title|upper }}

+ +
+
+ + {% for img in imgs %} + + {% endfor %} + +
+
+ +{{imgs}} \ No newline at end of file