mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 11:12:47 +01:00
supybot-plugin-doc: Stub support for rendering different formats
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
This commit is contained in:
parent
acd4e26401
commit
160b7b2fdd
@ -162,13 +162,18 @@ class PluginDoc(object):
|
|||||||
def genDoc(m, options):
|
def genDoc(m, options):
|
||||||
Plugin = PluginDoc(m)
|
Plugin = PluginDoc(m)
|
||||||
print 'Generating documentation for %s...' % Plugin.name
|
print 'Generating documentation for %s...' % Plugin.name
|
||||||
path = os.path.join(options.outputDir, '%s.stx' % Plugin.name)
|
path = os.path.join(options.outputDir, '%s.%s' % (Plugin.name,
|
||||||
|
options.format))
|
||||||
try:
|
try:
|
||||||
fd = file(path, 'w')
|
fd = file(path, 'w')
|
||||||
except EnvironmentError, e:
|
except EnvironmentError, e:
|
||||||
error('Unable to open %s for writing.' % path)
|
error('Unable to open %s for writing.' % path)
|
||||||
|
f = getattr(Plugin, 'render%s' % options.format.upper(), None)
|
||||||
|
if f is None:
|
||||||
|
fd.close()
|
||||||
|
error('Unknown render format: `%s\'' % options.format)
|
||||||
try:
|
try:
|
||||||
fd.write(Plugin.renderSTX())
|
fd.write(f())
|
||||||
finally:
|
finally:
|
||||||
fd.close()
|
fd.close()
|
||||||
|
|
||||||
@ -186,6 +191,9 @@ if __name__ == '__main__':
|
|||||||
parser.add_option('-o', '--output-dir', dest='outputDir', default='.',
|
parser.add_option('-o', '--output-dir', dest='outputDir', default='.',
|
||||||
help='Specifies the directory in which to write the '
|
help='Specifies the directory in which to write the '
|
||||||
'documentation for the plugin.')
|
'documentation for the plugin.')
|
||||||
|
parser.add_option('-f', '--format', dest='format', choices=['rst', 'stx'],
|
||||||
|
default='stx', help='Specifies which output format to '
|
||||||
|
'use.')
|
||||||
parser.add_option('--plugins-dir',
|
parser.add_option('--plugins-dir',
|
||||||
action='append', dest='pluginsDirs', default=[],
|
action='append', dest='pluginsDirs', default=[],
|
||||||
help='Looks in in the given directory for plugins and '
|
help='Looks in in the given directory for plugins and '
|
||||||
|
Loading…
Reference in New Issue
Block a user