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

indent filter uses \n always rather than following api newline_sequence #2016

Open
jmbraben opened this issue Aug 11, 2024 · 3 comments · May be fixed by #2031
Open

indent filter uses \n always rather than following api newline_sequence #2016

jmbraben opened this issue Aug 11, 2024 · 3 comments · May be fixed by #2031

Comments

@jmbraben
Copy link

jmbraben commented Aug 11, 2024

indent filter uses \n always rather than following api newline_sequence

Configure the environment with newline_sequence="\r\n"
Then use the indent filter on a multi-line macro
The returned content uses \n instead of \r\n

The expanded/indented macro should be using \r\n for end of line sequence
This would appear to be relevant source code:
https://github.com/pallets/jinja/blob/main/src/jinja2/filters.py#L835

Environment:

  • Python version: 3.8.10
  • Jinja version: 3.1.4
mjeromin added a commit to mjeromin/jinja that referenced this issue Oct 2, 2024
@mjeromin mjeromin linked a pull request Oct 2, 2024 that will close this issue
@mjeromin
Copy link

@jmbraben are you able to test #2031 with your use case?

@jmbraben
Copy link
Author

jmbraben commented Oct 12, 2024

I'm out of office, but I'll try when I get back...if you don't hear from me, please ping me in a couple weeks...that said, that is what I would expect the changes to look like.
I'm assuming you have tried to locate any other hard coded \n sequences?

@jmbraben
Copy link
Author

@mjeromin Sorry for the delay in replying, yes the #2031 changes you made address the problem I was seeing.

mjeromin added a commit to mjeromin/jinja that referenced this issue Nov 15, 2024
@CheeseCake87 CheeseCake87 changed the title indent filter uses \n always rather than following api newline_sequence indent filter uses \n always rather than following api newline_sequence Nov 29, 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

Successfully merging a pull request may close this issue.

2 participants