+{% import '_macros.tmpl' as macros %}
<!DOCTYPE html>
<html>
<head>
--- /dev/null
+{% macro css_value_line() %}
+td.amt { text-align: right }
+td.amt, td.curr { font-family: monospace; font-size: 1.3em; }
+td.curr { text-align: center; }
+{% endmacro %}
+
+{% macro table_dat_lines(dat_lines, single, raw) %}
+<table>
+{% for dat_line in dat_lines %}
+ {% if (not (raw or single)) and dat_line.type == "intro" and loop.index > 1 %}
+ <tr><td colspan=5> </td></tr>
+ {% endif %}
+ <tr class="{{dat_line.type}}">
+ {% if not single %}
+ {% if dat_line.type == "intro" %}
+ <td id="{{dat_line.booking_id}}"><a href="#{{dat_line.booking_id}}">#</a></td>
+ {% else %}
+ <td></td>
+ {% endif %}
+ {% endif %}
+ {% if raw %}
+ {% if dat_line.type == "intro" %}
+ <td><a href="/booking/{{dat_line.booking_id}}"/>{{dat_line.raw_nbsp}}</a></td>
+ {% else %}
+ <td>{{dat_line.raw_nbsp}}</td>
+ {% endif %}
+ {% else %}
+ {% if dat_line.type == "intro" %}
+ <td class="code" colspan=3><a href="/booking/{{dat_line.booking_id}}">{{dat_line.code}}</a></td>
+ {% elif dat_line.type == "value" %}
+ <td class="amt">{{dat_line.booking_line.amt}}</td>
+ <td class="curr">{{dat_line.booking_line.curr|truncate(4,true,"…")}}</td>
+ <td>{{dat_line.booking_line.acc}}</td>
+ {% else %}
+ <td colspan=3>{{dat_line.code}}</td>
+ {% endif %}
+ <td>{{dat_line.comment}}</td>
+ {% endif %}
+ </tr>
+{% endfor %}
+</table>
+{% endmacro %}
{% extends '_base.tmpl' %}
{% block css %}
-td.amt { text-align: right }
-td.amt, td.curr { font-family: monospace; font-size: 1.3em; }
-td.curr { text-align: center; }
+{{ macros.css_value_line() }}
{% endblock %}
{% block content %}
-<table>
-{% for l in dat_lines %}
- <tr class="{{l.type}}">
- {% if l.type == "value" %}
- <td class="amt">{{l.booking_line.amt}}</td><td class="curr">{{l.booking_line.curr|truncate(4,true,"…")}}</td><td>{{l.booking_line.acc}}</td>
- {% elif l.type == "intro" %}
- <td class="code" colspan=3><a href="/booking/{{l.booking_id}}">{{l.code}}</a></td>
- {% else %}
- <td colspan=3>{{l.code}}</td>
- {% endif %}
- <td>{{l.comment}}</td>
- </tr>
-{% endfor %}
-</table>
+{{ macros.table_dat_lines(dat_lines, single=true, raw=false) }}
{% endblock %}
{% extends '_base.tmpl' %}
{% block css %}
-td.amt { text-align: right }
-td.amt, td.curr { font-family: monospace; font-size: 1.3em; }
-td.curr { text-align: center; }
+{{ macros.css_value_line() }}
{% endblock %}
{% block content %}
<form action="/" method="POST"><input type="submit" value="A" /></form>
<form action="/" method="GET"><input type="submit" value="B" /></form>
<hr/>
-<table>
-{% for l in dat_lines %}
- {% if "intro" == l.type and loop.index > 1 %}<tr><td colspan=5> </td></tr>{% endif %}
- <tr class="{{l.type}}">
- {% if l.type == "intro" %}
- <td id="{{l.booking_id}}"><a href="#{{l.booking_id}}">#</a></td>
- {% else %}
- <td></td>
- {% endif %}
- {% if l.type == "value" %}
- <td class="amt">{{l.booking_line.amt}}</td><td class="curr">{{l.booking_line.curr|truncate(4,true,"…")}}</td><td>{{l.booking_line.acc}}</td>
- {% elif l.type == "intro" %}
- <td class="code" colspan=3><a href="/booking/{{l.booking_id}}">{{l.code}}</a></td>
- {% else %}
- <td colspan=3>{{l.code}}</td>
- {% endif %}
- <td>{{l.comment}}</td>
- </tr>
-{% endfor %}
-</table>
+{{ macros.table_dat_lines(dat_lines, single=false, raw=false) }}
{% endblock %}
{% endblock %}
{% block content %}
-<table>
-{% for l in dat_lines %}
- <tr class="{{l.type}}">
- {% if l.type == "intro" %}
- <td id="{{l.booking_id_}}"><a href="#{{l.booking_id}}">#</a></td>
- <td><a href="/booking/{{l.booking_id}}"/>{{l.raw_nbsp}}</a></td>
- {% else %}
- <td></td>
- <td>{{l.raw_nbsp}}</td>
- {% endif %}
- </tr>
-{% endfor %}
-</table>
+{{ macros.table_dat_lines(dat_lines, single=false, raw=true) }}
{% endblock %}