From a3cb3f21a048315d0a6304f48117f8060a58d811 Mon Sep 17 00:00:00 2001 From: Colin Rotherham Date: Wed, 1 Nov 2023 13:02:19 +0000 Subject: [PATCH] Ensure Nunjucks `{{ variables }}` are padded with spaces --- .../src/govuk/components/accordion/template.njk | 2 +- .../src/govuk/components/back-link/template.njk | 2 +- .../src/govuk/components/breadcrumbs/template.njk | 4 ++-- .../src/govuk/components/button/template.njk | 4 ++-- .../src/govuk/components/cookie-banner/template.njk | 8 ++++---- .../src/govuk/components/date-input/template.njk | 2 +- .../src/govuk/components/details/template.njk | 2 +- .../src/govuk/components/error-summary/template.njk | 2 +- .../src/govuk/components/exit-this-page/template.njk | 2 +- .../src/govuk/components/file-upload/template.njk | 2 +- .../src/govuk/components/footer/template.njk | 6 +++--- .../src/govuk/components/header/template.njk | 4 ++-- .../govuk-frontend/src/govuk/components/hint/template.njk | 2 +- .../src/govuk/components/input/template.njk | 8 ++++---- .../src/govuk/components/inset-text/template.njk | 2 +- .../src/govuk/components/label/template.njk | 2 +- .../src/govuk/components/notification-banner/template.njk | 2 +- .../src/govuk/components/panel/template.njk | 2 +- .../src/govuk/components/summary-list/template.njk | 6 +++--- .../govuk-frontend/src/govuk/components/tabs/template.njk | 6 +++--- .../src/govuk/components/textarea/template.njk | 4 ++-- .../src/govuk/components/warning-text/template.njk | 2 +- packages/govuk-frontend/src/govuk/template.njk | 2 +- 23 files changed, 39 insertions(+), 39 deletions(-) diff --git a/packages/govuk-frontend/src/govuk/components/accordion/template.njk b/packages/govuk-frontend/src/govuk/components/accordion/template.njk index 2d030ad2ef..c32a527b95 100644 --- a/packages/govuk-frontend/src/govuk/components/accordion/template.njk +++ b/packages/govuk-frontend/src/govuk/components/accordion/template.njk @@ -35,7 +35,7 @@ }) -}} {%- if params.rememberExpanded !== undefined %} data-remember-expanded="{{ params.rememberExpanded | escape }}"{% endif %} - {%- for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}> + {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}> {% for item in params.items %} {% if item %}
diff --git a/packages/govuk-frontend/src/govuk/components/back-link/template.njk b/packages/govuk-frontend/src/govuk/components/back-link/template.njk index 1e111bb34f..8b6b8bf230 100644 --- a/packages/govuk-frontend/src/govuk/components/back-link/template.njk +++ b/packages/govuk-frontend/src/govuk/components/back-link/template.njk @@ -1,2 +1,2 @@ {{ (params.html | safe if params.html else (params.text if params.text else 'Back')) }} + {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>{{ (params.html | safe if params.html else (params.text if params.text else 'Back')) }} diff --git a/packages/govuk-frontend/src/govuk/components/breadcrumbs/template.njk b/packages/govuk-frontend/src/govuk/components/breadcrumbs/template.njk index bce3866fbc..49b34fd4eb 100644 --- a/packages/govuk-frontend/src/govuk/components/breadcrumbs/template.njk +++ b/packages/govuk-frontend/src/govuk/components/breadcrumbs/template.njk @@ -9,12 +9,12 @@ {% set classNames = classNames + " govuk-breadcrumbs--collapse-on-mobile" %} {% endif -%} -
+
    {% for item in params.items %} {% if item.href %}
  1. - {{ item.html | safe if item.html else item.text }} + {{ item.html | safe if item.html else item.text }}
  2. {% else %}
  3. {{ item.html | safe if item.html else item.text }}
  4. diff --git a/packages/govuk-frontend/src/govuk/components/button/template.njk b/packages/govuk-frontend/src/govuk/components/button/template.njk index 0265c949c4..f6874da13e 100644 --- a/packages/govuk-frontend/src/govuk/components/button/template.njk +++ b/packages/govuk-frontend/src/govuk/components/button/template.njk @@ -30,11 +30,11 @@ treat it as an interactive element - without this it will be {#- Define common attributes that we can use across all element types #} -{%- set commonAttributes %} class="{{ classNames }}" data-module="govuk-button" {%- for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}{% if params.id %} id="{{ params.id }}"{% endif %}{% endset %} +{%- set commonAttributes %} class="{{ classNames }}" data-module="govuk-button" {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}{% if params.id %} id="{{ params.id }}"{% endif %}{% endset %} {#- Define common attributes we can use for both button and input types #} -{%- set buttonAttributes %}{% if params.name %} name="{{ params.name }}"{% endif %}{% if params.disabled %} disabled aria-disabled="true"{% endif %}{% if params.preventDoubleClick !== undefined %} data-prevent-double-click="{{params.preventDoubleClick}}"{% endif %}{% endset %} +{%- set buttonAttributes %}{% if params.name %} name="{{ params.name }}"{% endif %}{% if params.disabled %} disabled aria-disabled="true"{% endif %}{% if params.preventDoubleClick !== undefined %} data-prevent-double-click="{{ params.preventDoubleClick }}"{% endif %}{% endset %} {#- Actually create a button... or a link! #} diff --git a/packages/govuk-frontend/src/govuk/components/cookie-banner/template.njk b/packages/govuk-frontend/src/govuk/components/cookie-banner/template.njk index 6502a73571..fc7aea8f09 100644 --- a/packages/govuk-frontend/src/govuk/components/cookie-banner/template.njk +++ b/packages/govuk-frontend/src/govuk/components/cookie-banner/template.njk @@ -2,7 +2,7 @@