#5202 closed (wontfix)
urlize filter before linebreaks doesn't work correctly
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Template system | Version: | 0.96 |
Severity: | Keywords: | urlize linebreaks | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
given:
p = "www.example.com"
in template:
{{ p|linebreaks|urlize }}
Your link will not be urlize'd.
However if given (note the line break):
p = "My test www.example.com oh boy"
using the same template, in my HTML I get:
<p>My test <a href="http://www.example.com%3Cbr" rel="nofollow">www.example.com<br></a> />oh boy</p>
It looks like the <br /> is getting broken.
Workaround: switch the order of the filters!
Possible Fixes: Make urlize treat the <br /> nicely. Or consider any angle bracket to be a word boundry (angle brackets aren't valid in URLs anyway, right?)
Change History (3)
comment:1 by , 17 years ago
Description: | modified (diff) |
---|
comment:2 by , 17 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Urlize should be applied to plain text (as per the documentation), not text that is already HTML. Reversing the order of the filters is the right way to use urlize and linebreaks in conjunction.
One difficulty is that we don't want to break processing of text that looks like `<mailto:foo@…>', which occurs in plain text sometimes. So the meaning of '<' is overloaded is we try to handle plain text and HTML here.
(Tweaked description formatting)