From 889886112ec135400ce1853c1d5e3888ce028ac8 Mon Sep 17 00:00:00 2001 From: Feodor Fitsner Date: Wed, 26 Feb 2025 17:13:42 -0800 Subject: [PATCH] Trim white-space --- {{cookiecutter.out_dir}}/_macros.jinja2 | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/{{cookiecutter.out_dir}}/_macros.jinja2 b/{{cookiecutter.out_dir}}/_macros.jinja2 index 9c75688..992af78 100644 --- a/{{cookiecutter.out_dir}}/_macros.jinja2 +++ b/{{cookiecutter.out_dir}}/_macros.jinja2 @@ -1,16 +1,16 @@ {# _macros.jinja2 #} -{% macro get_value(dict, path) %} +{% macro get_value(dict, path) -%} {# Split the path into keys #} {% set keys = path.split('.') %} - {% if keys and dict is mapping and keys[0] in dict %} + {% if keys and dict is mapping and keys[0] in dict -%} {% set next_value = dict[keys[0]] %} - {% if keys | length == 1 %} - {{ next_value }} - {% else %} - {{ get_value(next_value, keys[1:] | join('.')) }} - {% endif %} - {% else %} + {% if keys | length == 1 -%} + {{ next_value | string | trim }} + {%- else -%} + {{ get_value(next_value, keys[1:] | join('.')) | string | trim }} + {%- endif %} + {%- else -%} {{ none }} - {% endif %} -{% endmacro %} \ No newline at end of file + {%- endif %} +{%- endmacro %} \ No newline at end of file