diff --git a/maloja/__pkginfo__.py b/maloja/__pkginfo__.py
index e88a629..3e3495d 100644
--- a/maloja/__pkginfo__.py
+++ b/maloja/__pkginfo__.py
@@ -5,7 +5,7 @@ author = {
"email":"maloja@krateng.dev",
"github": "krateng"
}
-version = 2,8,1
+version = 2,8,2
versionstr = ".".join(str(n) for n in version)
links = {
"pypi":"malojaserver",
diff --git a/maloja/data_files/settings/default.ini b/maloja/data_files/settings/default.ini
index 1bb5f2d..d7fb210 100644
--- a/maloja/data_files/settings/default.ini
+++ b/maloja/data_files/settings/default.ini
@@ -78,6 +78,6 @@ NAME = None
[Misc]
-USE_JINJA = no
SKIP_SETUP = no
LOGGING = true
+DEV_MODE = false
diff --git a/maloja/jinjaenv/context.py b/maloja/jinjaenv/context.py
index e41f67e..cd65fb9 100644
--- a/maloja/jinjaenv/context.py
+++ b/maloja/jinjaenv/context.py
@@ -68,3 +68,7 @@ jinja_environment = Environment(
)
jinja_environment.globals.update(JINJA_CONTEXT)
jinja_environment.filters.update({k:filters.__dict__[k] for k in filters.__dict__ if not k.startswith("__")})
+
+jinja_environment.trim_blocks = True
+jinja_environment.lstrip_blocks = True
+jinja_environment.strip_trailing_newlines = False
diff --git a/maloja/server.py b/maloja/server.py
index a927731..fca5eb0 100755
--- a/maloja/server.py
+++ b/maloja/server.py
@@ -158,7 +158,8 @@ def static_image(pth):
@webserver.route("/style.css")
def get_css():
response.content_type = 'text/css'
- return generate_css() if settings.get_settings("CSS_DEBUG") else css
+ if settings.get_settings("DEV_MODE"): css = generate_css()
+ return css
@webserver.route("/login")
@@ -222,6 +223,8 @@ def static_html(name):
template = jinja_environment.get_template(name + '.jinja')
res = template.render(**LOCAL_CONTEXT)
+ if settings.get_settings("DEV_MODE"): jinja_environment.cache.clear()
+
log("Generated page {name} in {time:.5f}s (Jinja)".format(name=name,time=clock.stop()),module="debug_performance")
return res
diff --git a/maloja/web/jinja/partials/charts_artists_tiles.jinja b/maloja/web/jinja/partials/charts_artists_tiles.jinja
index 05bd3a5..6c94246 100644
--- a/maloja/web/jinja/partials/charts_artists_tiles.jinja
+++ b/maloja/web/jinja/partials/charts_artists_tiles.jinja
@@ -15,7 +15,7 @@
{% set segmentsize = segment+1 %}
- {% for row in range(segmentsize) %}
+ {% for row in range(segmentsize) -%}
{% for col in range(segmentsize) %}
{% set entry = charts_cycler.next() %}
@@ -29,12 +29,12 @@
- {% else %}
+ {% else -%}
|
- {% endif %}
- {% endfor %}
+ {%- endif -%}
+ {%- endfor -%}
- {% endfor %}
+ {%- endfor -%}
|
{% endfor %}
diff --git a/maloja/web/jinja/partials/charts_tracks_tiles.jinja b/maloja/web/jinja/partials/charts_tracks_tiles.jinja
index 2c78a1d..6cf6965 100644
--- a/maloja/web/jinja/partials/charts_tracks_tiles.jinja
+++ b/maloja/web/jinja/partials/charts_tracks_tiles.jinja
@@ -15,7 +15,7 @@
{% set segmentsize = segment+1 %}
- {% for row in range(segmentsize) %}
+ {% for row in range(segmentsize) -%}
{% for col in range(segmentsize) %}
{% set entry = charts_cycler.next() %}
@@ -29,12 +29,12 @@
- {% else %}
+ {% else -%}
|
- {% endif %}
- {% endfor %}
+ {%- endif %}
+ {%- endfor -%}
- {% endfor %}
+ {%- endfor %}
|
{% endfor %}
diff --git a/maloja/web/jinja/partials/scrobbles.jinja b/maloja/web/jinja/partials/scrobbles.jinja
index b4c8de9..c3086dc 100644
--- a/maloja/web/jinja/partials/scrobbles.jinja
+++ b/maloja/web/jinja/partials/scrobbles.jinja
@@ -7,12 +7,12 @@
- {% for s in scrobbles %}
- {% if loop.index0 >= firstindex and loop.index0 < lastindex %}
+ {% for s in scrobbles -%}
+ {%- if loop.index0 >= firstindex and loop.index0 < lastindex -%}
{{ malojatime.timestamp_desc(s["time"],short=shortTimeDesc) }} |
{{ entityrow.row(s) }}
- {% endif %}
+ {%- endif -%}
{% endfor %}
diff --git a/maloja/web/jinja/snippets/links.jinja b/maloja/web/jinja/snippets/links.jinja
index 11430d7..2b6f459 100644
--- a/maloja/web/jinja/snippets/links.jinja
+++ b/maloja/web/jinja/snippets/links.jinja
@@ -16,24 +16,24 @@
-{% macro url(entity) -%}
- {% if 'artists' in entity %}
+{% macro url(entity) %}
+ {% if 'artists' in entity -%}
{{ mlj_uri.create_uri("/track",{'track':entity}) }}
- {% else %}
+ {%- else -%}
{{ mlj_uri.create_uri("/artist",{'artist':entity}) }}
- {% endif %}
-{%- endmacro %}
+ {%- endif %}
+{% endmacro %}
-{% macro link_scrobbles(keydicts,amount=None,percent=None) %}
+{% macro link_scrobbles(keydicts,amount=None,percent=None) -%}
- {% if percent is not none %}
+ {%- if percent is not none -%}
- {% elif amount is not none %}
+ {%- elif amount is not none -%}
{{ amount }}
- {% endif %}
+ {%- endif -%}
{%- endmacro %}
diff --git a/maloja/web/jinja/start.jinja b/maloja/web/jinja/start.jinja
index eec3576..58af952 100644
--- a/maloja/web/jinja/start.jinja
+++ b/maloja/web/jinja/start.jinja
@@ -18,12 +18,12 @@
- {% for range in xcurrent %}
+ {% for range in xcurrent -%}
{{ range.localisation }}
{{ "|" if not loop.last }}
- {% endfor %}
+ {%- endfor %}
@@ -41,12 +41,12 @@
- {% for range in xcurrent %}
+ {% for range in xcurrent -%}
{{ range.localisation }}
{{ "|" if not loop.last }}
- {% endfor %}
+ {%- endfor %}