mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Reduced excessive whitespaces in jinja output
This commit is contained in:
parent
1321fcb45e
commit
e27a83bdc9
@ -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",
|
||||
|
@ -78,6 +78,6 @@ NAME = None
|
||||
|
||||
[Misc]
|
||||
|
||||
USE_JINJA = no
|
||||
SKIP_SETUP = no
|
||||
LOGGING = true
|
||||
DEV_MODE = false
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
<td>
|
||||
{% set segmentsize = segment+1 %}
|
||||
<table class="tiles_{{ segmentsize }}x{{ segmentsize }} tiles_sub">
|
||||
{% for row in range(segmentsize) %}
|
||||
{% for row in range(segmentsize) -%}
|
||||
<tr>
|
||||
{% for col in range(segmentsize) %}
|
||||
{% set entry = charts_cycler.next() %}
|
||||
@ -29,12 +29,12 @@
|
||||
</div>
|
||||
</a>
|
||||
</td>
|
||||
{% else %}
|
||||
{% else -%}
|
||||
<td></td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{%- endfor -%}
|
||||
</table>
|
||||
</td>
|
||||
{% endfor %}
|
||||
|
@ -15,7 +15,7 @@
|
||||
<td>
|
||||
{% set segmentsize = segment+1 %}
|
||||
<table class="tiles_{{ segmentsize }}x{{ segmentsize }} tiles_sub">
|
||||
{% for row in range(segmentsize) %}
|
||||
{% for row in range(segmentsize) -%}
|
||||
<tr>
|
||||
{% for col in range(segmentsize) %}
|
||||
{% set entry = charts_cycler.next() %}
|
||||
@ -29,12 +29,12 @@
|
||||
</div>
|
||||
</a>
|
||||
</td>
|
||||
{% else %}
|
||||
{% else -%}
|
||||
<td></td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{%- endif %}
|
||||
{%- endfor -%}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{%- endfor %}
|
||||
</table>
|
||||
</td>
|
||||
{% endfor %}
|
||||
|
@ -7,12 +7,12 @@
|
||||
|
||||
|
||||
<table class='list'>
|
||||
{% for s in scrobbles %}
|
||||
{% if loop.index0 >= firstindex and loop.index0 < lastindex %}
|
||||
{% for s in scrobbles -%}
|
||||
{%- if loop.index0 >= firstindex and loop.index0 < lastindex -%}
|
||||
<tr>
|
||||
<td class='time'>{{ malojatime.timestamp_desc(s["time"],short=shortTimeDesc) }}</td>
|
||||
{{ entityrow.row(s) }}
|
||||
</tr>
|
||||
{% endif %}
|
||||
{%- endif -%}
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
@ -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) -%}
|
||||
|
||||
<a href='{{ mlj_uri.create_uri("/scrobbles",*keydicts) }}'>
|
||||
{% if percent is not none %}
|
||||
{%- if percent is not none -%}
|
||||
<div style='width:{{ percent }}%;'></div>
|
||||
{% elif amount is not none %}
|
||||
{%- elif amount is not none -%}
|
||||
{{ amount }}
|
||||
{% endif %}
|
||||
{%- endif -%}
|
||||
|
||||
</a>
|
||||
{%- endmacro %}
|
||||
|
@ -18,12 +18,12 @@
|
||||
<!-- ARTIST CHARTS -->
|
||||
<h1><a class="stat_link_topartists" href="/charts_artists?in=alltime">Top Artists</a></h1>
|
||||
|
||||
{% for range in xcurrent %}
|
||||
{% for range in xcurrent -%}
|
||||
<span onclick="showRangeManual('topartists','{{ range.identifier }}')" class="stat_selector_topartists selector_topartists_{{ range.identifier }}">
|
||||
{{ range.localisation }}
|
||||
</span>
|
||||
{{ "|" if not loop.last }}
|
||||
{% endfor %}
|
||||
{%- endfor %}
|
||||
|
||||
<br/><br/>
|
||||
|
||||
@ -41,12 +41,12 @@
|
||||
<!-- TRACK CHARTS -->
|
||||
<h1><a class="stat_link_toptracks" href="/charts_tracks?in=alltime">Top Tracks</a></h1>
|
||||
|
||||
{% for range in xcurrent %}
|
||||
{% for range in xcurrent -%}
|
||||
<span onclick="showRangeManual('toptracks','{{ range.identifier }}')" class="stat_selector_toptracks selector_toptracks_{{ range.identifier }}">
|
||||
{{ range.localisation }}
|
||||
</span>
|
||||
{{ "|" if not loop.last }}
|
||||
{% endfor %}
|
||||
{%- endfor %}
|
||||
|
||||
<br/><br/>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user