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.

This commit is contained in:
James Vega 2005-07-26 12:22:16 +00:00
parent 75c9a455d2
commit 772f1dd2bf

View File

@ -83,7 +83,14 @@ class PluginDoc(object):
if escaped and self.escape: if escaped and self.escape:
line = cgi.escape(line) line = cgi.escape(line)
if self.escape: 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 indent = ' ' * indent
lines = textwrap.wrap(line, 79, lines = textwrap.wrap(line, 79,
initial_indent=indent, initial_indent=indent,
@ -144,7 +151,7 @@ class PluginDoc(object):
indent = origindent + 1 indent = origindent + 1
try: try:
default = str(v) default = str(v)
if isinstance(v._default, basestring): if isinstance(v._default, basestring) or v._default is None:
default = utils.str.dqrepr(default) default = utils.str.dqrepr(default)
help = v.help() help = v.help()
channelValue = v.channelValue channelValue = v.channelValue