Commit 51f6a944 authored by Adrian Holovaty's avatar Adrian Holovaty
Browse files

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

git-svn-id: http://code.djangoproject.com/svn/django/trunk@2905 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent fe257d49
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -106,6 +106,7 @@ answer newbie questions, and generally made Django that much better:
    Swaroop C H <http://www.swaroopch.info>
    Aaron Swartz <http://www.aaronsw.com/>
    Tom Tobin
    Tom Insam
    Joe Topjian <http://joe.terrarum.net/geek/code/python/django/>
    Malcolm Tredinnick
    Amit Upadhyay
+2 −2
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ function URLify(s, num_chars) {
    s = s.replace(r, '');
    s = s.replace(/[^-A-Z0-9\s]/gi, '');  // remove unneeded chars
    s = s.replace(/^\s+|\s+$/g, ''); // trim leading/trailing spaces
    s = s.replace(/\s+/g, '-');      // convert spaces to hyphens
    s = s.replace(/[-\s]+/g, '-');   // convert spaces to hyphens
    s = s.toLowerCase();             // convert to lowercase
    return s.substring(0, num_chars);// trim to first num_chars chars
}
+1 −1
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ def make_list(value):
def slugify(value):
    "Converts to lowercase, removes non-alpha chars and converts spaces to hyphens"
    value = re.sub('[^\w\s-]', '', value).strip().lower()
    return re.sub('\s+', '-', value)
    return re.sub('[-\s]+', '-', value)

def stringformat(value, arg):
    """