#1919: filter truncatewords wipes newlines from string, so not chainable with
markup filters
----------------------------+-----------------------------------------------
Reporter: derelm | Owner: nobody
Status: reopened | Component: Template system
Version: SVN | Resolution:
Keywords: sprintsept14 | Stage: Accepted
Has_patch: 1 | Needs_docs: 0
Needs_tests: 0 | Needs_better_patch: 0
----------------------------+-----------------------------------------------
Comment (by arien <[EMAIL PROTECTED]>):
I think you can argue either way. The approach I took was to truncate
immediately after the ''n''th word if the the input string had any
characters following it. The reason: {{{"Truncates a string after a
certain number of words."}}} {{{;-)}}}
What seem to be proposing is to return a string that has no more than
''n'' words in it. (I think that'll mean counting spaces and not words.
We'll see...) Does this look reasonable?
{{{
>>> truncatewords(u' Double-spaced text. ', 2) # and above
u' Double-spaced text. '
>>> truncatewords(u' Double-spaced text. ', 1)
u' Double-spaced ...'
>>> truncatewords(u' Double-spaced text. ', 0) # and below
u' ...'
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/1919#comment:17>
Django Code <http://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
-~----------~----~----~----~------~----~------~--~---