mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-03 01:39:23 +01:00
Made the pages HTML 4.01 strict compliant.
Changed the path to write out the documentation
This commit is contained in:
parent
392113f29a
commit
50c1749a46
@ -49,6 +49,8 @@ if conf.pluginDir not in sys.path:
|
|||||||
sys.path.insert(0, conf.pluginDir)
|
sys.path.insert(0, conf.pluginDir)
|
||||||
|
|
||||||
def makePluginDocumentation(filename):
|
def makePluginDocumentation(filename):
|
||||||
|
trClasses = { 'dark':'light', 'light':'dark' }
|
||||||
|
trClass = 'dark'
|
||||||
pluginName = filename.split('.')[0]
|
pluginName = filename.split('.')[0]
|
||||||
moduleInfo = imp.find_module(pluginName)
|
moduleInfo = imp.find_module(pluginName)
|
||||||
module = imp.load_module(pluginName, *moduleInfo)
|
module = imp.load_module(pluginName, *moduleInfo)
|
||||||
@ -58,13 +60,21 @@ def makePluginDocumentation(filename):
|
|||||||
plugin = module.Class()
|
plugin = module.Class()
|
||||||
if isinstance(plugin, callbacks.Privmsg) and not \
|
if isinstance(plugin, callbacks.Privmsg) and not \
|
||||||
isinstance(plugin, callbacks.PrivmsgRegexp):
|
isinstance(plugin, callbacks.PrivmsgRegexp):
|
||||||
fd = file('plugindocs/%s.html' % pluginName, 'w')
|
fd = file(os.path.join(directory,'%s.html' % pluginName), 'w')
|
||||||
fd.write(textwrap.dedent("""
|
fd.write(textwrap.dedent("""
|
||||||
<html><title>Documentation for the %s plugin for Supybot</title>
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||||
<body>%s<br><br>
|
<html lang="en-us">
|
||||||
<table><tr><td>Command</td><td>Args</td><td>Detailed Help</td></tr>
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<title>Documentation for the %s plugin for Supybot</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="supybot.css">
|
||||||
|
<body><div>
|
||||||
|
%s<br><br><table>
|
||||||
|
<tr id="headers"><td>Command</td><td>Args</td><td>
|
||||||
|
Detailed Help</td></tr>
|
||||||
""") % (pluginName, cgi.escape(module.__doc__)))
|
""") % (pluginName, cgi.escape(module.__doc__)))
|
||||||
for attr in dir(plugin):
|
for attr in dir(plugin):
|
||||||
|
trClass = trClasses[trClass]
|
||||||
if plugin.isCommand(attr):
|
if plugin.isCommand(attr):
|
||||||
method = getattr(plugin, attr)
|
method = getattr(plugin, attr)
|
||||||
if hasattr(method, '__doc__'):
|
if hasattr(method, '__doc__'):
|
||||||
@ -76,8 +86,9 @@ def makePluginDocumentation(filename):
|
|||||||
doclines = map(str.strip, doclines)
|
doclines = map(str.strip, doclines)
|
||||||
morehelp = ' '.join(doclines)
|
morehelp = ' '.join(doclines)
|
||||||
fd.write(textwrap.dedent("""
|
fd.write(textwrap.dedent("""
|
||||||
<tr><td>%s</td><td>%s</td><td>%s</td></tr>
|
<tr class="%s"><td>%s</td><td>%s</td><td class="detail">%s
|
||||||
""") % (attr, cgi.escape(help), cgi.escape(morehelp)))
|
</td></tr>
|
||||||
|
""") % (trClass, attr, cgi.escape(help), cgi.escape(morehelp)))
|
||||||
fd.write(textwrap.dedent("""
|
fd.write(textwrap.dedent("""
|
||||||
</table>
|
</table>
|
||||||
"""))
|
"""))
|
||||||
@ -86,12 +97,16 @@ def makePluginDocumentation(filename):
|
|||||||
s = s.replace('\\n', '\n')
|
s = s.replace('\\n', '\n')
|
||||||
s = s.replace("\\'", "'")
|
s = s.replace("\\'", "'")
|
||||||
fd.write(textwrap.dedent("""
|
fd.write(textwrap.dedent("""
|
||||||
<p>Here's an example session with this plugin:
|
<p>Here's an example session with this plugin:</p>
|
||||||
<pre>
|
<pre>
|
||||||
%s
|
%s
|
||||||
</pre>
|
</pre>
|
||||||
</p>
|
|
||||||
""") % cgi.escape(s))
|
""") % cgi.escape(s))
|
||||||
|
fd.write(textwrap.dedent("""
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
"""))
|
||||||
fd.close()
|
fd.close()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
Reference in New Issue
Block a user