Print out Reports as well

svn: r5284
This commit is contained in:
Martin Hawlisch 2005-10-06 21:45:57 +00:00
parent bf8abfdf56
commit 038cbfa9bb

View File

@ -57,63 +57,73 @@ class CmdRef(Tool.Tool):
f.write('<?xml version="1.0" encoding="UTF-8"?>\n') f.write('<?xml version="1.0" encoding="UTF-8"?>\n')
f.write('<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" ') f.write('<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" ')
f.write(' "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">\n') f.write(' "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">\n')
f.write('<article id="index" lang="en">\n') f.write('<appendix id="plugin_ref" lang="en">\n')
f.write(' <title>Reports and Tools parameter reference</title>\n') f.write(' <title>Reports and Tools parameter reference</title>\n')
f.write(' <sect1 id="reps">\n') f.write(' <sect1 id="reps">\n')
f.write(' <title>Reports</title>\n') f.write(' <title>Reports</title>\n')
counter=0
for item in PluginMgr.cl_list: for item in PluginMgr.cl_list:
# self.write_ref( f, item,counter) self.write_ref( f, item)
# counter = counter + 1
pass
f.write(' </sect1>\n') f.write(' </sect1>\n')
f.write(' <sect1 id="tools">\n') f.write(' <sect1 id="plugin_ref_tools">\n')
f.write(' <title>Tools</title>\n') f.write(' <title>Tools</title>\n')
for item in PluginMgr.cli_tool_list: for item in PluginMgr.cli_tool_list:
self.write_ref( f, item, counter) self.write_ref( f, item)
counter = counter + 1 f.write(' </sect1>')
f.write(' </sect1>\n') f.write(' ')
f.write(' \n') f.write(' ')
f.write(' \n') f.write(' ')
f.write(' \n') f.write('</appendix>')
f.write('</article>\n')
f.flush() f.flush()
os.spawnlp( os.P_WAIT, "yelp", "yelp", fname) os.spawnlp( os.P_WAIT, "yelp", "yelp", fname)
f.close() f.close()
def write_ref( self, f, item,counter): def fix(self,line):
f.write('<sect2 id="sect2id%d">\n' % counter) l = line.strip()
f.write(' <title>%s</title>\n' % item[0]) l = l.replace('&','&amp;')
f.write(' <simplesect>\n') l = l.replace('>','&gt;')
f.write(' <title>Options</title>\n') l = l.replace('<','&lt;')
f.write(' <variablelist>\n') return l.replace('"','&quot;')
oclass = item[3]( item[0])
print oclass
for arg in oclass.options_help.keys():
f.write(' <variablelist>\n')
f.write(' <varlistentry>\n')
f.write(' <term><command>%s</command>: %s</term>\n' % (arg, oclass.options_help[arg][0]))
f.write(' <listitem>\n')
f.write(' <para>%s</para>\n' % oclass.options_help[arg][1])
if type(oclass.options_help[arg][2]) in [list,tuple]:
if oclass.options_help[arg][3]:
f.write(' <orderedlist>\n')
for val in oclass.options_help[arg][2]:
f.write( " <listitem>%s</listitem>\n" % val)
f.write(' </orderedlist>\n')
else:
f.write(' <itemizedlist>\n')
for val in oclass.options_help[arg][2]:
f.write( " <listitem>%s</listitem>\n" % val)
f.write(' </itemizedlist>\n')
else:
f.write(' <para>Value: <userinput>%s</userinput></para>\n' % oclass.options_help[arg][2])
f.write(' </listitem>\n')
f.write(' </varlistentry>\n')
f.write(' </variablelist>\n')
f.write(' </variablelist>\n') def write_ref( self, f, item):
f.write(' </simplesect>\n') f.write('<sect2 id="tool_opt_%s">\n' % item[0])
f.write(' <title>%s</title>\n' % self.fix(item[0]))
try: # For Tools
oclass = item[3]( item[0])
except: # For Reports
oclass = item[3]
try:
ohelp = oclass.options_help
except:
ohelp = None
if ohelp:
f.write(' <simplesect>\n')
f.write(' <title>Options</title>\n')
f.write(' <variablelist>\n')
for arg in ohelp.keys():
f.write(' <variablelist>\n')
f.write(' <varlistentry>\n')
f.write(' <term><command>%s</command>: %s</term>\n' % (self.fix(arg), self.fix(ohelp[arg][0])))
f.write(' <listitem>\n')
f.write(' <para>%s</para>\n' % self.fix(ohelp[arg][1]))
if type(ohelp[arg][2]) in [list,tuple]:
if ohelp[arg][3]:
f.write(' <orderedlist>\n')
for val in ohelp[arg][2]:
f.write( " <listitem>%s</listitem>\n" % self.fix(val))
f.write(' </orderedlist>\n')
else:
f.write(' <itemizedlist>\n')
for val in ohelp[arg][2]:
f.write( " <listitem>%s</listitem>\n" % self.fix(val))
f.write(' </itemizedlist>\n')
else:
f.write(' <para>Value: <userinput>%s</userinput></para>\n' % self.fix(ohelp[arg][2]))
f.write(' </listitem>\n')
f.write(' </varlistentry>\n')
f.write(' </variablelist>\n')
f.write(' </variablelist>\n')
f.write(' </simplesect>\n')
f.write('</sect2>\n') f.write('</sect2>\n')
#------------------------------------------------------------------------ #------------------------------------------------------------------------