summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-10-15 18:22:54 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-10-15 18:22:54 (GMT)
commitacc9f3fb1622c0685b52097b977cafada742be99 (patch)
tree6f75fc531b1731d6467637d1ffe3f71e39e09f62 /Doc
parentbc2bfa6b68e138986e57e2925e5a31c0f17615ab (diff)
downloadcpython-acc9f3fb1622c0685b52097b977cafada742be99.zip
cpython-acc9f3fb1622c0685b52097b977cafada742be99.tar.gz
cpython-acc9f3fb1622c0685b52097b977cafada742be99.tar.bz2
Issue #18725: The textwrap module now supports truncating multiline text.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/textwrap.rst28
1 files changed, 16 insertions, 12 deletions
diff --git a/Doc/library/textwrap.rst b/Doc/library/textwrap.rst
index 6ac1e77..1ba42a3 100644
--- a/Doc/library/textwrap.rst
+++ b/Doc/library/textwrap.rst
@@ -250,6 +250,22 @@ hyphenated words; only then will long words be broken if necessary, unless
was to always allow breaking hyphenated words.
+ .. attribute:: max_lines
+
+ (default: ``None``) If not ``None``, then the text be will truncated to
+ *max_lines* lines.
+
+ .. versionadded:: 3.4
+
+
+ .. attribute:: placeholder
+
+ (default: ``' [...]'``) String that will be appended to the last line of
+ text if it will be truncated.
+
+ .. versionadded:: 3.4
+
+
:class:`TextWrapper` also provides some public methods, analogous to the
module-level convenience functions:
@@ -266,15 +282,3 @@ hyphenated words; only then will long words be broken if necessary, unless
Wraps the single paragraph in *text*, and returns a single string
containing the wrapped paragraph.
-
-
- .. function:: shorten(text, *, placeholder=" [...]")
-
- Collapse and truncate the given text to fit in :attr:`width`
- characters.
-
- The text first has its whitespace collapsed. If it then fits in
- :attr:`width`, it is returned as-is. Otherwise, as many words
- as possible are joined and then the *placeholder* is appended.
-
- .. versionadded:: 3.4