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
- Make a string a fixed-width by adamfast 4 years, 8 months ago
- Table of Contents by dogada 4 years, 2 months ago
- Avoid widows using a template filter by jcroft 4 years, 11 months ago
- Frequently used tags/filters for Jinja2 by mathwizard 3 years, 4 months ago
- convert plain text to html by limodou 4 years, 11 months ago
Comments