After weeks of programming and coding, I have finally generated Working A5 Theme. also posting code if anyone is interested.
<table style="
width:100%;
padding:5mm;
font-family:Arial, Helvetica, sans-serif;
font-size:10.5px;
">
<thead>
<tr>
<td colspan="99">
<table style="width:100%; margin-bottom:4mm">
<tr>
{% if business.logo != null %}
<td style="width:18mm; text-align:center">
<img src="{{ business.logo }}" style="max-width:16mm; max-height:16mm">
</td>
{% endif %}
<td style="width:55mm">
<b>{{ recipient.name }}</b> {{ recipient.code }}<br>
{{ recipient.address | newline_to_br }}<br>
{{ recipient.identifier }}
</td>
<td style="width:76mm; text-align:right">
{% for field in fields %}
<b>{{ field.label }}</b><br>
{{ field.text }}<br>
{% endfor %}
</td>
</tr>
<tr>
<td></td>
<td></td>
<td style="text-align:right; padding-top:2mm">
<b>{{ business.name }}</b><br>
{{ business.address | newline_to_br }}<br>
{{ business.identifier }}
</td>
</tr>
</table>
<div style="font-size:11px; font-weight:bold; margin-bottom:3mm">
{{ description }}
</div>
</td>
</tr>
<tr>
{% for column in table.columns %}
<td style="
font-weight:bold;
border:1px solid #888;
padding:1.5mm;
text-align:{{ column.align }};
{% if column.nowrap %}white-space:nowrap;{% endif %}
">
{{ column.label }}
</td>
{% endfor %}
</tr>
</thead>
<tbody>
{% for row in table.rows %}
<tr>
{% for cell in row.cells %}
<td style="
border-left:1px solid #888;
border-right:1px solid #888;
padding:1.5mm;
text-align:{{ table.columns[forloop.index0].align }};
{% if table.columns[forloop.index0].nowrap %}white-space:nowrap;{% endif %}
">
{{ cell.text | newline_to_br }}
</td>
{% endfor %}
</tr>
{% endfor %}
<tr>
{% for column in table.columns %}
<td style="border-bottom:1px solid #888"></td>
{% endfor %}
</tr>
{% for total in table.totals %}
<tr>
<td colspan="{{ table.columns | size | minus:1 }}"
style="padding:1.5mm; text-align:right">
{% if total.emphasis %}<b>{% endif %}
{{ total.label }}
{% if total.emphasis %}</b>{% endif %}
</td>
<td style="border:1px solid #888; padding:1.5mm; text-align:right">
{% if total.emphasis %}<b>{% endif %}
{{ total.text }}
{% if total.emphasis %}</b>{% endif %}
</td>
</tr>
{% endfor %}
<!-- NOTE / CUSTOM FIELD (RESTORED) -->
{% for field in custom_fields %}
<tr>
<td colspan="99" style="
padding-top:4mm;
font-size:10px;
">
<b>{{ field.label }}</b><br>
{{ field.text | newline_to_br }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
1 Like
Great contribution @PRASOON_AGARWAL,
However, this is likely to break in the future as Liquid is being slowly phased out.
I hope @lubos keeps Liquid running until the newer Themes are finalized and a little bit longer as well to help ease user transition.
At one point, I was thinking that writing a Liquid to JS theme translator would help users transition, but I realized that the underlying data is different in each case.
@lubos, would something like this be possible with the newer implementation of Themes?
1 Like