[Python-checkins] python/dist/src/Lib textwrap.py, 1.32.8.2, 1.32.8.3

gward at users.sourceforge.net gward at users.sourceforge.net
Wed Jun 2 21:53:16 EDT 2004


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12181

Modified Files:
      Tag: release23-maint
	textwrap.py 
Log Message:
SF #965425: fix wordsep_re so hyphenated words are handled correctly
when preceded by any punctuation, not just a sequence of more hyphens.
(That was a special case so Optik and Docutils could wrap long options
like --foo-bar correctly; this change generalizes the special-case.)

Comment fix.


Index: textwrap.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/textwrap.py,v
retrieving revision 1.32.8.2
retrieving revision 1.32.8.3
diff -C2 -d -r1.32.8.2 -r1.32.8.3
*** textwrap.py	13 May 2004 01:48:15 -0000	1.32.8.2
--- textwrap.py	3 Jun 2004 01:53:13 -0000	1.32.8.3
***************
*** 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