From 772f1dd2bf067eca926109b2cc1882f3bc6bc565 Mon Sep 17 00:00:00 2001 From: James Vega Date: Tue, 26 Jul 2005 12:22:16 +0000 Subject: [PATCH] scripts/supybot-plugin-doc: Don't escape characters if they're inside a single-quoted string. Also, make sure config vars with a default of None have a printable default string. --- scripts/supybot-plugin-doc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/supybot-plugin-doc b/scripts/supybot-plugin-doc index e98e7cb42..3ebb4194d 100644 --- a/scripts/supybot-plugin-doc +++ b/scripts/supybot-plugin-doc @@ -83,7 +83,14 @@ class PluginDoc(object): if escaped and self.escape: line = cgi.escape(line) if self.escape: - line = line.replace('[', '[').replace(']', ']') + sections = line.split("'") + slen = len(sections) - 1 + # Don't want to escape characters inside of single-quoted strings + if slen and slen % 2 == 0: + for i in xrange(0, 2, slen): + sections[i] = sections[i].replace('[', '[') + sections[i] = sections[i].replace(']', ']') + line = "'".join(sections) indent = ' ' * indent lines = textwrap.wrap(line, 79, initial_indent=indent, @@ -144,7 +151,7 @@ class PluginDoc(object): indent = origindent + 1 try: default = str(v) - if isinstance(v._default, basestring): + if isinstance(v._default, basestring) or v._default is None: default = utils.str.dqrepr(default) help = v.help() channelValue = v.channelValue