summaryrefslogtreecommitdiffstats
path: root/Lib/textwrap.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix #1146: TextWrap vs words 1-character shorter than the width.Georg Brandl2008-01-191-1/+6
| | | | Patch by Quentin Gallet-Gilles.
* Patch #1581073: add a flag to textwrap that prevents the dropping ofGeorg Brandl2007-03-131-4/+8
| | | | whitespace while wrapping.
* Whitespace normalization.Tim Peters2006-06-111-4/+4
|
* Bug #1361643: fix textwrap.dedent() so it handles tabs appropriately,Greg Ward2006-06-111-29/+46
| | | | | i.e. do *not* expand tabs, but treat them as whitespace that is not equivalent to spaces. Add a couple of test cases. Clarify docs.
* textwrap now processes text chucks at O(n) speed instead of O(n**2).Raymond Hettinger2005-07-151-9/+13
| | | | Patch #1209527 (Contributed by Connelly).
* SF #1149508: ensure textwrap handles hyphenated numbers correctly,Greg Ward2005-03-051-3/+4
| | | | eg. "2004-03-04" is not broken across lines. (Merged from 2.4 branch.)
* Removed unused line.Raymond Hettinger2005-01-031-1/+0
|
* SF #965425: fix so hyphenated words surrounded by punctuation areGreg Ward2004-06-031-3/+3
| | | | wrapped correctly.
* SF #847346: merge from release23-maint branch: remove misguidedGreg Ward2004-05-131-10/+8
| | | | | optimization for short input; beef up tests for fix_sentence_endings feature.
* SF bug 797650: Infinite loop in textwrap.pyRaymond Hettinger2003-08-301-1/+1
| | | | | | 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.
* Update copyright dates.Greg Ward2003-06-151-1/+9
| | | | | 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.
* Remove comment about Unicode: SF #622831 was fixed loooong ago!Greg Ward2003-06-141-3/+0
|
* Whitespace normalization.Tim Peters2003-05-121-1/+1
|
* Clarify the dedent() example a bit by indenting the input lines unevenly.Greg Ward2003-05-081-4/+4
|
* Minor clarification of dedent().Greg Ward2003-05-081-3/+3
|
* SF patch #598163 (Ville Vainio, vvainio@users.sourceforge.net):Greg Ward2003-05-081-0/+42
| | | | | | | | | 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.
* SF #596434: tweak wordsep_re so the definition of an em-dash isGreg Ward2003-05-071-1/+1
| | | | | stricter: specifically, "--" must be preceded by a limited set of characters, not by any non-whitespace character.
* SF #726446: raise ValueError if width <= 0.Greg Ward2003-05-071-0/+2
|
* Fix docstring typoAndrew M. Kuchling2003-02-141-1/+1
|
* Add __all__ (suggested by Raymond Hettinger).Greg Ward2003-02-031-3/+5
| | | | | Rename 'whitespace' global to '_whitespace' -- it's not part of the public interface.
* Hardcode the recognized whitespace characters to the US-ASCII whitespaceGreg Ward2002-12-121-3/+12
| | | | chars. See the comment for rationale.
* Tweak generation of unicode_whitespace_trans -- clearer, moreGreg Ward2002-12-111-2/+3
| | | | efficient. Suggested by MAL.
* Fix SF bug #622849: in _wrap_chunks(), ensure that leading whitespace inGreg Ward2002-12-091-2/+3
| | | | the input string is always preserved.
* Fix SF bug #622831 (I think): add unicode_whitespace_trans classGreg Ward2002-12-091-1/+8
| | | | | | 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.
* Add comment about inability to handle Unicode strings (hopefully aGreg Ward2002-10-221-0/+3
| | | | temporary condition).
* Fix copyright date: the core of this code actually dates back to 1999Greg Ward2002-10-131-2/+2
| | | | (rev. 1.4 of distutils/fancy_getopt.py).
* Fix an endcase bug: initial_indent was ignored when the text was shortGuido van Rossum2002-10-021-2/+3
| | | | enough to fit in one line.
* Tweak wordsep_re again: this time to recognize an em-dash withGreg Ward2002-08-221-1/+1
| | | | any non-whitespace characters adjacent, not just \w.
* Fix SF bug #596434: tweak wordsep_re so "--foo-bar" now splitsGreg Ward2002-08-221-1/+1
| | | | | into /--foo-/bar/ rather than /--/foo-/bar/. Needed for Optik and Docutils to handle Unix-style command-line options properly.
* Whitespace normalization.Tim Peters2002-07-161-3/+3
|
* Docstring improvements. In particular, added docstrings for theGreg Ward2002-07-041-10/+27
| | | | | standalone wrap() and fill() functions. This should address the misunderstanding that led to SF bug 577106.
* Took initial_tab and subsequent_tab away from the fill() method andGreg Ward2002-06-101-22/+34
| | | | | | | | transformed them into the initial_indent and subsequent_indent instance attributes. Now they actually work as advertised, ie. they are accounted for in the width of each output line. Plus you can use them with wrap() as well as fill(), and fill() went from simple-and-broken to trivial-and-working.
* Allow the standalone wrap() and fill() functions to take arbitraryGreg Ward2002-06-101-4/+6
| | | | keyword args, which are passed directly to the TextWrapper constructor.
* Make 'width' an instance attribute rather than an argument to the wrap()Greg Ward2002-06-101-31/+32
| | | | | | | and fill() methods. Keep interface of existing wrap() and fill() functions by going back to having them construct a new TextWrapper instance on each call, with the preferred width passed to the constructor.
* Make all of TextWrapper's options keyword args to the constructor.Greg Ward2002-06-091-5/+9
|
* Record copyright and author.Greg Ward2002-06-071-0/+4
|
* Use True/False instead of 1/0.Greg Ward2002-06-071-5/+5
|
* Remove islower() -- not used anymore.Greg Ward2002-06-071-6/+0
|
* Conform to the bloody coding standards: "def foo()" not "def foo ()".Greg Ward2002-06-071-10/+10
| | | | Yuck.
* Convert _fix_sentence_endings() to use a regex, and augment it toGreg Ward2002-06-071-8/+8
| | | | | handle sentences like this: And she said, "Go to hell!" Can you believe that?
* Add fix_sentence_endings option to control whether we ensure thatGreg Ward2002-06-071-16/+25
| | | | | | | | sentences are separated by two spaces. Improve _fix_sentence_endings() a bit -- look for ".!?" instead of just ".", and factor out the list of sentence-ending punctuation characters to a class attribute.
* Initial revision. Currently biased towards English in a fixed-width font,Greg Ward2002-06-071-0/+239
according to the conventions that I (and Tim Peters) learned in school.