Skip to content

Commit

Permalink
WebDoc: Add plugin description and fix crash if a command has no desc…
Browse files Browse the repository at this point in the history
…ription (as Factoids.learn).
  • Loading branch information
progval committed Jul 16, 2013
1 parent fec7cb8 commit c3736cb
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions WebDoc/plugin.py
Expand Up @@ -71,6 +71,8 @@
<h1>%(plugin)s</h1>
<p>%(description)s</p>
<table>
<tr>
<th>Command</th>
Expand Down Expand Up @@ -112,12 +114,18 @@ def doGet(self, handler, path):
response = 200
callback = cbs[name]
commands = callback.listCommands()
description = callback.__doc__
if not description or description.startswith('Add the help for'):
description = ''
if commands:
commands.sort()
def formatter(command):
command = list(map(callbacks.canonicalName,
command.split(' ')))
doc = callback.getCommandMethod(command).__doc__
if not doc:
return '<tr><td>%s</td><td> </td></tr>' % \
' '.join(command)
doclines = doc.splitlines()
s = cgi.escape('%s %s' % (name, doclines.pop(0)))
if doclines:
Expand All @@ -131,6 +139,7 @@ def formatter(command):
output = httpserver.get_template('webdoc/plugin.html') % {
'plugin': name,
'table': table,
'description': description
}

self.send_response(response)
Expand Down

0 comments on commit c3736cb

Please sign in to comment.