#5025: Add a "truncate" template filter
---------------------------------------+---------------------------------
               Reporter:  SmileyChris  |          Owner:  nobody
                   Type:  New feature  |         Status:  reopened
              Milestone:               |      Component:  Template system
                Version:  SVN          |       Severity:  Normal
             Resolution:               |       Keywords:
           Triage Stage:  Accepted     |      Has patch:  1
    Needs documentation:  0            |    Needs tests:  0
Patch needs improvement:  0            |  Easy pickings:  0
---------------------------------------+---------------------------------
Changes (by SmileyChris):

 * needs_better_patch:  1 => 0


Comment:

 New patch uses pgettext and takes on Jannis' suggestion of using a common
 utility for truncation of strings (I've called the class `Truncator`, but
 `Truncatorminator` would probably have been cooler :P).

 For now, I've left the behavior of the truncate end-text to be backwards
 compatible for the `truncatewords` and `truncatewords_html` filters (that
 is, hardcoded strings of `' ...'`). There's a slight behaviour change
 otherwise: we're dropping the space between the last truncated word and
 the ellipsis.

 Also, `truncatewords_html` doesn't really make sense to allow for the
 translated ellipsis anywhere but the end, so it will always be appended to
 the end, regardless of where it contains `'%(truncated_text)s'`

-- 
Ticket URL: <https://code.djangoproject.com/ticket/5025#comment:36>
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.

Reply via email to