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 of the string to
avoid "widowed" words.

Examples:

>>> print(widont('Test   me   out'))
Test   me out

>>> widont('It works with trailing spaces too  ')
u'It works with trailing spaces too  '(more...)

        def widont(value, count=1):
    """
    Adds an HTML non-breaking space between the final two words of the string to
    avoid "widowed" words.

    Examples:

    >>> print(widont('Test   me   out'))
    Test   me out

    >>> widont('It works with trailing spaces too  ')
    u'It works with trailing spaces too  '

    >>> print(widont('NoEffect'))
    NoEffect
    """
    def replace(matchobj):
        return force_text(' %s' % matchobj.group(1))
    for i in range(count):
        value = re_widont.sub(replace, force_text(value))
    return 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
 
 
class TemplateTagsTests(TestCase):
    def test_widont(self):
        widont('Test Value')
        widont(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
 
 
class TemplateTagsTests(TestCase):
    def test_widont(self):
        widont('Test Value')
    def test_widont(self):
        widont('Test Value')
        widont(six.u('Test Value'))
 
    def test_widont_html(self):