diff --git a/query2html.py b/query2html.py index 8ef0332..15749de 100644 --- a/query2html.py +++ b/query2html.py @@ -76,7 +76,7 @@ with open(os.path.join(wd, 'templates/document.html')) as document_html: all_document_parts = '' # to append all content documentslist = [] -document_images = [] +doc_imgs = [] for answer in site.ask(query): # publication_title = '' @@ -94,18 +94,23 @@ for answer in site.ask(query): # TODO: look into the template structure of images : columns and rows - document_images.append(img_local) + doc_imgs.append(img_local) # on last File(Part) of Document if printout_dict['Part'] == printout_dict['Partof']: - print(document_images) + print(doc_imgs) + + # organize doc_imgs into a matrix (list of lists) + # each sublist containing 4 items [[0,1,2,3][4,5,6,7],[8,9]] + # for template + doc_imgs_matrix = [doc_imgs[i:i+4] for i in range(0, len(doc_imgs), 4)] # RENDER DOCUMENT # by passing all_document_parts html to document_template content document_html = document_template.render( title=printout_dict.get('Title'), date=printout_dict.get('Date'), - imgslist=document_images, + imgsmatrix=doc_imgs_matrix, content=all_document_parts) # render document template # print(document_html) @@ -123,7 +128,7 @@ for answer in site.ask(query): }) # reset document_images list - document_images = [] + doc_imgs = [] diff --git a/static/style.css b/static/style.css index 27fbd59..f42e415 100644 --- a/static/style.css +++ b/static/style.css @@ -1,14 +1,11 @@ -body{font-size: 12pt;} -div.part {border: 1px solid #e5e5e5; - margin-bottom: 10px; - margin-top: 10px; - padding: 20px;} -div#content img {width: 50%;} +body { + margin: 0; + font-family: Arial, Helvetica, sans-serif; + background-color: #aaa4a0; +} - -div.metadata span.key {color: red; - font-weight: bold;} - -#orc {color:blue;} \ No newline at end of file +div.row {display: inline;} +div.column { display: inline;} +div.column img{ width:25%;} \ No newline at end of file diff --git a/templates/document.html b/templates/document.html index 0ed3ba0..bd3e46f 100644 --- a/templates/document.html +++ b/templates/document.html @@ -8,11 +8,33 @@

{{ title[0] }}

-
- {% for img in imgslist %} - + + + {% for row in imgsmatrix %} +
+ {% for img in row %} +
+ +
+ {% endfor %} +
{% endfor %} -
+ - +{# +
+
+ +
+
+ +
+
+ +
+
+ +
+
+#} \ No newline at end of file