djangosnippets.org: Latest snippets tagged with 'word-break'https://djangosnippets.org/tags/word-break/2012-09-20T16:37:39.563380-05:00Filter to add zero-width space to break up long words
2012-09-20T16:37:39.563380-05:00jayliewhttps://djangosnippets.org/snippets/2822/<p>If you have long words (no spaces) that are so long that it's messing up your design, add a 0-width space in the word every X chars.</p>
<p>Usage:</p>
<p>Step 1. Inside your app's directory, create dir called 'templatetags'. In that directory, create a .py file (say 'app_extras.py'). Make sure you …</p>
Freely redistributablewordbreak filter
2009-04-12T02:37:14.715077-05:00soniiichttps://djangosnippets.org/snippets/1432/<p>usage:</p>
<p>{{ object.content|wordbreak:"10" }}</p>
<p>This means if any word is 10 characters or longer, a <code>&shy;</code> will be placed every 10 characters. This is to break long words which may break the appearance of a page.</p>
<p>The output of this is HTML safe as the content has been conditionally escaped.</p>
Freely redistributable