From c8eb1012980a08a51d78da0c3955cc5ba6edf5ed Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Thu, 25 Aug 2022 10:39:36 +0200 Subject: [proxy] normalize whitespace in jinja templates --- src/hydrilla/proxy/web_ui/root.py | 5 +- .../proxy/web_ui/templates/base.html.jinja | 169 ++++++++++----------- .../proxy/web_ui/templates/index.html.jinja | 2 +- .../web_ui/templates/packages/index.html.jinja | 32 ++-- .../templates/packages/load_from_disk.html.jinja | 10 +- .../templates/packages/show_single.html.jinja | 38 ++--- .../packages/show_single_version.html.jinja | 52 +++---- .../proxy/web_ui/templates/repos/add.html.jinja | 24 +-- .../proxy/web_ui/templates/repos/index.html.jinja | 50 +++--- .../web_ui/templates/repos/show_single.html.jinja | 164 ++++++++++---------- 10 files changed, 273 insertions(+), 273 deletions(-) (limited to 'src/hydrilla/proxy/web_ui') diff --git a/src/hydrilla/proxy/web_ui/root.py b/src/hydrilla/proxy/web_ui/root.py index a6e3151..28d7262 100644 --- a/src/hydrilla/proxy/web_ui/root.py +++ b/src/hydrilla/proxy/web_ui/root.py @@ -72,8 +72,9 @@ class WebUIAppImpl(_app.WebUIApp): self.jinja_options = { **self.jinja_options, - 'loader': jinja2.PackageLoader(__package__), - 'autoescape': jinja2.select_autoescape(['html.jinja']), + 'loader': jinja2.PackageLoader(__package__), + 'autoescape': jinja2.select_autoescape(['html.jinja']), + 'lstrip_blocks': True, 'extensions': [ *self.jinja_options.get('extensions', []), 'jinja2.ext.i18n', diff --git a/src/hydrilla/proxy/web_ui/templates/base.html.jinja b/src/hydrilla/proxy/web_ui/templates/base.html.jinja index a34d538..09c726b 100644 --- a/src/hydrilla/proxy/web_ui/templates/base.html.jinja +++ b/src/hydrilla/proxy/web_ui/templates/base.html.jinja @@ -22,121 +22,120 @@ in a proprietary work, I am not going to enforce this in court. - {%- block head %} + {% block head %} - {% block title required %}{% endblock %} - - - _('web_ui.base.title.haketilo_proxy') + {% block title required %}{% endblock %} + - + _('web_ui.base.title.haketilo_proxy') - {%- endblock %} + {% endblock %} - {%- set active_endpoint = get_current_endpoint() %} - {%- + {% set active_endpoint = get_current_endpoint() %} + {% set navigation_bar = [ ('home', _('web_ui.base.nav.home')), ('packages.packages', _('web_ui.base.nav.packages')), ('repos.repos', _('web_ui.base.nav.repos')), ('packages.load_from_disk', _('web_ui.base.nav.load')) ] - -%} + %}
{% block main required %}{% endblock %}
diff --git a/src/hydrilla/proxy/web_ui/templates/index.html.jinja b/src/hydrilla/proxy/web_ui/templates/index.html.jinja index 62c2b45..9115a3c 100644 --- a/src/hydrilla/proxy/web_ui/templates/index.html.jinja +++ b/src/hydrilla/proxy/web_ui/templates/index.html.jinja @@ -19,7 +19,7 @@ I, Wojtek Kosior, thereby promise not to sue for violation of this file's licenses. Although I request that you do not make use this code in a proprietary work, I am not going to enforce this in court. #} -{%- extends "base.html.jinja" %} +{% extends "base.html.jinja" %} {% block title %} {{ _('web_ui.home.title') }} {% endblock %} {% block main %} {{ _('web_ui.home.welcome_to_haketilo') }} diff --git a/src/hydrilla/proxy/web_ui/templates/packages/index.html.jinja b/src/hydrilla/proxy/web_ui/templates/packages/index.html.jinja index cbdd3d9..c59ed20 100644 --- a/src/hydrilla/proxy/web_ui/templates/packages/index.html.jinja +++ b/src/hydrilla/proxy/web_ui/templates/packages/index.html.jinja @@ -31,22 +31,22 @@ in a proprietary work, I am not going to enforce this in court. diff --git a/src/hydrilla/proxy/web_ui/templates/packages/load_from_disk.html.jinja b/src/hydrilla/proxy/web_ui/templates/packages/load_from_disk.html.jinja index 1f3c246..e2d012c 100644 --- a/src/hydrilla/proxy/web_ui/templates/packages/load_from_disk.html.jinja +++ b/src/hydrilla/proxy/web_ui/templates/packages/load_from_disk.html.jinja @@ -19,7 +19,7 @@ I, Wojtek Kosior, thereby promise not to sue for violation of this file's licenses. Although I request that you do not make use this code in a proprietary work, I am not going to enforce this in court. #} -{%- extends "base.html.jinja" %} +{% extends "base.html.jinja" %} {% block title %} {{ _('web_ui.packages.load_from_disk.title') }} {% endblock %} {% block style %} {{ super() }} @@ -34,17 +34,17 @@ in a proprietary work, I am not going to enforce this in court.
+ accept=".zip,application/zip" required="">
-{%- endblock %} +{% endblock %} diff --git a/src/hydrilla/proxy/web_ui/templates/packages/show_single.html.jinja b/src/hydrilla/proxy/web_ui/templates/packages/show_single.html.jinja index e362fa9..e1a447f 100644 --- a/src/hydrilla/proxy/web_ui/templates/packages/show_single.html.jinja +++ b/src/hydrilla/proxy/web_ui/templates/packages/show_single.html.jinja @@ -39,36 +39,36 @@ in a proprietary work, I am not going to enforce this in court.

{% if version_display_infos|length > 0 %} {% block version_list_heading %} - {{ _('web_ui.packages.single.version_list_heading') }} + {{ _('web_ui.packages.single.version_list_heading') }} {% endblock %} {% endif %}

{% endblock %} diff --git a/src/hydrilla/proxy/web_ui/templates/packages/show_single_version.html.jinja b/src/hydrilla/proxy/web_ui/templates/packages/show_single_version.html.jinja index 9943521..aa01272 100644 --- a/src/hydrilla/proxy/web_ui/templates/packages/show_single_version.html.jinja +++ b/src/hydrilla/proxy/web_ui/templates/packages/show_single_version.html.jinja @@ -22,16 +22,16 @@ in a proprietary work, I am not going to enforce this in court. {% extends "packages/show_single.html.jinja" %} {% block title %} {{ _('web_ui.packages.single_version.title') }} {% endblock %} {% block main_info %} - {%- if uninstall_disallowed is defined %} + {% if uninstall_disallowed is defined %} - {%- endif %} - {%- if repo_communication_error is defined %} + {% endif %} + {% if repo_communication_error is defined %} - {%- endif %} + {% endif %}

{{ _('web_ui.packages.single_version.heading.name_{}') @@ -42,48 +42,48 @@ in a proprietary work, I am not going to enforce this in court. {{ display_info.info.versioned_identifier }} TODO: add more info... - {%- if display_info.installed == InstalledStatus.INSTALLED %} + {% if display_info.installed == InstalledStatus.INSTALLED %}
{{ _('web_ui.packages.single_version.package_is_installed') }}
- {%- if uninstall_disallowed is not defined %} + {% if uninstall_disallowed is not defined %}
- - + +
- {%- endif %} - {%- elif display_info.installed == InstalledStatus.NOT_INSTALLED %} + {% endif %} + {% elif display_info.installed == InstalledStatus.NOT_INSTALLED %}
{{ _('web_ui.packages.single_version.package_is_not_installed') }}
- {%- else %} + {% else %}
{{ _('web_ui.packages.single_version.package_install_failed') }}
- - + +
- - + +
- {%- endif %} -{%- endblock main_info %} + {% endif %} +{% endblock main_info %} {% block version_list_heading %} {{ _('web_ui.packages.single_version.version_list_heading') }} {% endblock %} diff --git a/src/hydrilla/proxy/web_ui/templates/repos/add.html.jinja b/src/hydrilla/proxy/web_ui/templates/repos/add.html.jinja index 1b618cf..2f491e7 100644 --- a/src/hydrilla/proxy/web_ui/templates/repos/add.html.jinja +++ b/src/hydrilla/proxy/web_ui/templates/repos/add.html.jinja @@ -26,38 +26,38 @@ in a proprietary work, I am not going to enforce this in court.
- {% if repo_name_invalid is defined -%} + {% if repo_name_invalid is defined %} - {%- endif %} - {% if repo_name_taken is defined -%} + {% endif %} + {% if repo_name_taken is defined %} - {%- endif %} + {% endif %}
- {% if repo_url_invalid is defined -%} + {% if repo_url_invalid is defined %} - {%- endif %} + {% endif %}
diff --git a/src/hydrilla/proxy/web_ui/templates/repos/index.html.jinja b/src/hydrilla/proxy/web_ui/templates/repos/index.html.jinja index 54465a1..d910a4e 100644 --- a/src/hydrilla/proxy/web_ui/templates/repos/index.html.jinja +++ b/src/hydrilla/proxy/web_ui/templates/repos/index.html.jinja @@ -35,35 +35,35 @@ in a proprietary work, I am not going to enforce this in court. diff --git a/src/hydrilla/proxy/web_ui/templates/repos/show_single.html.jinja b/src/hydrilla/proxy/web_ui/templates/repos/show_single.html.jinja index a5998b8..b032765 100644 --- a/src/hydrilla/proxy/web_ui/templates/repos/show_single.html.jinja +++ b/src/hydrilla/proxy/web_ui/templates/repos/show_single.html.jinja @@ -27,120 +27,120 @@ in a proprietary work, I am not going to enforce this in court. {% include 'include/checkbox_tricks_style.css.jinja' %} {% endblock %} {% block main %} - {%- if repo_communication_error is defined %} + {% if repo_communication_error is defined %} - {%- endif %} - {%- if repo_api_version_unsupported is defined %} + {% endif %} + {% if repo_api_version_unsupported is defined %} - {%- endif %} - {%- set repo_id = display_info.ref.id %} - {%- if display_info.is_local_semirepo %} + {% endif %} + {% set repo_id = display_info.ref.id %} + {% if display_info.is_local_semirepo %}

{{ _('web_ui.repos.local_packages_semirepo') }}

- {% else -%} + {% else %}

{{ _('web_ui.repos.single.heading.name_{}').format(display_info.name) }}

- {%- if repo_name_invalid is defined or repo_name_taken is defined %} - {%- set checked_attr = '' %} - {%- else %} - {%- set checked_attr = 'checked=""' %} - {%- endif %} - {%- if not display_info.deleted %} + {% if repo_name_invalid is defined or repo_name_taken is defined %} + {% set checked_attr = '' %} + {% else %} + {% set checked_attr = 'checked=""' %} + {% endif %} + {% if not display_info.deleted %} + class="chbx-tricks-show-hide" {{ checked_attr }}>
- +
- - {%- if repo_name_invalid is defined %} - - {%- endif %} - {%- if repo_name_taken is defined %} - - {%- endif %} -
- -
-
- - -
+ + {% if repo_name_invalid is defined %} + + {% endif %} + {% if repo_name_taken is defined %} + + {% endif %} +
+ +
+
+ + +
- {%- endif %}{# not display_info.deleted #} - {%- endif %}{# display_info.is_local_semirepo (else) #} - {% if display_info.deleted and not display_info.is_local_semirepo -%} + {% endif %}{# not display_info.deleted #} + {% endif %}{# display_info.is_local_semirepo (else) #} + {% if display_info.deleted and not display_info.is_local_semirepo %}
{{ _('web_ui.repos.single.repo_is_deleted') }}
- {%- elif not display_info.deleted %} - {%- if repo_url_invalid is defined %} - {%- set checked_attr = '' %} - {%- else %} - {%- set checked_attr = 'checked=""' %} - {%- endif %} + {% elif not display_info.deleted %} + {% if repo_url_invalid is defined %} + {% set checked_attr = '' %} + {% else %} + {% set checked_attr = 'checked=""' %} + {% endif %} + {{ checked_attr }}>
- {{ display_info.url }} + {{ display_info.url }}
- +
- {%- if repo_url_invalid is defined %} - - {%- endif %} + {% if repo_url_invalid is defined %} + + {% endif %}
- +
- - + +
- {% if display_info.last_refreshed is none -%} - {{ _('web_ui.repos.single.repo_never_refreshed') }} - {% else -%} - {{ - _('web_ui.repos.single.last_refreshed_{}') - .format(display_info.last_refreshed.strftime('%F %H:%M')) - }} - {% endif -%} + {% if display_info.last_refreshed is none %} + {{ _('web_ui.repos.single.repo_never_refreshed') }} + {% else %} + {{ + _('web_ui.repos.single.last_refreshed_{}') + .format(display_info.last_refreshed.strftime('%F %H:%M')) + }} + {% endif %}
- - + +
- {% endif -%}{# not display_info.deleted (elif) #} + {% endif %}{# not display_info.deleted (elif) #}
{{ _('web_ui.repos.item_count_{mappings}_{resources}') @@ -150,12 +150,12 @@ in a proprietary work, I am not going to enforce this in court. ) }}
- {% if not display_info.is_local_semirepo and not display_info.deleted -%} + {% if not display_info.is_local_semirepo and not display_info.deleted %}
- {% endif -%} -{% endblock -%} + {% endif %} +{% endblock %} -- cgit v1.2.3