summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2016-05-01 14:36:07 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2016-05-01 14:36:07 +0200
commit25f8a6e4ea76574e878c8513aa0a44e2af586040 (patch)
tree11e97a209c41ff831ce8d930ccab6eb7411fcef4
parentaab1e3bde3a457ca2b9ab143e492098f82c71016 (diff)
downloadkosten-25f8a6e4ea76574e878c8513aa0a44e2af586040.tar.gz
kosten-25f8a6e4ea76574e878c8513aa0a44e2af586040.tar.bz2
kosten-25f8a6e4ea76574e878c8513aa0a44e2af586040.zip
Better whitespace handling
-rw-r--r--app/__init__.py3
-rw-r--r--templates/expenses/show.jinja22
2 files changed, 14 insertions, 11 deletions
diff --git a/app/__init__.py b/app/__init__.py
index 9a76b6d..61841ca 100644
--- a/app/__init__.py
+++ b/app/__init__.py
@@ -6,6 +6,9 @@ app = Flask('kosten')
# force autoescape in all files
app.jinja_env.autoescape = True
+app.jinja_env.lstrip_blocks = True
+app.jinja_env.trim_blocks = True
+
# load config
app.config.from_pyfile('settings.py')
diff --git a/templates/expenses/show.jinja b/templates/expenses/show.jinja
index 59da032..ef9fb7c 100644
--- a/templates/expenses/show.jinja
+++ b/templates/expenses/show.jinja
@@ -5,31 +5,31 @@
{% set additionalJS = "highstock" %}
{% block heading %}
- {% if exps | length > 1 %}
+ {% if exps | length > 1 -%}
Aktuelle Kosten
- {% else %}
+ {%- else -%}
Kosten für {{exps[0]|date}}
{% endif %}
{% endblock %}
{% block content %}
{% for e, p in zip(exps,pies) %}
- {% if exps | length > 1 %}<h2>{{e|date}}</h2>{% endif %}
+ {%+ if exps | length > 1 %}<h2>{{e|date}}</h2>{% endif %}
<div>
<div class="month_exp">
{% for c in e.catexps | sort(attribute="cat.name") %}
- {% call(exp) detail(name=c.cat.name, sum=c.sum, set=c.all) %}
+ {% call(exp) detail(name=c.cat.name, sum=c.sum, set=c.all) -%}
<a href="{{ url_for(".edit", id = exp.id) }}">{{exp.day}}.{{exp.month}}. -- {{exp.description}}: {{exp.expense | eur }}</a>
- {% endcall %}
+ {%- endcall %}
{% endfor %}
- {% call(exp) detail(name="Constant", sum=e.constsum, set=e.consts) %}
+ {% call(exp) detail(name="Constant", sum=e.constsum, set=e.consts) -%}
<a href="{{ url_for("consts.show", id = exp.id) }}">{{exp.monthly}} -- {{exp.description}}</a>
- {% endcall %}
+ {%- endcall %}
- {% call(exp) detail(name="In Summa", sum=e.sum, set=e.all, color="#ff2d2d") %}
+ {% call(exp) detail(name="In Summa", sum=e.sum, set=e.all, color="#ff2d2d") -%}
<a href="{{ url_for(".edit", id = exp.id) }}">{{exp.day}}.{{exp.month}}. -- {{exp.description}}: {{exp.expense | eur}}</a>
- {% endcall %}
+ {%- endcall %}
</div>
<div class="pie" data-pie='{{ p | tojson }}'></div>
</div>
@@ -50,9 +50,9 @@
{% macro detail(name, sum, set, color=None) %}
<div class="detail">
<img class="mark" src="{{ "images/closed.png" | static_url }}">
- {% call colorize(fgcolor=color) %}
+ {% call colorize(fgcolor=color) -%}
<span class="heading">{{name}}:</span> <span class="sum">{{sum | eur}}</span><br>
- {% endcall %}
+ {%- endcall %}
<div class="details">
<ul>
{% for exp in set %}