Code

Opened 7 years ago

Closed 7 years ago

#4560 closed (duplicate)

When concatenating |linebreaks|truncatewords the paragraph is not closed

Reported by: rif <fericean@…> Owned by: adrian
Component: Template system Version: master
Severity: Keywords: linebreaks truncatewords paragraph
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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>

Attachments (0)

Change History (1)

comment:1 Changed 7 years ago by SmileyChris

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

truncatewords is 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 truncatewords before linebreaks - that requires #4655 to be applied first. So I'll mark as a dupe of that one.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.