This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author quarl
Recipients
Date 2005-02-23.01:10:48
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
The following patch makes textwrap not consider strings
of numbers with dashes to be wrappable hyphenated words.

For example, this code:
    print textwrap.fill('aaaaaaaaaa 2005-02-21', 18)
previously produces:
    aaaaaaaaaa 2005-
    02-21

but with patch:
    aaaaaaaaaa
    2005-02-21


--- /usr/lib/python2.4/textwrap.py	2005-02-09
04:02:11.000000000 -0800
+++ /tmp/textwrap.py	2005-02-22 17:07:19.000000000 -0800
@@ -79,7 +79,7 @@
     #   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'[^\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
History
Date User Action Args
2007-08-23 15:41:58adminlinkissue1149508 messages
2007-08-23 15:41:58admincreate