Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dash tags -%} remove space between tags in an unexpected way #595

Closed
tdelmas opened this issue Nov 25, 2015 · 2 comments · Fixed by #631
Closed

Dash tags -%} remove space between tags in an unexpected way #595

tdelmas opened this issue Nov 25, 2015 · 2 comments · Fixed by #631

Comments

@tdelmas
Copy link

tdelmas commented Nov 25, 2015

{% macro dash(a) -%} {{ a }} {{ a }} {%- endmacro %}
/{{ dash("_") }}/

Produce /_ _/ as expected (no spaces outside, one inside)
But :

{% macro dash(a) -%}{{ a }} {{ a }}{%- endmacro %}
/{{ dash("_") }}/

Produce /__/ (no space outside, an no inside)

It that the expected behaviour ? "If the tag with tash is not followed by a space, then stip spaces after the next one"

@curiousdannii
Copy link

I think your code might be being mangled by the markdown parser. Can you put it all in ``` block code tags?

@tdelmas
Copy link
Author

tdelmas commented Nov 28, 2015

I've updated it.
You can see the same behavior here : http://www.raymondcamden.com/demos/2014/oct/15/test.html

{% macro word(w) %}{{ w }}{% endmacro %}

{% if 1 -%} {{ word('EVERYTHING')}} {{word('FINE')}}{% endif %}
{% if 1 -%}{{ word('SOMETHING')}} {{word('WRONG')}}{% endif %}

Do not forget to put {} in the JSON part of the webpage.

EVERYTHING FINE SOMETHINGWRONG

To clarify the result : there was a space between "SOMETHING" and "WRONG" but the dash (-) removed it.

@carljm carljm added the bug label Nov 28, 2015
carljm added a commit that referenced this issue Jan 8, 2016
Fix unexpected whitespace control behavior, close #595.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants