Did I find the right examples for you? yes no

All Samples(6)  |  Call(4)  |  Derive(0)  |  Import(2)
Adds an HTML non-breaking space between the final two words at the end of
(and in sentences just outside of) block level tags to avoid "widowed"
words.

Examples:

>>> print(widont_html('<h2>Here is a simple  example  </h2> <p>Single</p>'))
<h2>Here is a simple&nbsp;example  </h2> <p>Single</p>

>>> print(widont_html('<p>test me<br /> out</p><h2>Ok?</h2>Not in a p<p title="test me">and this</p>'))(more...)

        def widont_html(value):
    """
    Adds an HTML non-breaking space between the final two words at the end of
    (and in sentences just outside of) block level tags to avoid "widowed"
    words.

    Examples:

    >>> print(widont_html('

Here is a simple example

Single

'))

Here is a simple example

Single

>>> print(widont_html('

test me
out

Ok?

Not in a p

and this

'))

test me
out

Ok?

Not in a p

and this

>>> print(widont_html('leading text

test me out

trailing text')) leading text

test me out

trailing text """ def replace(matchobj): return force_text('%s %s%s' % matchobj.groups()) return re_widont_html.sub(replace, force_text(value))


src/d/j/django-extensions-1.3.3/django_extensions/tests/test_templatetags.py   django-extensions(Download)
from django.test import TestCase
 
from django_extensions.templatetags.widont import widont, widont_html
 
 
    def test_widont_html(self):
        widont_html('Test Value')
        widont_html(u'Test Value')
 

src/d/j/django-extensions-HEAD/django_extensions/tests/test_templatetags.py   django-extensions(Download)
import six
 
from django.test import TestCase
 
from django_extensions.templatetags.widont import widont, widont_html
    def test_widont_html(self):
        widont_html('Test Value')
        widont_html(six.u('Test Value'))