Opened 11 years ago

Closed 11 years ago

#21932 closed Uncategorized (invalid)

urlise filter not working with links in other tags

Reported by: smortus@… Owned by: nobody
Component: Template system Version: dev
Severity: Normal Keywords: django, template, filter, urlize
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

from django.template.defaultfilters import urlize

urlize("http://s.com/topic/110/boltalka/")

u'<a href="http://s.com/topic/110/boltalka/" rel="nofollow">http://s.com/topic/110/boltalka/</a>'

urlize("<p>http://s.com/topic/110/boltalka/</p>")

u'<p>http://s.com/topic/110/boltalka/</p>'

BUT (with spaces)!

urlize("<p> http://s.com/topic/110/boltalka/ </p>")

u'<p> <a href="http://s.com/topic/110/boltalka/" rel="nofollow">http://s.com/topic/110/boltalka/</a> </p>'

This can be useful with js wysiwys editor (CKEditor, for example).

Change History (1)

comment:1 by Tim Graham, 11 years ago

Resolution: invalid
Status: newclosed

As noted in the documentation: 'If urlize is applied to text that already contains HTML markup, things won’t work as expected. Apply this filter only to plain text.'

Note: See TracTickets for help on using tickets.
Back to Top