mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-29 06:09:23 +01:00
supybot-plugin-doc: Fix various edge case issues in the ReST output
This commit is contained in:
parent
113fc74ca1
commit
76b6c56919
@ -92,9 +92,12 @@ class PluginDoc(object):
|
|||||||
def appendLine(self, line, indent=0):
|
def appendLine(self, line, indent=0):
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
indent = ' ' * indent
|
indent = ' ' * indent
|
||||||
lines = textwrap.wrap(line, 79,
|
# this looked like a good idea, but it's actually breaking lines
|
||||||
initial_indent=indent,
|
# in the middle of ReST elements:
|
||||||
subsequent_indent=indent)
|
#lines = textwrap.wrap(line, 79,
|
||||||
|
# initial_indent=indent,
|
||||||
|
# subsequent_indent=indent)
|
||||||
|
lines = [indent + line.replace('\n', '\n' + indent)]
|
||||||
self.lines.extend(lines)
|
self.lines.extend(lines)
|
||||||
if self.appendExtraBlankLine:
|
if self.appendExtraBlankLine:
|
||||||
self.lines.append('')
|
self.lines.append('')
|
||||||
@ -117,7 +120,9 @@ class PluginDoc(object):
|
|||||||
if cdoc is not None:
|
if cdoc is not None:
|
||||||
self.appendLine('Usage')
|
self.appendLine('Usage')
|
||||||
self.appendLine('-----')
|
self.appendLine('-----')
|
||||||
self.appendLine(cdoc)
|
# We add spaces at the beginning in case the docstring does not
|
||||||
|
# start with a newline (the default, unfortunately)
|
||||||
|
self.appendLine(textwrap.dedent(" "* 1000 + cdoc).lstrip())
|
||||||
self.lines.append('')
|
self.lines.append('')
|
||||||
commands = self.inst.listCommands()
|
commands = self.inst.listCommands()
|
||||||
if len(commands):
|
if len(commands):
|
||||||
@ -218,9 +223,7 @@ class PluginDoc(object):
|
|||||||
name = v._name
|
name = v._name
|
||||||
indent = origindent + 1
|
indent = origindent + 1
|
||||||
try:
|
try:
|
||||||
default = str(v)
|
default = utils.str.dqrepr(str(v))
|
||||||
if not isinstance(v._default, str):
|
|
||||||
default = utils.str.dqrepr(default)
|
|
||||||
help = v.help()
|
help = v.help()
|
||||||
except registry.NonExistentRegistryEntry:
|
except registry.NonExistentRegistryEntry:
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user