Django

Code

Changeset 2905

Show
Ignore:
Timestamp:
05/14/06 23:20:04 (2 years ago)
Author:
adrian
Message:

Fixed #1849 -- Slugifying now collapses consecutive hyphens to a single hyphen. Thanks, Tom Insam

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/AUTHORS

    r2839 r2905  
    107107    Aaron Swartz <http://www.aaronsw.com/> 
    108108    Tom Tobin 
     109    Tom Insam 
    109110    Joe Topjian <http://joe.terrarum.net/geek/code/python/django/> 
    110111    Malcolm Tredinnick 
  • django/trunk/django/contrib/admin/media/js/urlify.js

    r1097 r2905  
    1010    s = s.replace(/[^-A-Z0-9\s]/gi, '');  // remove unneeded chars 
    1111    s = s.replace(/^\s+|\s+$/g, ''); // trim leading/trailing spaces 
    12     s = s.replace(/\s+/g, '-');      // convert spaces to hyphens 
     12    s = s.replace(/[-\s]+/g, '-');   // convert spaces to hyphens 
    1313    s = s.toLowerCase();             // convert to lowercase 
    1414    return s.substring(0, num_chars);// trim to first num_chars chars 
  • django/trunk/django/template/defaultfilters.py

    r2809 r2905  
    6767    "Converts to lowercase, removes non-alpha chars and converts spaces to hyphens" 
    6868    value = re.sub('[^\w\s-]', '', value).strip().lower() 
    69     return re.sub('\s+', '-', value) 
     69    return re.sub('[-\s]+', '-', value) 
    7070 
    7171def stringformat(value, arg):