Macros should not generate a breakline
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 42/100
Research direction
Start by reproducing the two Jinja macro examples from the issue and compare their rendered output. Trace the template rendering path for whitespace trimming around macro calls, then add or update coverage for the newline case. Done means the second example renders "hello: world" without the unexpected line break.
Written by the indexing model from the issue text.
Description
This code:
{%- macro test() -%}
{%- set foo = "world" -%}{{- foo -}}
{%- endmacro -%}
hello: {{- test() -}}
generates this expected output:
hello: world
But this code:
{%- macro test() -%}
{%- set foo = "world" -%}
{{- foo -}}
{%- endmacro -%}
hello: {{- test() -}}
generates this unexpected output :
hello:
world
I thought by using {{- ... -}} it would remove any spaces and breaklines, before and after, but it does not. Is that really expected or a bug ?
Thank you
- Dominant language
- Java
- Stars
- 785
- Forks
- 184
- Avg merge
- 6d 22h
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from HubSpot/jinjava
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
-
Jinjava 3.0 Open
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
elastic/gradle-plugins#157 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
cryptomator/hub#497 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
johanhaleby/occurrent#1120 ·