jinja icon indicating copy to clipboard operation
jinja copied to clipboard

indent filter uses \n always rather than following api newline_sequence

Open jmbraben opened this issue 1 year ago • 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 avatar Aug 11 '24 21:08 jmbraben

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

mjeromin avatar Oct 11 '24 16:10 mjeromin

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 avatar Oct 12 '24 02:10 jmbraben

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

jmbraben avatar Oct 29 '24 19:10 jmbraben