From 25f8a6e4ea76574e878c8513aa0a44e2af586040 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Sun, 1 May 2016 14:36:07 +0200 Subject: Better whitespace handling --- app/__init__.py | 3 +++ templates/expenses/show.jinja | 22 +++++++++++----------- 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 %}

{{e|date}}

{% endif %} + {%+ if exps | length > 1 %}

{{e|date}}

{% endif %}
{% 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) -%} {{exp.day}}.{{exp.month}}. -- {{exp.description}}: {{exp.expense | eur }} - {% 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) -%} {{exp.monthly}} -- {{exp.description}} - {% 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") -%} {{exp.day}}.{{exp.month}}. -- {{exp.description}}: {{exp.expense | eur}} - {% endcall %} + {%- endcall %}
@@ -50,9 +50,9 @@ {% macro detail(name, sum, set, color=None) %}
- {% call colorize(fgcolor=color) %} + {% call colorize(fgcolor=color) -%} {{name}}: {{sum | eur}}
- {% endcall %} + {%- endcall %}
    {% for exp in set %} -- cgit v1.2.3