Truncate words by characters
This filter truncates words like the original truncate words Django filter, but instead of being based on the number of words, it's based on the number of characters. I found the need for this when building a website where i'd have to show labels on really small text boxes and truncating by words didn't always gave me the best results (and truncating by character is...well...not that elegant). Usage example: {{var|truncatewords_by_chars:"16 2 4"}} If string lenght is higher than 16, truncates by 2 words, if lesser, truncates by 4 words.
- filter
- truncate
- character
- word