summaryrefslogtreecommitdiff
path: root/Mailman
diff options
context:
space:
mode:
authorbwarsaw2001-04-02 06:02:46 +0000
committerbwarsaw2001-04-02 06:02:46 +0000
commite4c6aae60c2cc9856be3c45b9a6d01e351ed778b (patch)
treef639d3daa94d1a3f8851f39364fa862f00912eaa /Mailman
parent34f6cd590b41a5247b0c1bc7ba990a7e286ee04a (diff)
downloadmailman-e4c6aae60c2cc9856be3c45b9a6d01e351ed778b.tar.gz
mailman-e4c6aae60c2cc9856be3c45b9a6d01e351ed778b.tar.zst
mailman-e4c6aae60c2cc9856be3c45b9a6d01e351ed778b.zip
wrap(): Added honor_leading_ws argument, defaulted to 1, which if true
inhibits wrapping of paragraphs with leading whitespace. When false, all paragraphs are wrapped.
Diffstat (limited to 'Mailman')
-rw-r--r--Mailman/Utils.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Mailman/Utils.py b/Mailman/Utils.py
index b57820ae0..45f80f629 100644
--- a/Mailman/Utils.py
+++ b/Mailman/Utils.py
@@ -66,15 +66,15 @@ def list_names():
# a much more naive implementation than say, Emacs's fill-paragraph!
-def wrap(text, column=70):
+def wrap(text, column=70, honor_leading_ws=1):
"""Wrap and fill the text to the specified column.
Wrapping is always in effect, although if it is not possible to wrap a
line (because some word is longer than `column' characters) the line is
broken at the next available whitespace boundary. Paragraphs are also
- always filled, unless the line begins with whitespace. This is the
- algorithm that the Python FAQ wizard uses, and seems like a good
- compromise.
+ always filled, unless honor_leading_ws is true and the line begins with
+ whitespace. This is the algorithm that the Python FAQ wizard uses, and
+ seems like a good compromise.
"""
wrapped = ''
@@ -88,7 +88,7 @@ def wrap(text, column=70):
if not line:
lines.append(line)
continue
- if line[0] in string.whitespace:
+ if honor_leading_ws and line[0] in string.whitespace:
fillthis = 0
else:
fillthis = 1