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
Tim Peters
c411dbaeee
Whitespace normalization.
2002-07-16 21:35:23 +00:00
Greg Ward
e807e571a1
Docstring improvements. In particular, added docstrings for the
...
standalone wrap() and fill() functions. This should address the
misunderstanding that led to SF bug 577106.
2002-07-04 14:51:49 +00:00
Greg Ward
62080bee14
Took initial_tab and subsequent_tab away from the fill() method and
...
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.
2002-06-10 21:37:12 +00:00
Greg Ward
cf02ac6154
Allow the standalone wrap() and fill() functions to take arbitrary
...
keyword args, which are passed directly to the TextWrapper constructor.
2002-06-10 20:36:07 +00:00
Greg Ward
d34c959140
Make 'width' an instance attribute rather than an argument to the wrap()
...
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.
2002-06-10 20:26:02 +00:00
Greg Ward
47df99d575
Make all of TextWrapper's options keyword args to the constructor.
2002-06-09 00:22:07 +00:00
Greg Ward
698d9f01c6
Record copyright and author.
2002-06-07 22:40:23 +00:00
Greg Ward
70c726aa44
Use True/False instead of 1/0.
2002-06-07 22:35:41 +00:00
Greg Ward
f404c7ee84
Remove islower() -- not used anymore.
2002-06-07 22:33:11 +00:00
Greg Ward
cb320eb938
Conform to the bloody coding standards: "def foo()" not "def foo ()".
...
Yuck.
2002-06-07 22:32:15 +00:00
Greg Ward
9b4864e40a
Convert _fix_sentence_endings() to use a regex, and augment it to
...
handle sentences like this:
And she said, "Go to hell!" Can you believe that?
2002-06-07 22:04:15 +00:00
Greg Ward
62e4f3bf22
Add fix_sentence_endings option to control whether we ensure that
...
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.
2002-06-07 21:56:16 +00:00
Greg Ward
0093582489
Initial revision. Currently biased towards English in a fixed-width font,
...
according to the conventions that I (and Tim Peters) learned in school.
2002-06-07 21:43:37 +00:00