[Python-checkins] python/dist/src/Lib textwrap.py,1.35,1.35.4.1
gward at users.sourceforge.net
gward at users.sourceforge.net
Sat Mar 5 03:38:35 CET 2005
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9623/Lib
Modified Files:
Tag: release24-maint
textwrap.py
Log Message:
SF #1149508: ensure textwrap handles hyphenated numbers correctly,
eg. "2004-03-04" is not broken across lines.
Index: textwrap.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/textwrap.py,v
retrieving revision 1.35
retrieving revision 1.35.4.1
diff -u -d -r1.35 -r1.35.4.1
--- textwrap.py 3 Jun 2004 01:59:40 -0000 1.35
+++ textwrap.py 5 Mar 2005 02:38:32 -0000 1.35.4.1
@@ -78,9 +78,10 @@
# splits into
# Hello/ /there/ /--/ /you/ /goof-/ball,/ /use/ /the/ /-b/ /option!
# (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
+ wordsep_re = re.compile(
+ r'(\s+|' # any whitespace
+ r'[^\s\w]*\w+[a-zA-Z]-(?=\w+[a-zA-Z])|' # 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)
More information about the Python-checkins
mailing list