template for document_part with all the metadata

andre
Castro0o 5 years ago
parent 6926a5cfa2
commit 03bb5ab272

@ -83,10 +83,9 @@ for answer in site.ask(query):
img_local = os.path.join(imgdir, img_info.get('filename'))
# render html for that part of the document
document_part_html = pub_part_template.render(
printout_dict=printout_dict,
imgsrc=os.path.join(imgdir, img_info.get('filename')),
text=pagetext_html,
part=printout_dict.get('Part'),
partof=printout_dict.get('Partof'))
text=pagetext_html)
all_document_parts += document_part_html # append resulting html from document part to the previous parts
if printout_dict['Part'] == printout_dict['Partof']: # when Part == Partof
# pass all_document_parts html to pub_template content

@ -1,3 +1,12 @@
body{font-size: 12pt;}
div.part {border: 1px solid #e5e5e5;
margin-bottom: 10px;
margin-top: 10px;
padding: 20px;}
div#content img {width: 50%;}
div.metadata span.key {color: red;
font-weight: bold;}

@ -7,7 +7,7 @@
</head>
<body>
<h1>{{ title }}</h1>
<p><time datetime="{{date}}">{{ date.year }} {{ date.month }} {{ date.day }} </time></p>
<p><time datetime="{{date}}">{{ date.year }}.{{ date.month }}.{{ date.day }} </time></p>
<div id="content">
{{ content }}
</div>

@ -1,11 +1,28 @@
<div class="part">
<div class="img">
<img src="{{ imgsrc }}" />
</div>
<div class="text">
{{ text | safe }}
</div>
<div class="part">
Part {{part}} of {{partof}}
<div class="metadata">
<h3>Metadata</h3>
{% for key, value in printout_dict.items() %}
{% if key == 'Date' %}
<div class="metadata_{{key}}">
<span class="key">{{key}}</span>
<span class="value">{{value.year}} {{value.month}} {{value.day}}</span>
</div>
{% else %}
<div class="metadata_{{key}}">
<span class="key">{{key|upper}}</span>
<span class="value">{{value}}</span>
</div>
{% endif %}
{% endfor %}
</div>
</div>
Loading…
Cancel
Save