You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In other words, passing in a string different from the empty string does not actually replace the newlines with that string, contrary to what the documentation says.
I'd gladly PR a fix, but I'm not sure what the intended behaviour was actually meant to be; is it the documentation or the code that needs to be changed?
The text was updated successfully, but these errors were encountered:
Fixing the docs should be pretty straight forward. Changing the behavior might be a bit trickier because depending on the change it might be considered breaking. What is the really useful use case here? And is there a way to make it do what you want without possible breaking existing code?
I don't need different behaviour myself (I can't think of a use-case where you'd want to replace newlines with something else), I just noticed the discrepancy while trying to implement an unrelated enhancement. Simply updating the docs would be fine. Renaming the option to something like strip_newlines (and supporting the old name too for compat) would also be nice, but not necessary.
If you don't have a use case for something else, lets just fix the docs to document what we do. That will be a docs fix not a potentially breaking change.
The documentation for
template.compile
states thatHowever, as can be seen in the code, a truthy value simply replaces all newlines with an empty string, and a falsy value does not:
In other words, passing in a string different from the empty string does not actually replace the newlines with that string, contrary to what the documentation says.
I'd gladly PR a fix, but I'm not sure what the intended behaviour was actually meant to be; is it the documentation or the code that needs to be changed?
The text was updated successfully, but these errors were encountered: