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

LStrip and Trim don't apply to comment tags, but they should #1218

Closed
hrdixon opened this issue Nov 20, 2024 · 0 comments
Closed

LStrip and Trim don't apply to comment tags, but they should #1218

hrdixon opened this issue Nov 20, 2024 · 0 comments

Comments

@hrdixon
Copy link
Contributor

hrdixon commented Nov 20, 2024

LStrip and Trim apply correctly for {% ... %} tags, but don't work for {# ... #} tags.
In Jinja2 (python), the two work the same:

Python 3.10.12 (main, Sep 11 2024, 15:47:36) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from jinja2 import Environment
>>> env = Environment(trim_blocks=True, lstrip_blocks=True)
>>> template = env.from_string("""<div>
...     {# a comment #}
...         yay
...     {# another comment
...        This time, over multiple lines
...      #}
...         whoop
... </div>""")
>>> template.render()
'<div>\n        yay\n        whoop\n</div>'
>>> print(template.render())
<div>
        yay
        whoop
</div>

I've created a PR to fix this.

@hrdixon hrdixon changed the title LStrip and Trim don't apply to comment tags, but they should LStrip and Trim don't apply to comment tags, but they should, resolves #1218 Nov 20, 2024
@hrdixon hrdixon changed the title LStrip and Trim don't apply to comment tags, but they should, resolves #1218 LStrip and Trim don't apply to comment tags, but they should Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant