Wrappable text

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
@stringfilter
def wrappable(value):
    """
    Places zero-width breaking spaces in text to allow it to wrap at any point.
    
    Munges text into HTML, so should be used last in the filter chain.
    {{ user_generated_text|wrappable }}
    """
    return "​".join(value)
register.filter('wrappable', wrappable)

More like this

  1. Filter to add zero-width space to break up long words by jayliew 8 months, 1 week ago
  2. Avoid widows using a template filter by jcroft 6 years, 3 months ago
  3. Inline truncate by character number by esanchez 4 years, 10 months ago
  4. Truncate text to length up until the nearest space by phektus 2 years, 2 months ago
  5. Resize image on save by David 5 years, 1 month ago

Comments

(Forgotten your password?)