[Python-checkins] python/dist/src/Lib textwrap.py,1.34,1.35
gward at users.sourceforge.net
gward at users.sourceforge.net
Wed Jun 2 21:59:43 EDT 2004
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12903/Lib
Modified Files:
textwrap.py
Log Message:
SF #965425: fix so hyphenated words surrounded by punctuation are
wrapped correctly.
Index: textwrap.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/textwrap.py,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** textwrap.py 13 May 2004 01:53:10 -0000 1.34
--- textwrap.py 3 Jun 2004 01:59:40 -0000 1.35
***************
*** 80,88 ****
# (after stripping out empty strings).
wordsep_re = re.compile(r'(\s+|' # any whitespace
! r'-*\w{2,}-(?=\w{2,})|' # hyphenated words
r'(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))') # em-dash
! # XXX will there be a locale-or-charset-aware version of
! # string.lowercase in 2.3?
sentence_end_re = re.compile(r'[%s]' # lowercase letter
r'[\.\!\?]' # sentence-ending punct.
--- 80,88 ----
# (after stripping out empty strings).
wordsep_re = re.compile(r'(\s+|' # any whitespace
! r'[^\s\w]*\w{2,}-(?=\w{2,})|' # hyphenated words
r'(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))') # em-dash
! # XXX this is not locale- or charset-aware -- string.lowercase
! # is US-ASCII only (and therefore English-only)
sentence_end_re = re.compile(r'[%s]' # lowercase letter
r'[\.\!\?]' # sentence-ending punct.
More information about the Python-checkins
mailing list