Update default sequence HTML template

This commit is contained in:
D. Berge
2021-05-20 20:37:37 +02:00
parent 1089d1fe75
commit 1649de6c68

View File

@@ -6,13 +6,17 @@
<style> <style>
@media print { @media print {
html, table { body, html, table {
font-size: 10px !important; font-size: 10px !important;
} }
a { a {
text-decoration: none; text-decoration: none;
} }
tr.aside {
font-size: 8px !important;
}
} }
html { html {
@@ -66,22 +70,26 @@ main {
margin-bottom: 25px; margin-bottom: 25px;
} }
table#summary td:nth-of-type(1) { table.summary td:nth-of-type(1) {
text-align: right; text-align: right;
padding-inline-start: 1em; padding-inline-start: 1em;
} }
table#summary td:nth-of-type(2) { table.summary td:nth-of-type(2) {
font-size: smaller; font-size: smaller;
vertical-align: middle; vertical-align: middle;
text-align: right; text-align: right;
} }
#comments { .comments {
margin-top: 1em; margin-top: 1em;
margin-bottom: 1em; margin-bottom: 1em;
} }
div.sequence:not(:nth-of-type(1)) {
break-before: page;
}
.comment { .comment {
margin: 0.5em 2em; margin: 0.5em 2em;
border: thin solid lightgray; border: thin solid lightgray;
@@ -95,19 +103,74 @@ table#summary td:nth-of-type(2) {
font-style: italic; font-style: italic;
} }
table#events th, table.events th,
table#events td { table.events td {
padding: 4pt 8pt; padding: 4pt 8pt;
} }
table#events tr > td:nth-of-type(1) { table.events tr > td:nth-of-type(1) {
text-align: right; text-align: right;
} }
table#events tr > td:nth-of-type(3) { table.events tr > td:nth-of-type(3) {
min-width: 20ex; min-width: 20ex;
} }
/*
* In this section we deal with equipment
*/
div.equipment-details {
display: flex;
flex-direction: row;
flex-wrap: wrap;
column-gap: 2em;
row-gap: 2em;
}
/* Bug in Firefox: causes the content to overlap
div.equipment-details table {
break-inside: avoid;
}
*/
/* So we try this instead */
div.equipment {
break-inside: avoid;
}
table.equipment {
margin-bottom: 2em;
font-size: 80%;
}
table.equipment thead {
border-bottom: 1px solid darkgray;
}
table.equipment tbody + tbody::before {
content: "";
display: table-row;
height: 1.2em;
}
table.equipment tr.aside {
font-size: small;
color: gray;
}
/*
Get rid of Markdown-induced paragraph spacing
while respecting inter-paragraph margins.
*/
table.equipment p:nth-of-type(1) {
margin-top: 0;
}
table.equipment p:nth-last-of-type(1) {
margin-bottom: 0;
}
footer { footer {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
@@ -135,9 +198,10 @@ footer {
{% for Sequence in Sequences %} {% for Sequence in Sequences %}
{% set Begin = Sequence.Entries | find("EntryTypeId", 3000) %} {% set Begin = Sequence.Entries | find("EntryTypeId", 3000) %}
{% set End = Sequence.Entries | find("EntryTypeId", 3007) %} {% set End = Sequence.Entries | find("EntryTypeId", 3007) %}
<div class="sequence" id="sequence-{{ Sequence.SequenceNumber |padStart(3, "0") }}">
<h2>Sequence {{ Sequence.SequenceNumber |padStart(3, "0") }} ({{Begin.LineType}}{% if End.IsNTBP %} NTBP{% endif %})</h2> <h2>Sequence {{ Sequence.SequenceNumber |padStart(3, "0") }} ({{Begin.LineType}}{% if End.IsNTBP %} NTBP{% endif %})</h2>
<table id="summary"> <table class="summary">
<tr> <tr>
<th>Line</th> <th>Line</th>
<td>{{Sequence.DglSailline}}</td> <td>{{Sequence.DglSailline}}</td>
@@ -181,7 +245,7 @@ footer {
{% if Begin.Reshoot %}Reshoot{% endif -%} {% if Begin.Reshoot %}Reshoot{% endif -%}
<div id="comments"> <div class="comments">
<h3>Sequence comments</h3> <h3>Sequence comments</h3>
{% for Comment in Sequence.DglSequenceComments %} {% for Comment in Sequence.DglSequenceComments %}
@@ -191,10 +255,10 @@ footer {
{% if not Sequence.DglSequenceComments %}<div class="nocomment">(Nil)</div>{% endif %} {% if not Sequence.DglSequenceComments %}<div class="nocomment">(Nil)</div>{% endif %}
</div> </div>
<div id="events"> <div class="events">
<h3>Events</h3> <h3>Events</h3>
<table id="events"> <table class="events">
<thead> <thead>
<tr> <tr>
<th>Shotpoint</th> <th>Shotpoint</th>
@@ -209,13 +273,54 @@ footer {
<td>{{ Entry.ShotPointId }}</td> <td>{{ Entry.ShotPointId }}</td>
<td>{{Entry.Time |timestamp}}</td> <td>{{Entry.Time |timestamp}}</td>
<td>{{Entry.EntryType |join("<br/>")}}</td> <td>{{Entry.EntryType |join("<br/>")}}</td>
<td>{{Entry.Comment |join("<br/>")}}</td> <td>{{Entry.Comment |unique |join("<br/>")}}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
</div> </div> <!-- events -->
{% if Sequence.DglEquipmentInfo.length %}
<div class="equipment">
<h3>Equipment Info</h3>
<div class="equipment-details">
{% for kind, items in Sequence.DglEquipmentInfo |sort(false, false, "kind") | groupby("kind") %}
<div> <!-- Needed because flex -->
<table class="equipment">
<thead>
<tr>
<th colspan="2">{{kind}}</th>
</tr>
</thead>
{% for item in items |sort(true, false, "tstamp") %}
<tbody>
{% if item.description %}
<tr>
<td colspan="2">{{item.description |markdown}}</td>
</tr>
{% endif %}
{% for attr in item.attributes %}
<tr>
<th>{{attr.key}}</th>
<td>{{attr.value |markdownInline}}</td>
</tr>
{% endfor %}
<tr class="aside">
<td>Last update:</td>
<td>{{item.tstamp.substring(0,10)}}</td>
</tr>
</tbody>
{% endfor %}
</table>
</div> <!-- Needed because flex -->
{% endfor %}
</div> <!-- equipment-details -->
</div> <!-- equipment -->
{% endif %}
</div> <!-- sequence -->
{% endfor %} {% endfor %}
</main> </main>