diff options
| author | bwarsaw | 2001-03-01 07:07:44 +0000 |
|---|---|---|
| committer | bwarsaw | 2001-03-01 07:07:44 +0000 |
| commit | 85c08b208b1c1a87e7431b407ff4f40a5b73520c (patch) | |
| tree | baa077de934e3a33ab426fb2438be6a9d826549c | |
| parent | 1e4c2d509cd29bb8b2f5fbae7bad5c3aa372ca2a (diff) | |
| download | mailman-85c08b208b1c1a87e7431b407ff4f40a5b73520c.tar.gz mailman-85c08b208b1c1a87e7431b407ff4f40a5b73520c.tar.zst mailman-85c08b208b1c1a87e7431b407ff4f40a5b73520c.zip | |
do_output(): Some changes to make the resulting variable description
comments a little more palatable. L-strip all lines, strip out html
tags, and convert entities > and <
Still not perfect, but much better, and it's not worth perfecting.
| -rw-r--r-- | bin/config_list | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/bin/config_list b/bin/config_list index 1f2166644..bb46cf02b 100644 --- a/bin/config_list +++ b/bin/config_list @@ -62,6 +62,7 @@ The options -o and -i are mutually exclusive. """ import sys +import re import time import getopt from types import TupleType @@ -73,6 +74,8 @@ from Mailman import Utils from Mailman import Errors from Mailman.i18n import _ +NL = '\n' + def usage(code, msg=''): @@ -111,7 +114,12 @@ def do_output(listname, outfile): info = config[k] print >> outfp, '##', k.capitalize(), _('options') print >> outfp, '#' - desc = Utils.wrap(info[0]) + # First, massage the descripton text, which could have obnoxious + # leading whitespace on second and subsequent lines due to + # triple-quoted string nonsense in the source code. + desc = NL.join([s.lstrip() for s in info[0].split('\n')]) + # Print out the category description + desc = Utils.wrap(desc) for line in desc.split('\n'): print >> outfp, '#', line print >> outfp @@ -123,7 +131,17 @@ def do_output(listname, outfile): if varname[0] == '_': continue vtype = data[1] - desc = Utils.wrap(data[-1]) + # First, massage the descripton text, which could have + # obnoxious leading whitespace on second and subsequent lines + # due to triple-quoted string nonsense in the source code. + desc = NL.join([s.lstrip() for s in data[-1].split('\n')]) + # Now strip out all HTML tags + desc = re.sub('<.*?>', '', desc) + # And convert </> to <> + desc = re.sub('<', '<', desc) + desc = re.sub('>', '>', desc) + # Print out the variable description. + desc = Utils.wrap(desc) for line in desc.split('\n'): print >> outfp, '#', line # munge the value based on its type |
