@@ -56,7 +56,7 @@ def slugify(
5656 :param hexadecimal (bool): converts html hexadecimal to unicode (Ž -> Ž -> z)
5757 :param max_length (int): output string length
5858 :param word_boundary (bool): truncates to end of full words (length may be shorter than max_length)
59- :param save_order (bool): if parameter is True and max_length > 0 return whole words in the initial order
59+ :param save_order (bool): when set, does not include shorter subsequent words even if they fit
6060 :param separator (str): separator between words
6161 :param stopwords (iterable): words to discount
6262 :param regex_pattern (str): regex pattern for disallowed characters
@@ -108,9 +108,13 @@ txt = 'jaja---lol-méméméoo--a'
108108r = slugify(txt, max_length = 20 , word_boundary = True , separator = " ." )
109109self .assertEqual(r, " jaja.lol.mememeoo.a" )
110110
111- txt = ' one two three four five'
112- r = slugify(txt, max_length = 13 , word_boundary = True , save_order = True )
113- self .assertEqual(r, " one-two-three" )
111+ txt = ' one two three four'
112+ r = slugify(txt, max_length = 12 , word_boundary = True , save_order = False )
113+ self .assertEqual(r, " one-two-four" )
114+
115+ txt = ' one two three four'
116+ r = slugify(txt, max_length = 12 , word_boundary = True , save_order = True )
117+ self .assertEqual(r, " one-two" )
114118
115119txt = ' the quick brown fox jumps over the lazy dog'
116120r = slugify(txt, stopwords = [' the' ])
0 commit comments