Opened 5 years ago

Closed 5 years ago

#16325 closed Cleanup/optimization (invalid)

truncatewords_html and tables

Reported by: anonymous Owned by: nobody
Component: Template system Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I noticed, that using truncatewords_html does truncate words in tables too, but if truncation point were happen in middle of row, it would be cut in middle.
I'd recommend that this function wouldn't truncate in middle of row, but later, when that specific row ended.

Attachments (1)

example.png (14.7 KB) - added by anonymous 5 years ago.
Example of how it is and how it should behave.

Download all attachments as: .zip

Change History (2)

Changed 5 years ago by anonymous

Attachment: example.png added

Example of how it is and how it should behave.

comment:1 Changed 5 years ago by Aymeric Augustin

Resolution: invalid
Status: newclosed

truncatewords_html behaves according to the documentation, and it's already quite complex, see:

I'm not in favor of modifying its behavior within tables, because one could raise similar arguments for other tags:

  • <pre>: don't truncate before the end of line,
  • <ul> or <ul>: <li> => don't truncate within a <li>,
  • etc.

I don't think it's a good idea to go down this path.

truncatewords_html just knows which tags need to be closed and which don't. It's a fairly simple and generic tag. If it doesn't do exactly what you need, you should write your own truncatetable filter.

More generally, it doesn't make a lot of sense to truncate a table at a given number of words. It sounds more logical to truncate it at a given number of rows. That's one more reason to write your own filter.

Last edited 5 years ago by Aymeric Augustin (previous) (diff)
Note: See TracTickets for help on using tickets.
Back to Top