]> granicus.if.org Git - python/commitdiff
SF #596434: tweak wordsep_re so the definition of an em-dash is
authorGreg Ward <gward@python.net>
Wed, 7 May 2003 01:20:58 +0000 (01:20 +0000)
committerGreg Ward <gward@python.net>
Wed, 7 May 2003 01:20:58 +0000 (01:20 +0000)
stricter: specifically, "--" must be preceded by a limited set of
characters, not by any non-whitespace character.

Lib/textwrap.py

index fdb95d71637ad482e2e77ea3a3ddb5e69bf20e43..b0c7042b54563ddc5be3703302f9f4afcbe8167e 100644 (file)
@@ -75,7 +75,7 @@ class TextWrapper:
     # (after stripping out empty strings).
     wordsep_re = re.compile(r'(\s+|'                  # any whitespace
                             r'-*\w{2,}-(?=\w{2,})|'   # hyphenated words
-                            r'(?<=\S)-{2,}(?=\w))')   # em-dash
+                            r'(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))')   # em-dash
 
     # XXX will there be a locale-or-charset-aware version of
     # string.lowercase in 2.3?