X-Git-Url: https://git.korewanetadesu.com/?p=python-collate.git;a=blobdiff_plain;f=collate%2F_strings.py;fp=collate%2F_strings.py;h=aed2ba71c5394a0de89c5d05edb3ce65b3013efa;hp=dde1739250868090247e6de736848f9b9b594b1d;hb=90897d68d6f3b50fc0103b4bf84d2e13faa18ae9;hpb=7dc546d67cd996c0a54b07261ab1b7bcdf4019ce diff --git a/collate/_strings.py b/collate/_strings.py index dde1739..aed2ba7 100644 --- a/collate/_strings.py +++ b/collate/_strings.py @@ -72,7 +72,7 @@ def sortemes(string): # If we read two strings separated by weird punctuation, # pretend the punctuation isn't there. if (this_mode == previous_mode == LETTER - and prev_category[0] == "P" + and (category[0] == "P" or prev_category[0] == "P") and words): words[-1] += u" " + string[start:last+1] else: @@ -88,8 +88,9 @@ def sortemes(string): last = None if category[0] in "LN": last = i + this_mode = mode if start is not None and last is not None: - if this_mode == previous_mode == LETTER and words: + if this_mode == LETTER and previous_mode == LETTER and words: words[-1] += u" " + string[start:last+1] else: if this_mode == NUMBER and previous_mode == LETTER and words: