dcwatson / bbcode

A pure python bbcode parser and formatter.
BSD 2-Clause "Simplified" License
68 stars 17 forks source link

url bbcode replaces \n with <br> tag #26

Closed Goury closed 7 years ago

Goury commented 7 years ago

I don't know why, but it should not.

Example: user posts message: [url=\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"]\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"[/url] It becames very long empty post.

Expected behaviour: <a href="\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n">\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n</a>

dcwatson commented 7 years ago

I disagree that this is the expected behavior. Tags do not span multiple lines, so [url=\n\n] would already not be a valid tag.

[url=

something]link[/url]

I would not expect the above to render a link with newlines in the href. And I think newlines inside a [url] tag should be replaced with <br />. But in any case, if you don't agree you're free to implement your own [url] tag with transform_newlines=False:

https://bbcode.readthedocs.io/en/latest/formatters.html