From d2ad7b3125a4136b1ca4342eb66c70b802369697 Mon Sep 17 00:00:00 2001 From: tiyn Date: Tue, 2 Aug 2022 23:07:43 +0200 Subject: [PATCH] templates: cleaned up whitespaces --- src/app.py | 2 +- src/templates/archive.html | 62 +++++++++++++++++++++++------------ src/templates/error.html | 6 ++-- src/templates/index.html | 14 ++++---- src/templates/login.html | 11 +++---- src/templates/register.html | 23 +++++++------ src/templates/rss.xml | 8 ++--- src/templates/standalone.html | 14 ++++---- src/templates/template.html | 27 +++++++-------- src/templates/user.html | 26 +++++++-------- src/templates/write.html | 27 ++++++++------- 11 files changed, 117 insertions(+), 103 deletions(-) diff --git a/src/app.py b/src/app.py index 755ea61..838dce8 100644 --- a/src/app.py +++ b/src/app.py @@ -25,7 +25,7 @@ login.login_view = "login" @app.context_processor def inject_title(): - return dict(title=config.TITLE, style=config.STYLE, + return dict(title=config.TITLE, style=config.STYLE, \ description=config.DESCRIPTION, \ registration=config.ALLOW_REGISTRATION, r_to_star=rating_to_star) diff --git a/src/templates/archive.html b/src/templates/archive.html index ec501e5..00929e3 100644 --- a/src/templates/archive.html +++ b/src/templates/archive.html @@ -1,26 +1,46 @@ -{% extends "template.html" %} +{% extends "template.html" -%} -{% block content %} -
-
-

Archive


- {% set ns = namespace(last_year="") %} - {% for entry in entries %} - {% if entry.item.date != ns.last_year %} - {% if ns.last_year != "" %} - - {% endif %} -

{{ entry.item.date }}

-
    - {% endif %} - {% set ns.last_year = entry.item.date %} -
  • - {{ entry.item.name }} +{% block content -%} +
    +
    +

    Archive


    + {% set ns = namespace(last_year="", last_name="", open_li = False, open_ul = False) -%} + {% for entry in entries -%} + {% if ns.last_name != entry.item.name and ns.last_name != "" -%} +
  • + {% set ns.open_li = False -%} + {% endif -%} + {% if entry.item.date != ns.last_year -%} + {% if ns.last_year != "" -%} +
+ {% set ns.open_ul = False -%} + {% endif -%} +

{{ entry.item.date }}

+ + {% endif -%} +
- -{% endblock %} +{% endblock -%} diff --git a/src/templates/error.html b/src/templates/error.html index f64f168..b7d567e 100644 --- a/src/templates/error.html +++ b/src/templates/error.html @@ -1,10 +1,10 @@ -{% extends "template.html" %} +{% extends "template.html" -%} -{% block content %} +{% block content -%}
Error
{{ errorcode }}
-{% endblock %} +{% endblock -%} diff --git a/src/templates/index.html b/src/templates/index.html index 61eaf67..d632604 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -1,10 +1,10 @@ -{% extends "template.html" %} +{% extends "template.html" -%} -{% block content %} +{% block content -%}

Blog


- {% for entry in entries %} + {% for entry in entries -%}

@@ -17,11 +17,11 @@ {{ entry.user.name }}
- {% autoescape off %} + {% autoescape off -%} {{ entry.text }} - {% endautoescape %} + {% endautoescape -%}


- {% endfor %} + {% endfor -%}
-{% endblock %} +{% endblock -%} diff --git a/src/templates/login.html b/src/templates/login.html index 5358fc6..502ef53 100644 --- a/src/templates/login.html +++ b/src/templates/login.html @@ -1,7 +1,6 @@ -{% extends "template.html" %} - -{% block content %} +{% extends "template.html" -%} +{% block content -%}

Sign In

@@ -16,10 +15,10 @@ {{ form.password(size=32) }}

{{ form.submit() }}

- {% for mesg in get_flashed_messages() %} + {% for mesg in get_flashed_messages() -%}

{{ mesg }}

- {% endfor %} + {% endfor -%}
-{% endblock %} +{% endblock -%} diff --git a/src/templates/register.html b/src/templates/register.html index e864fbe..4bc3ed4 100644 --- a/src/templates/register.html +++ b/src/templates/register.html @@ -1,7 +1,6 @@ -{% extends "template.html" %} - -{% block content %} +{% extends "template.html" -%} +{% block content -%}

Register

@@ -10,29 +9,29 @@

{{ form.username.label }}
{{ form.username(size=32) }} - {% for error in form.username.errors %} + {% for error in form.username.errors -%} [{{ error }}] - {% endfor %} + {% endfor -%}

{{ form.password.label }}
{{ form.password(size=32) }} - {% for error in form.password.errors %} + {% for error in form.password.errors -%} [{{ error }}] - {% endfor %} + {% endfor -%}

{{ form.password2.label }}
{{ form.password2(size=32) }} - {% for error in form.password2.errors %} + {% for error in form.password2.errors -%} [{{ error }}] - {% endfor %} + {% endfor -%}

{{ form.submit() }}

- {% for mesg in get_flashed_messages() %} + {% for mesg in get_flashed_messages() -%}

{{ mesg }}

- {% endfor %} + {% endfor -%}
-{% endblock %} +{% endblock -%} diff --git a/src/templates/rss.xml b/src/templates/rss.xml index 95ab4bf..7cf62be 100644 --- a/src/templates/rss.xml +++ b/src/templates/rss.xml @@ -7,7 +7,7 @@ en-us {{ url_for("feed", _external=True) }} - {% for entry in entries %} + {% for entry in entries -%} {{ entry.item.name }} ({{ entry.item.date }}) {{ r_to_star(entry.rating) }} by {{ entry.user.name }} @@ -19,11 +19,11 @@ {{ entry.reviewed }} </pubDate> <description> - {% autoescape off %} + {% autoescape off -%} text - {% endautoescape %} + {% endautoescape -%} </description> </item> - {% endfor %} + {% endfor -%} </channel> </rss> diff --git a/src/templates/standalone.html b/src/templates/standalone.html index 38368c2..b54efe0 100644 --- a/src/templates/standalone.html +++ b/src/templates/standalone.html @@ -1,6 +1,6 @@ -{% extends "template.html" %} +{% extends "template.html" -%} -{% block content %} +{% block content -%} <div class="container"> <div class="standalone"> <h1> @@ -17,7 +17,7 @@ {{ entry.reviewed }} </a> </small><br> - {% if current_user.id == entry.user.id %} + {% if current_user.id == entry.user.id -%} <small> [ <a href="{{ url_for('delete_entry', ident=entry.id) }}"> @@ -25,10 +25,10 @@ </a> ] </small><br> - {% endif %} - {% autoescape off %} + {% endif -%} + {% autoescape off -%} {{ entry.text }} - {% endautoescape %}<br> + {% endautoescape -%}<br> </div> </div> -{% endblock %} +{% endblock -%} diff --git a/src/templates/template.html b/src/templates/template.html index a2bd7fc..f929395 100644 --- a/src/templates/template.html +++ b/src/templates/template.html @@ -3,12 +3,13 @@ (url_for("archive"), 'archive', 'Archive') ] -%} +<!DOCTYPE html> <html> <head> <title>{{ title }} - + @@ -18,30 +19,26 @@ - - - {% block content %} - {% endblock %} - + {% block content -%} + {% endblock -%}
Made with Container Critique .
- {% if current_user.is_anonymous %} + {% if current_user.is_anonymous -%} Login - {% if registration %} + {% if registration -%} - Register - {% endif %} - {% else %} - Logout - - + {% endif -%} + {% else -%} + Logout - Write entry - {% endif %} + {% endif -%}
diff --git a/src/templates/user.html b/src/templates/user.html index c66322f..74b1c19 100644 --- a/src/templates/user.html +++ b/src/templates/user.html @@ -1,29 +1,29 @@ -{% extends "template.html" %} +{% extends "template.html" -%} -{% block content %} +{% block content -%}

