38 Commits

Author SHA1 Message Date
Raymond Hettinger
b930fbd93b Removed assignment to an unused variable. 2005-09-15 17:21:59 +00:00
Raymond Hettinger
5bf00be797 Backport SF #1209527. 2005-09-15 05:09:30 +00:00
Greg Ward
c1d3096aff SF #1149508: ensure textwrap handles hyphenated numbers correctly,
eg. "2004-03-04" is not broken across lines.
2005-03-05 02:38:33 +00:00
Greg Ward
6186410db0 SF #965425: fix so hyphenated words surrounded by punctuation are
wrapped correctly.
2004-06-03 01:59:41 +00:00
Greg Ward
f0ba764dbb SF #847346: merge from release23-maint branch: remove misguided
optimization for short input; beef up tests for fix_sentence_endings
feature.
2004-05-13 01:53:10 +00:00
Raymond Hettinger
c11dbcd4bf SF bug 797650: Infinite loop in textwrap.py
When the indents were set to longer than the width and long word breaking
was enabled, an infinite loop would result because the inner loop did not
assure that at least one character was stripped off on every pass.
2003-08-30 14:43:55 +00:00
Greg Ward
523008c6cf Update copyright dates.
Define True and False (if necessary) so this module can be copied as-is
to other projects (eg. Optik, Docutils) that don't depend on Python 2.3.
2003-06-15 15:37:18 +00:00
Greg Ward
52ae0a596f Remove comment about Unicode: SF #622831 was fixed loooong ago! 2003-06-14 00:26:39 +00:00
Tim Peters
c2659cff5d Whitespace normalization. 2003-05-12 20:19:37 +00:00
Greg Ward
86e1790cad Clarify the dedent() example a bit by indenting the input lines unevenly. 2003-05-08 02:12:35 +00:00
Greg Ward
2557100b9e Minor clarification of dedent(). 2003-05-08 02:02:50 +00:00
Greg Ward
478cd48dee SF patch #598163 (Ville Vainio, vvainio@users.sourceforge.net):
add dedent() function, to remove indentation from multiline strings
(eg. triple-quoted strings).  Differs from inspect.getdoc() by not
special-casing the first line (often a sensible approach for
non-docstring multiline strings).  This should make this function more
general (symmetric 'indent' also possible), and more fitting for the
textwrap module.
2003-05-08 01:58:05 +00:00
Greg Ward
a409f7c491 SF #596434: tweak wordsep_re so the definition of an em-dash is
stricter: specifically, "--" must be preceded by a limited set of
characters, not by any non-whitespace character.
2003-05-07 01:20:58 +00:00
Greg Ward
21820cd925 SF #726446: raise ValueError if width <= 0. 2003-05-07 00:55:35 +00:00
Andrew M. Kuchling
a2ecabe420 Fix docstring typo 2003-02-14 01:14:15 +00:00
Greg Ward
4c6c9c42fb Add __all__ (suggested by Raymond Hettinger).
Rename 'whitespace' global to '_whitespace' -- it's not part of the
public interface.
2003-02-03 14:46:57 +00:00
Greg Ward
afd44de812 Hardcode the recognized whitespace characters to the US-ASCII whitespace
chars.  See the comment for rationale.
2002-12-12 17:24:35 +00:00
Greg Ward
0e88c9f65d Tweak generation of unicode_whitespace_trans -- clearer, more
efficient.  Suggested by MAL.
2002-12-11 13:54:20 +00:00
Greg Ward
ab73d46e45 Fix SF bug #622849: in _wrap_chunks(), ensure that leading whitespace in
the input string is always preserved.
2002-12-09 16:26:05 +00:00
Greg Ward
2e74541d7e Fix SF bug #622831 (I think): add unicode_whitespace_trans class
attribute, and modify _munge_whitespace() to recognize Unicode strings
and use unicode_whitespace_trans to munge them.  Still need to add a
test to make sure I've really fixed the bug.
2002-12-09 16:23:08 +00:00
Greg Ward
4c486bc0c0 Add comment about inability to handle Unicode strings (hopefully a
temporary condition).
2002-10-22 18:31:50 +00:00
Greg Ward
78cc051617 Fix copyright date: the core of this code actually dates back to 1999
(rev. 1.4 of distutils/fancy_getopt.py).
2002-10-13 19:23:18 +00:00
Guido van Rossum
eb287a2662 Fix an endcase bug: initial_indent was ignored when the text was short
enough to fit in one line.
2002-10-02 15:47:32 +00:00
Greg Ward
e3bd104aa7 Tweak wordsep_re again: this time to recognize an em-dash with
any non-whitespace characters adjacent, not just \w.
2002-08-22 21:28:00 +00:00
Greg Ward
cce4d67fc4 Fix SF bug #596434: tweak wordsep_re so "--foo-bar" now splits
into /--foo-/bar/ rather than /--/foo-/bar/.  Needed for Optik and
Docutils to handle Unix-style command-line options properly.
2002-08-22 21:04:21 +00:00