Finally, a working version

This commit is contained in:
James Vega 2004-08-18 19:35:50 +00:00
parent bb36f4877f
commit ae9d4507d1

View File

@ -201,13 +201,15 @@ def makePluginDocumentation(pluginWindow):
<div class="mainbody" style="padding: 0;"> <div class="mainbody" style="padding: 0;">
%s %s
<table> <table>
<tr id="trheader"><td>Command</td><td>Args</td><td> <tr><th colspan="3">Commands for %s</th></tr>
<tr class="trheader"><td>Command</td><td>Args</td><td>
Detailed Help</td></tr> Detailed Help</td></tr>
''' % (genHeader(title, meta), ''' % (genHeader(title, meta),
cgi.escape(module.__doc__ or ""), cgi.escape(module.__doc__ or ""),
pluginhelp, pluginhelp,
deprecated, deprecated,
genNavbar('../../')))) genNavbar('../../'),
pluginName)))
attrs = [x for x in dir(plugin) if plugin.isCommand(x) and not attrs = [x for x in dir(plugin) if plugin.isCommand(x) and not
x.startswith('_')] x.startswith('_')]
id.write('(%s)<br />\n' % ', '.join(attrs)) id.write('(%s)<br />\n' % ', '.join(attrs))
@ -236,18 +238,25 @@ def makePluginDocumentation(pluginWindow):
''' % (trClass, attr, attr, help, morehelp))) ''' % (trClass, attr, attr, help, morehelp)))
try: try:
pluginconf = conf.supybot.plugins.get(pluginName) pluginconf = conf.supybot.plugins.get(pluginName)
fd.write(textwrap.dedent('''</table><br /><table><tr id="trheader"> fd.write(textwrap.dedent(
<td>Config Var</td><td>Default Value</td><td>Help</td>''')) '''</table><br /><table>
<tr><th colspan="3">Configuration Variables for %s</th></tr>
<tr class="trheader">
<td>Config Var</td>
<td>Default Value</td>
<td>Help</td></tr>''' % pluginName))
trClass = trClasses[trClass] trClass = trClasses[trClass]
for config in [(c[0], c[1], c[1].help) for c in\ for config in [(c[0], c[1]) for c in\
pluginconf.getValues(getChildren=True,fullNames=False)]: pluginconf.getValues(getChildren=True,fullNames=False)]:
name = config[0] name = config[0]
default = str(config[1]) default = str(config[1])
help = config[2] if isinstance(config[1]._default, basestring):
default = utils.dqrepr(default)
help = config[1].help
help = cgi.escape(help) help = cgi.escape(help)
trClass = trClasses[trClass] trClass = trClasses[trClass]
fd.write(textwrap.dedent(''' fd.write(textwrap.dedent('''
<tr class="%s" id="%s"><td>%s</td><td>%r</td> <tr class="%s" id="%s"><td>%s</td><td>%s</td>
<td class="detail">%s</td></tr> <td class="detail">%s</td></tr>
''' % (trClass, name, name, default, help))) ''' % (trClass, name, name, default, help)))
except registry.NonExistentRegistryEntry: except registry.NonExistentRegistryEntry: