From f66c5673555e0211d5c4aed884070c5710162417 Mon Sep 17 00:00:00 2001 From: James Vega Date: Tue, 18 Nov 2003 05:11:35 +0000 Subject: [PATCH] A few more refinements to the documentation --- docs/plugins/supybot.css | 3 +++ tools/generate-plugin-documentation.py | 35 ++++++++++++++++---------- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/docs/plugins/supybot.css b/docs/plugins/supybot.css index 814ee5bb4..e42698f61 100644 --- a/docs/plugins/supybot.css +++ b/docs/plugins/supybot.css @@ -36,3 +36,6 @@ pre { .trodd { background:white; } +.underline { + text-decoration:underline; +} diff --git a/tools/generate-plugin-documentation.py b/tools/generate-plugin-documentation.py index 69deb9b2e..4d60d52e6 100755 --- a/tools/generate-plugin-documentation.py +++ b/tools/generate-plugin-documentation.py @@ -48,6 +48,7 @@ import debug import callbacks commandDict = {} +firstChars = {} def prepIndex(): directory = os.path.join('docs', 'plugins') @@ -70,6 +71,7 @@ def prepIndex(): def makePluginDocumentation(pluginWindow): global commandDict + global firstChars trClasses = { 'treven':'trodd', 'trodd':'treven' } trClass = 'treven' (pluginName, module, plugin) = pluginWindow[1] @@ -108,6 +110,8 @@ def makePluginDocumentation(pluginWindow): commandDict[attr].append(pluginName) else: commandDict[attr] = [pluginName] + if attr[0] not in firstChars: + firstChars[attr[0]] = '' method = getattr(plugin, attr) if hasattr(method, '__doc__'): doclines = method.__doc__.splitlines() @@ -121,9 +125,9 @@ def makePluginDocumentation(pluginWindow): morehelp = cgi.escape(morehelp) trClass = trClasses[trClass] fd.write(textwrap.dedent(""" - %s%s%s - - """) % (trClass, attr, help, morehelp)) + %s%s + %s + """) % (trClass, attr, attr, attr, help, morehelp)) fd.write(textwrap.dedent(""" """)) @@ -163,7 +167,9 @@ def finishIndex(): fd.close() def makeCommandsIndex(): + from string import ascii_lowercase global commandDict + global firstChars directory = os.path.join('docs', 'plugins') if not os.path.exists(directory): os.mkdir(directory) @@ -178,23 +184,26 @@ def makeCommandsIndex():

Supybot Commands Index

- Command (Plugins)
""")) commands = [c for c in commandDict.iterkeys()] commands.sort() - alphas = [] - for command in commands: - char = command[0] - if char in alphas: - pass + for i in ascii_lowercase: + if i in firstChars: + fd.write('%s ' % (i, i.capitalize())) else: - alphas.append(char) - fd.write('

%s'\ - '

\n' % (char, char.capitalize())) + fd.write('%s ' % i.capitalize()) + firstChars.clear() + fd.write('\n

Command (Plugins)
') + for command in commands: + c = command[0] + if c not in firstChars: + firstChars[c] = '' + fd.write('

%s

\n' % + (c, c, c.capitalize())) plugins = commandDict[command] plugins.sort() fd.write('%s (%s)
\n' % (command, - ', '.join(['%s' % (p, p) + ', '.join(['%s' % (p,command,p) for p in plugins]))) fd.write(textwrap.dedent("""