pallets/jinja

indent filter uses \n always rather than following api newline_sequence

Opened this issue · 3 comments

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

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

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?

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