Opened 7 years ago
Closed 7 years ago
#29798 closed Uncategorized (invalid)
truncatewords_html fails on some self-closing tags
Description ¶
Also in 1.11...
>>> from django.template.defaultfilters import truncatewords_html >>> truncatewords_html('<p class="alinea">one two three</p>', 2) '<p class="alinea">one two ...</p>' >>> truncatewords_html('<p class="alinea">one two three</p><p class="alinea"/><p class="alinea">four five</p>', 4) '<p class="alinea">one two three</p><p class="alinea"/><p class="alinea">four ...</p></p>'
truncatewords_html
will add tag closures for every self-closing tag that has at least an attribute.
Note:
See TracTickets
for help on using tickets.
I think this is invalid. If I pump your HTML fragment into the W3 HTML Validator (as HTML 5) I get (amongst errors about the document structure not being right) this:
Looks like
truncatewords_html
's behaviour is correct.