djangosnippets.org: Latest snippets tagged with 'widont'http://djangosnippets.org/tags/widont/2007-07-25T20:25:44.137065-05:00Enhanced "avoid widows" template filters
2007-07-25T20:25:44.137065-05:00SmileyChrishttp://djangosnippets.org/snippets/340/<p>Building on <a href="http://www.djangosnippets.org/snippets/17/">jcroft's snippet</a>, here's a slightly more advanced version which has two filters, one for basic text and the other for html snippets.</p>
<p>Usage is like so:</p>
<pre><code><h2>{{ blog_entry.headline|escape|widont }}</h2>
{{ blog_entry.html|widont_html }}
</code></pre>
<p>On top of Jeff's reasons for using these filters, they are important because they help …</p>
Freely redistributableAvoid widows using a template filter
2007-02-25T21:23:27.917368-06:00jcrofthttp://djangosnippets.org/snippets/17/<p><strong>Support good typography! Avoid widows! </strong></p>
<p>"Widows" are single words that end up on their own line, thanks to automatic line-breaks. This is an no-no in graphic design, and is especially unsightly in headers and other short bursts of text. This filter automatically replaces the space before the last word of …</p>
Freely redistributable