Opened 18 years ago
Closed 18 years ago
#4560 closed (duplicate)
When concatenating |linebreaks|truncatewords the paragraph is not closed
| Reported by: | Owned by: | Adrian Holovaty | |
|---|---|---|---|
| Component: | Template system | Version: | dev |
| Severity: | Keywords: | linebreaks truncatewords paragraph | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
If I filter some field in a template e.g. {{news.description|linebreaks|truncatewords:"10"}} the resulting html code has a <p> that does not have the corresponding </p>.
If I use any of these two filters alone the result is correct but when used together the described erratic behavior occurs.
Workaround: {{news.description|linebreaks|truncatewords:"10"}}</p>
Note:
See TracTickets
for help on using tickets.
truncatewordsis not supposed to be an html aware filter.The workaround is actually
{{news.description|linebreaks|truncatewords_html:"10"}}Alternately, you can (or will be able to) use
truncatewordsbeforelinebreaks- that requires #4655 to be applied first. So I'll mark as a dupe of that one.