Django

Code

Changeset 5533

Show
Ignore:
Timestamp:
06/25/07 08:11:10 (1 year ago)
Author:
mtredinnick
Message:

unicode: Fixed #4662 -- Fixed a remaining ASCII assumption in
truncatewords_html(). Thanks, Ivan Sagalaev.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/unicode/django/utils/text.py

    r5314 r5533  
    6060    html4_singlets = ('br', 'col', 'link', 'base', 'img', 'param', 'area', 'hr', 'input') 
    6161    # Set up regular expressions 
    62     re_words = re.compile(r'&.*?;|<.*?>|([A-Za-z0-9][\w-]*)'
     62    re_words = re.compile(r'&.*?;|<.*?>|(\w[\w-]*)', re.U
    6363    re_tag = re.compile(r'<(/)?([^ ]+?)(?: (/)| .*?)?>') 
    6464    # Count non-HTML words and keep note of open tags 
  • django/branches/unicode/tests/regressiontests/defaultfilters/tests.py

    r5531 r5533  
    105105u'<p>one <a href="#">two - three <br>four</a> five</p>' 
    106106 
     107>>> truncatewords_html(u'\xc5ngstr\xf6m was here', 1) 
     108u'\xc5ngstr\xf6m ...' 
     109 
    107110>>> upper(u'Mixed case input') 
    108111u'MIXED CASE INPUT'