Mercurial > cpython-lru_cache-weakref
annotate Doc/lib/libtextwrap.tex @ 27998:e27f58a50737 legacy-trunk
SF bug #690377: Dud footnote reference in distutils docs
| author | Raymond Hettinger <python@rcn.com> |
|---|---|
| date | Fri, 21 Feb 2003 02:47:09 +0000 |
| parents | 7336f51faa46 |
| children | 4de02f18a41b |
| rev | line source |
|---|---|
|
24049
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
1 \section{\module{textwrap} --- |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
2 Text wrapping and filling} |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
3 |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
4 \declaremodule{standard}{textwrap} |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
5 \modulesynopsis{Text wrapping and filling} |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
6 \moduleauthor{Greg Ward}{gward@python.net} |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
7 \sectionauthor{Greg Ward}{gward@python.net} |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
8 |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
9 \versionadded{2.3} |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
10 |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
11 The \module{textwrap} module provides two convenience functions, |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
12 \function{wrap()} and \function{fill()}, as well as |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
13 \class{TextWrapper}, the class that does all the work. If you're just |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
14 wrapping or filling one or two text strings, the convenience functions |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
15 should be good enough; otherwise, you should use an instance of |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
16 \class{TextWrapper} for efficiency. |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
17 |
|
24091
4298e269bd67
Deal with & remove the XXX comments.
Fred Drake <fdrake@acm.org>
parents:
24049
diff
changeset
|
18 \begin{funcdesc}{wrap}{text\optional{, width\optional{, \moreargs}}} |
|
24049
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
19 Wraps the single paragraph in \var{text} (a string) so every line is at |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
20 most \var{width} characters long. Returns a list of output lines, |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
21 without final newlines. |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
22 |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
23 Optional keyword arguments correspond to the instance attributes of |
|
24091
4298e269bd67
Deal with & remove the XXX comments.
Fred Drake <fdrake@acm.org>
parents:
24049
diff
changeset
|
24 \class{TextWrapper}, documented below. \var{width} defaults to |
|
4298e269bd67
Deal with & remove the XXX comments.
Fred Drake <fdrake@acm.org>
parents:
24049
diff
changeset
|
25 \code{70}. |
|
24049
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
26 \end{funcdesc} |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
27 |
|
24091
4298e269bd67
Deal with & remove the XXX comments.
Fred Drake <fdrake@acm.org>
parents:
24049
diff
changeset
|
28 \begin{funcdesc}{fill}{text\optional{, width\optional{, \moreargs}}} |
|
24049
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
29 Wraps the single paragraph in \var{text}, and returns a single string |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
30 containing the wrapped paragraph. \function{fill()} is shorthand for |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
31 \begin{verbatim} |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
32 "\n".join(wrap(text, ...)) |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
33 \end{verbatim} |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
34 |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
35 In particular, \function{fill()} accepts exactly the same keyword |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
36 arguments as \function{wrap()}. |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
37 \end{funcdesc} |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
38 |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
39 Both \function{wrap()} and \function{fill()} work by creating a |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
40 \class{TextWrapper} instance and calling a single method on it. That |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
41 instance is not reused, so for applications that wrap/fill many text |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
42 strings, it will be more efficient for you to create your own |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
43 \class{TextWrapper} object. |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
44 |
|
24096
2a20574400af
Don't list all the keyword args to the TextWrapper constructor in the
Greg Ward <gward@python.net>
parents:
24091
diff
changeset
|
45 \begin{classdesc}{TextWrapper}{...} |
|
2a20574400af
Don't list all the keyword args to the TextWrapper constructor in the
Greg Ward <gward@python.net>
parents:
24091
diff
changeset
|
46 The \class{TextWrapper} constructor accepts a number of optional |
|
2a20574400af
Don't list all the keyword args to the TextWrapper constructor in the
Greg Ward <gward@python.net>
parents:
24091
diff
changeset
|
47 keyword arguments. Each argument corresponds to one instance attribute, |
|
2a20574400af
Don't list all the keyword args to the TextWrapper constructor in the
Greg Ward <gward@python.net>
parents:
24091
diff
changeset
|
48 so for example |
|
24049
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
49 \begin{verbatim} |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
50 wrapper = TextWrapper(initial_indent="* ") |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
51 \end{verbatim} |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
52 is the same as |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
53 \begin{verbatim} |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
54 wrapper = TextWrapper() |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
55 wrapper.initial_indent = "* " |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
56 \end{verbatim} |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
57 |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
58 You can re-use the same \class{TextWrapper} object many times, and you |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
59 can change any of its options through direct assignment to instance |
|
24091
4298e269bd67
Deal with & remove the XXX comments.
Fred Drake <fdrake@acm.org>
parents:
24049
diff
changeset
|
60 attributes between uses. |
|
4298e269bd67
Deal with & remove the XXX comments.
Fred Drake <fdrake@acm.org>
parents:
24049
diff
changeset
|
61 \end{classdesc} |
|
4298e269bd67
Deal with & remove the XXX comments.
Fred Drake <fdrake@acm.org>
parents:
24049
diff
changeset
|
62 |
|
24096
2a20574400af
Don't list all the keyword args to the TextWrapper constructor in the
Greg Ward <gward@python.net>
parents:
24091
diff
changeset
|
63 The \class{TextWrapper} instance attributes (and keyword arguments to |
|
2a20574400af
Don't list all the keyword args to the TextWrapper constructor in the
Greg Ward <gward@python.net>
parents:
24091
diff
changeset
|
64 the constructor) are as follows: |
|
24049
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
65 |
|
24096
2a20574400af
Don't list all the keyword args to the TextWrapper constructor in the
Greg Ward <gward@python.net>
parents:
24091
diff
changeset
|
66 \begin{memberdesc}{width} |
|
24107
7336f51faa46
Fix up a few more consistency nits and incorrectly applied markup.
Fred Drake <fdrake@acm.org>
parents:
24096
diff
changeset
|
67 (default: \code{70}) The maximum length of wrapped lines. As long as |
|
7336f51faa46
Fix up a few more consistency nits and incorrectly applied markup.
Fred Drake <fdrake@acm.org>
parents:
24096
diff
changeset
|
68 there are no individual words in the input text longer than |
|
7336f51faa46
Fix up a few more consistency nits and incorrectly applied markup.
Fred Drake <fdrake@acm.org>
parents:
24096
diff
changeset
|
69 \member{width}, \class{TextWrapper} guarantees that no output line |
|
7336f51faa46
Fix up a few more consistency nits and incorrectly applied markup.
Fred Drake <fdrake@acm.org>
parents:
24096
diff
changeset
|
70 will be longer than \member{width} characters. |
|
24096
2a20574400af
Don't list all the keyword args to the TextWrapper constructor in the
Greg Ward <gward@python.net>
parents:
24091
diff
changeset
|
71 \end{memberdesc} |
|
24091
4298e269bd67
Deal with & remove the XXX comments.
Fred Drake <fdrake@acm.org>
parents:
24049
diff
changeset
|
72 |
|
4298e269bd67
Deal with & remove the XXX comments.
Fred Drake <fdrake@acm.org>
parents:
24049
diff
changeset
|
73 \begin{memberdesc}{expand_tabs} |
|
24096
2a20574400af
Don't list all the keyword args to the TextWrapper constructor in the
Greg Ward <gward@python.net>
parents:
24091
diff
changeset
|
74 (default: \code{True}) If true, then all tab characters in \var{text} |
|
2a20574400af
Don't list all the keyword args to the TextWrapper constructor in the
Greg Ward <gward@python.net>
parents:
24091
diff
changeset
|
75 will be expanded to spaces using the \method{expand_tabs()} method of |
|
24049
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
76 \var{text}. |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
77 \end{memberdesc} |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
78 |
|
24091
4298e269bd67
Deal with & remove the XXX comments.
Fred Drake <fdrake@acm.org>
parents:
24049
diff
changeset
|
79 \begin{memberdesc}{replace_whitespace} |
|
24107
7336f51faa46
Fix up a few more consistency nits and incorrectly applied markup.
Fred Drake <fdrake@acm.org>
parents:
24096
diff
changeset
|
80 (default: \code{True}) If true, each whitespace character (as defined |
|
7336f51faa46
Fix up a few more consistency nits and incorrectly applied markup.
Fred Drake <fdrake@acm.org>
parents:
24096
diff
changeset
|
81 by \code{string.whitespace}) remaining after tab expansion will be |
|
7336f51faa46
Fix up a few more consistency nits and incorrectly applied markup.
Fred Drake <fdrake@acm.org>
parents:
24096
diff
changeset
|
82 replaced by a single space. \note{If \member{expand_tabs} is false |
|
7336f51faa46
Fix up a few more consistency nits and incorrectly applied markup.
Fred Drake <fdrake@acm.org>
parents:
24096
diff
changeset
|
83 and \member{replace_whitespace} is true, each tab character will be |
|
7336f51faa46
Fix up a few more consistency nits and incorrectly applied markup.
Fred Drake <fdrake@acm.org>
parents:
24096
diff
changeset
|
84 replaced by a single space, which is \emph{not} the same as tab |
|
7336f51faa46
Fix up a few more consistency nits and incorrectly applied markup.
Fred Drake <fdrake@acm.org>
parents:
24096
diff
changeset
|
85 expansion.} |
|
24049
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
86 \end{memberdesc} |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
87 |
|
24091
4298e269bd67
Deal with & remove the XXX comments.
Fred Drake <fdrake@acm.org>
parents:
24049
diff
changeset
|
88 \begin{memberdesc}{initial_indent} |
|
4298e269bd67
Deal with & remove the XXX comments.
Fred Drake <fdrake@acm.org>
parents:
24049
diff
changeset
|
89 (default: \code{''}) String that will be prepended to the first line |
|
4298e269bd67
Deal with & remove the XXX comments.
Fred Drake <fdrake@acm.org>
parents:
24049
diff
changeset
|
90 of wrapped output. Counts towards the length of the first line. |
|
24049
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
91 \end{memberdesc} |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
92 |
|
24091
4298e269bd67
Deal with & remove the XXX comments.
Fred Drake <fdrake@acm.org>
parents:
24049
diff
changeset
|
93 \begin{memberdesc}{subsequent_indent} |
|
4298e269bd67
Deal with & remove the XXX comments.
Fred Drake <fdrake@acm.org>
parents:
24049
diff
changeset
|
94 (default: \code{''}) String that will be prepended to all lines of |
|
4298e269bd67
Deal with & remove the XXX comments.
Fred Drake <fdrake@acm.org>
parents:
24049
diff
changeset
|
95 wrapped output except the first. Counts towards the length of each |
|
4298e269bd67
Deal with & remove the XXX comments.
Fred Drake <fdrake@acm.org>
parents:
24049
diff
changeset
|
96 line except the first. |
|
24049
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
97 \end{memberdesc} |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
98 |
|
24091
4298e269bd67
Deal with & remove the XXX comments.
Fred Drake <fdrake@acm.org>
parents:
24049
diff
changeset
|
99 \begin{memberdesc}{fix_sentence_endings} |
|
4298e269bd67
Deal with & remove the XXX comments.
Fred Drake <fdrake@acm.org>
parents:
24049
diff
changeset
|
100 (default: \code{False}) If true, \class{TextWrapper} attempts to detect |
|
24049
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
101 sentence endings and ensure that sentences are always separated by |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
102 exactly two spaces. This is generally desired for text in a monospaced |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
103 font. However, the sentence detection algorithm is imperfect: it |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
104 assumes that a sentence ending consists of a lowercase letter followed |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
105 by one of \character{.}, |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
106 \character{!}, or \character{?}, possibly followed by one of |
|
24096
2a20574400af
Don't list all the keyword args to the TextWrapper constructor in the
Greg Ward <gward@python.net>
parents:
24091
diff
changeset
|
107 \character{"} or \character{'}, followed by a space. One problem |
|
2a20574400af
Don't list all the keyword args to the TextWrapper constructor in the
Greg Ward <gward@python.net>
parents:
24091
diff
changeset
|
108 with this is algorithm is that it is unable to detect the difference |
|
2a20574400af
Don't list all the keyword args to the TextWrapper constructor in the
Greg Ward <gward@python.net>
parents:
24091
diff
changeset
|
109 between ``Dr.'' in |
|
24107
7336f51faa46
Fix up a few more consistency nits and incorrectly applied markup.
Fred Drake <fdrake@acm.org>
parents:
24096
diff
changeset
|
110 |
|
24049
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
111 \begin{verbatim} |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
112 [...] Dr. Frankenstein's monster [...] |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
113 \end{verbatim} |
|
24107
7336f51faa46
Fix up a few more consistency nits and incorrectly applied markup.
Fred Drake <fdrake@acm.org>
parents:
24096
diff
changeset
|
114 |
|
24049
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
115 and ``Spot.'' in |
|
24107
7336f51faa46
Fix up a few more consistency nits and incorrectly applied markup.
Fred Drake <fdrake@acm.org>
parents:
24096
diff
changeset
|
116 |
|
24049
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
117 \begin{verbatim} |
|
24096
2a20574400af
Don't list all the keyword args to the TextWrapper constructor in the
Greg Ward <gward@python.net>
parents:
24091
diff
changeset
|
118 [...] See Spot. See Spot run [...] |
|
24049
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
119 \end{verbatim} |
|
24107
7336f51faa46
Fix up a few more consistency nits and incorrectly applied markup.
Fred Drake <fdrake@acm.org>
parents:
24096
diff
changeset
|
120 |
|
7336f51faa46
Fix up a few more consistency nits and incorrectly applied markup.
Fred Drake <fdrake@acm.org>
parents:
24096
diff
changeset
|
121 \member{fix_sentence_endings} is false by default. |
|
7336f51faa46
Fix up a few more consistency nits and incorrectly applied markup.
Fred Drake <fdrake@acm.org>
parents:
24096
diff
changeset
|
122 |
|
7336f51faa46
Fix up a few more consistency nits and incorrectly applied markup.
Fred Drake <fdrake@acm.org>
parents:
24096
diff
changeset
|
123 Since the sentence detection algorithm relies on |
|
7336f51faa46
Fix up a few more consistency nits and incorrectly applied markup.
Fred Drake <fdrake@acm.org>
parents:
24096
diff
changeset
|
124 \code{string.lowercase} for the definition of ``lowercase letter,'' |
|
7336f51faa46
Fix up a few more consistency nits and incorrectly applied markup.
Fred Drake <fdrake@acm.org>
parents:
24096
diff
changeset
|
125 and a convention of using two spaces after a period to separate |
|
7336f51faa46
Fix up a few more consistency nits and incorrectly applied markup.
Fred Drake <fdrake@acm.org>
parents:
24096
diff
changeset
|
126 sentences on the same line, it is specific to English-language texts. |
|
24049
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
127 \end{memberdesc} |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
128 |
|
24091
4298e269bd67
Deal with & remove the XXX comments.
Fred Drake <fdrake@acm.org>
parents:
24049
diff
changeset
|
129 \begin{memberdesc}{break_long_words} |
|
24096
2a20574400af
Don't list all the keyword args to the TextWrapper constructor in the
Greg Ward <gward@python.net>
parents:
24091
diff
changeset
|
130 (default: \code{True}) If true, then words longer than |
|
24107
7336f51faa46
Fix up a few more consistency nits and incorrectly applied markup.
Fred Drake <fdrake@acm.org>
parents:
24096
diff
changeset
|
131 \member{width} will be broken in order to ensure that no lines are |
|
7336f51faa46
Fix up a few more consistency nits and incorrectly applied markup.
Fred Drake <fdrake@acm.org>
parents:
24096
diff
changeset
|
132 longer than \member{width}. If it is false, long words will not be |
|
7336f51faa46
Fix up a few more consistency nits and incorrectly applied markup.
Fred Drake <fdrake@acm.org>
parents:
24096
diff
changeset
|
133 broken, and some lines may be longer than \member{width}. (Long words |
|
7336f51faa46
Fix up a few more consistency nits and incorrectly applied markup.
Fred Drake <fdrake@acm.org>
parents:
24096
diff
changeset
|
134 will be put on a line by themselves, in order to minimize the amount |
|
7336f51faa46
Fix up a few more consistency nits and incorrectly applied markup.
Fred Drake <fdrake@acm.org>
parents:
24096
diff
changeset
|
135 by which \member{width} is exceeded.) |
|
24049
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
136 \end{memberdesc} |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
137 |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
138 \class{TextWrapper} also provides two public methods, analogous to the |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
139 module-level convenience functions: |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
140 |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
141 \begin{methoddesc}{wrap}{text} |
|
24107
7336f51faa46
Fix up a few more consistency nits and incorrectly applied markup.
Fred Drake <fdrake@acm.org>
parents:
24096
diff
changeset
|
142 Wraps the single paragraph in \var{text} (a string) so every line is |
|
7336f51faa46
Fix up a few more consistency nits and incorrectly applied markup.
Fred Drake <fdrake@acm.org>
parents:
24096
diff
changeset
|
143 at most \member{width} characters long. All wrapping options are |
|
7336f51faa46
Fix up a few more consistency nits and incorrectly applied markup.
Fred Drake <fdrake@acm.org>
parents:
24096
diff
changeset
|
144 taken from instance attributes of the \class{TextWrapper} instance. |
|
7336f51faa46
Fix up a few more consistency nits and incorrectly applied markup.
Fred Drake <fdrake@acm.org>
parents:
24096
diff
changeset
|
145 Returns a list of output lines, without final newlines. |
|
24049
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
146 \end{methoddesc} |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
147 |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
148 \begin{methoddesc}{fill}{text} |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
149 Wraps the single paragraph in \var{text}, and returns a single string |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
150 containing the wrapped paragraph. |
|
d93f34201503
Add documentation for new textwrap module.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
151 \end{methoddesc} |
