with test_path.open('r', encoding='utf8') as f:
lines_expected = [line.rstrip('\n')
for line in f.readlines()]
- lines_rendered = template.render(blocks=Ledger(path).blocks
- ).split('\n')
+ ledger = Ledger(path)
+ ctx = {
+ 'blocks': ledger.blocks,
+ 'has_redundant_empty_lines': ledger.has_redundant_empty_lines}
+ lines_rendered = template.render(**ctx).split('\n')
msg_prefix = f'test for {test_path}:'
for idx0, line in enumerate(lines_rendered):
idx1 = idx0 + 1
scroll-padding-top: 2em;
}
body {
- {{macros.css_bg_white()}}
+ {{ macros.css_bg_white() }}
font-family: sans-serif;
text-align: left;
margin: 0;
padding: 0;
}
#header {
- {{macros.css_bg_white()}}
+ {{ macros.css_bg_white() }}
position: sticky;
top: 0;
padding-left: 0.5em;
background-color: #dcdcdc;
}
table.alternating > tbody > tr:nth-child(even) {
- {{macros.css_bg_white()}}
+ {{ macros.css_bg_white() }}
}
td {
vertical-align: top;
}
.critical {
- background: {{macros.css_red()}} !important;
+ background: {{ macros.css_red() }} !important;
}
{% block css %}
{% endblock %}
</head>
<body>
<div id="header">
- <form action="{{path}}" method="POST">
+ <form action="{{ path }}" method="POST">
<span class="disable_on_change">
ledger <a href="/ledger_structured">structured</a>
/ <a href="/ledger_raw">raw</a>
{% macro conditional_block_nav(path, direction, block) %}
{% if block[direction] %}
-<a href="{{path}}{{block[direction].id_}}">{{direction}}</a>
+<a href="{{ path }}{{ block[direction].id_ }}">{{ direction }}</a>
{% else %}
-<del>{{direction}}</del>
+<del>{{ direction }}</del>
{% endif %}
{% endmacro %}
{% macro css_ledger() %}
td.block_column {
- {{css_bg_white()}}
+ {{ css_bg_white() }}
}
{%- endmacro %}
{% macro ledger_empty_lines_fix(has_redundant_empty_lines) %}
{% if has_redundant_empty_lines %}
- Detected redundant empty lines in gaps, <input type="submit" name="remove_redundant_empty_lines" value="fix?" />
- <hr />
+Detected redundant empty lines in gaps, <input type="submit" name="remove_redundant_empty_lines" value="fix?" />
+<hr />
{% endif %}
{% endmacro %}
{% macro ledger_block_columns(mode, block) %}
<tr></tr><!-- keep the background-color alternation in proper order -->
- <tr id="block_{{ block.id_ }}">
+ <tr id="block_{{ block.id_ }}">
<td rowspan={{ block.lines | length + 1 }} {# -#}
class="block_column{{ ' critical' if block.date_error }}">
<input type="submit"
</td>
<td rowspan={{ block.lines | length + 1 }} {# -#}
class="block_column{{ 'critical' if block.booking
- and block.booking.sink_error}}">
- [<a href="#block_{{block.id_}}">#</a>]<br />
- [<a href="/balance?up_incl={{block.id_}}">b</a>]<br />
- [<a href="/edit_{{mode}}/{{block.id_}}">e</a>]
+ and block.booking.sink_error }}">
+ [<a href="#block_{{ block.id_ }}">#</a>]<br />
+ [<a href="/balance?up_incl={{ block.id_ }}">b</a>]<br />
+ [<a href="/edit_{{ mode }}/{{ block.id_ }}">e</a>]
</td>
</tr>
{% endmacro %}
</form>
</div>
<form action="/ledger_raw" method="POST">
+Detected redundant empty lines in gaps, <input type="submit" name="remove_redundant_empty_lines" value="fix?" />
+<hr />
<table class="alternating">
<tr></tr><!-- keep the background-color alternation in proper order -->
<tr id="block_0">
</form>
</div>
<form action="/ledger_structured" method="POST">
+Detected redundant empty lines in gaps, <input type="submit" name="remove_redundant_empty_lines" value="fix?" />
+<hr />
<table class="alternating">
<tr></tr><!-- keep the background-color alternation in proper order -->
<tr id="block_0">