#16325: truncatewords_html and tables
-------------------------------------+-------------------------------------
Reporter: anonymous | Owner: nobody
Type: | Status: closed
Cleanup/optimization | Component: Template system
Milestone: | Severity: Normal
Version: 1.3 | Keywords:
Resolution: invalid | Has patch: 0
Triage Stage: | Needs tests: 0
Unreviewed | Easy pickings: 0
Needs documentation: 0 |
Patch needs improvement: 0 |
UI/UX: 0 |
-------------------------------------+-------------------------------------
Changes (by aaugustin):
* status: new => closed
* needs_better_patch: => 0
* resolution: => invalid
* needs_tests: => 0
* needs_docs: => 0
Comment:
`truncatewords_html` behaves according to the documentation, and it's
already quite complex, see:
-
https://code.djangoproject.com/browser/django/trunk/django/template/defaultfilters.py#L263
-
https://code.djangoproject.com/browser/django/trunk/django/utils/text.py#L56
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/16325#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.