diff --git a/CHANGELOG.md b/CHANGELOG.md index f859dd48c5..965c012a0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ _This release is scheduled to be released on 2023-10-01._ - Replace pretty-quick by lint-staged () - Update engine node >=18. v16 reached it's end of life. (#3170) - Update typescript definition for modules +- Cleaned up nunjuck templates ### Fixed diff --git a/modules/default/alert/templates/alert.njk b/modules/default/alert/templates/alert.njk index 7349a7ae3d..b7db3a4de4 100644 --- a/modules/default/alert/templates/alert.njk +++ b/modules/default/alert/templates/alert.njk @@ -1,18 +1,20 @@ {% if imageUrl or imageFA %} - {% set imageHeight = imageHeight if imageHeight else "80px" %} - {% if imageUrl %} - - {% else %} - - {% endif %} -
+ {% set imageHeight = imageHeight if imageHeight else "80px" %} + {% if imageUrl %} + + {% else %} + + {% endif %} +
{% endif %} {% if title %} - {{ title if titleType == 'text' else title | safe }} + {{ title if titleType == 'text' else title | safe }} {% endif %} {% if message %} - {% if title %} -
- {% endif %} - {{ message if messageType == 'text' else message | safe }} + {% if title %}
{% endif %} + {{ message if messageType == 'text' else message | safe }} {% endif %} diff --git a/modules/default/alert/templates/notification.njk b/modules/default/alert/templates/notification.njk index 1594ad4866..0de6908b26 100644 --- a/modules/default/alert/templates/notification.njk +++ b/modules/default/alert/templates/notification.njk @@ -1,9 +1,7 @@ {% if title %} - {{ title if titleType == 'text' else title | safe }} + {{ title if titleType == 'text' else title | safe }} {% endif %} {% if message %} - {% if title %} -
- {% endif %} - {{ message if messageType == 'text' else message | safe }} + {% if title %}
{% endif %} + {{ message if messageType == 'text' else message | safe }} {% endif %} diff --git a/modules/default/helloworld/helloworld.njk b/modules/default/helloworld/helloworld.njk index 005ca28e3f..05e5edd37f 100644 --- a/modules/default/helloworld/helloworld.njk +++ b/modules/default/helloworld/helloworld.njk @@ -2,4 +2,4 @@ Use ` | safe` to allow html tages within the text string. https://mozilla.github.io/nunjucks/templating.html#autoescaping --> -
{{text | safe}}
+
{{ text | safe }}
diff --git a/modules/default/newsfeed/fullarticle.njk b/modules/default/newsfeed/fullarticle.njk index 6570396e5e..0be4b04256 100644 --- a/modules/default/newsfeed/fullarticle.njk +++ b/modules/default/newsfeed/fullarticle.njk @@ -1,3 +1,3 @@
-
\ No newline at end of file + diff --git a/modules/default/newsfeed/newsfeed.njk b/modules/default/newsfeed/newsfeed.njk index 9e7e9d78bb..5bdfe2cd49 100644 --- a/modules/default/newsfeed/newsfeed.njk +++ b/modules/default/newsfeed/newsfeed.njk @@ -1,27 +1,31 @@ {% macro escapeText(text, dangerouslyDisableAutoEscaping=false) %} - {% if dangerouslyDisableAutoEscaping %} - {{ text | safe}} - {% else %} - {{ text }} - {% endif %} + {% if dangerouslyDisableAutoEscaping -%} + {{ text | safe }} + {%- else -%} + {{ text }} + {%- endif %} {% endmacro %} - {% macro escapeTitle(title, url, dangerouslyDisableAutoEscaping=false, showTitleAsUrl=false) %} - {% if dangerouslyDisableAutoEscaping %} - {% if showTitleAsUrl %} - {{ title | safe }} + {% if dangerouslyDisableAutoEscaping %} + {% if showTitleAsUrl %} + {{ title | safe }} + {% else %} + {{ title | safe }} + {% endif %} {% else %} - {{ title | safe}} + {% if showTitleAsUrl %} + {{ title }} + {% else %} + {{ title }} + {% endif %} {% endif %} - {% else %} - {% if showTitleAsUrl %} - {{ title }} - {% else %} - {{ title }} - {% endif %} - {% endif %} {% endmacro %} - {% if loaded %} {% if config.showAsList %}