User: {{ name }}


- {% set ns = namespace(last_year="") %} - {% for entry in entries %} - {% if entry.item.date != ns.last_year %} - {% if ns.last_year != "" %} + {% set ns = namespace(last_year="") -%} + {% for entry in entries -%} + {% if entry.item.date != ns.last_year -%} + {% if ns.last_year != "" -%} - {% endif %} + {% endif -%}

{{ entry.item.date }}

    - {% endif %} - {% set ns.last_year = entry.item.date %} + {% endif -%} + {% set ns.last_year = entry.item.date -%}
  • {{ entry.item.name }} {{ r_to_star(entry.rating) }} by {{ entry.user.name }}

  • - {% endfor %} - {% autoescape off %} + {% endfor -%} + {% autoescape off -%} {{ content_string }} - {% endautoescape %} + {% endautoescape -%}
-{% endblock %} +{% endblock -%} diff --git a/src/templates/write.html b/src/templates/write.html index 38aec5d..145d678 100644 --- a/src/templates/write.html +++ b/src/templates/write.html @@ -1,7 +1,6 @@ -{% extends "template.html" %} - -{% block content %} +{% extends "template.html" -%} +{% block content -%}

Write Critique

@@ -10,39 +9,39 @@

{{ form.name.label }}
{{ form.name(size=64) }} - {% for error in form.name.errors %} + {% for error in form.name.errors -%} [{{ error }}] - {% endfor %} + {% endfor -%}

{{ form.date.label }}
{{ form.date }} - {% for error in form.date.errors %} + {% for error in form.date.errors -%} [{{ error }}] - {% endfor %} + {% endfor -%}

{{ form.text.label }}
{{ form.text }} - {% for error in form.text.errors %} + {% for error in form.text.errors -%} [{{ error }}] - {% endfor %} + {% endfor -%} {{ ckeditor.load() }} {{ ckeditor.config(name="text") }}

{{ form.rating.label }}
{{ form.rating }} - {% for error in form.rating.errors %} + {% for error in form.rating.errors -%} [{{ error }}] - {% endfor %} + {% endfor -%}

{{ form.submit() }}

- {% for mesg in get_flashed_messages() %} + {% for mesg in get_flashed_messages() -%}

{{ mesg }}

- {% endfor %} + {% endfor -%}
-{% endblock %} +{% endblock -%}