* src/plugins/CmdRef.py: Work out Report docs.
* src/Report.py: Typo. svn: r5285
This commit is contained in:
parent
038cbfa9bb
commit
4f86f7d28b
@ -1,3 +1,7 @@
|
|||||||
|
2005-10-06 Alex Roitman <shura@gramps-project.org>
|
||||||
|
* src/plugins/CmdRef.py: Work out Report docs.
|
||||||
|
* src/Report.py: Typo.
|
||||||
|
|
||||||
2005-10-06 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
2005-10-06 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
||||||
* src/plugins/CmdRef.py: New file.
|
* src/plugins/CmdRef.py: New file.
|
||||||
|
|
||||||
|
@ -1596,7 +1596,7 @@ class CommandLineReport:
|
|||||||
|
|
||||||
def init_options(self):
|
def init_options(self):
|
||||||
self.options_dict = {
|
self.options_dict = {
|
||||||
'of' : self.option_class.handler.report_name,
|
'of' : self.option_class.handler.module_name,
|
||||||
'off' : self.option_class.handler.get_format_name(),
|
'off' : self.option_class.handler.get_format_name(),
|
||||||
'style' : self.option_class.handler.get_default_stylesheet_name(),
|
'style' : self.option_class.handler.get_default_stylesheet_name(),
|
||||||
'papers' : self.option_class.handler.get_paper_name(),
|
'papers' : self.option_class.handler.get_paper_name(),
|
||||||
|
@ -22,14 +22,14 @@
|
|||||||
|
|
||||||
"Export Report and Tools commandline parameters to DocBook XML"
|
"Export Report and Tools commandline parameters to DocBook XML"
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# python modules
|
# python modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
|
from cgi import escape
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -40,6 +40,7 @@ from gettext import gettext as _
|
|||||||
import Tool
|
import Tool
|
||||||
import Utils
|
import Utils
|
||||||
import PluginMgr
|
import PluginMgr
|
||||||
|
import Report
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -55,69 +56,84 @@ class CmdRef(Tool.Tool):
|
|||||||
f = tempfile.NamedTemporaryFile()
|
f = tempfile.NamedTemporaryFile()
|
||||||
fname = f.name
|
fname = f.name
|
||||||
f.write('<?xml version="1.0" encoding="UTF-8"?>\n')
|
f.write('<?xml version="1.0" encoding="UTF-8"?>\n')
|
||||||
|
f.write('<?yelp:chunk-depth 2?>\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('<appendix id="plugin_ref" lang="en">\n')
|
f.write('<article id="index" 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)
|
category = item[1]
|
||||||
|
if category in (Report.CATEGORY_BOOK,
|
||||||
|
Report.CATEGORY_CODE,
|
||||||
|
Report.CATEGORY_WEB):
|
||||||
|
self.write_ref(f,item,counter,category)
|
||||||
|
else:
|
||||||
|
self.write_ref( f, item, counter, None)
|
||||||
|
counter = counter + 1
|
||||||
f.write(' </sect1>\n')
|
f.write(' </sect1>\n')
|
||||||
f.write(' <sect1 id="plugin_ref_tools">\n')
|
f.write(' <sect1 id="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)
|
self.write_ref( f, item, counter)
|
||||||
f.write(' </sect1>')
|
counter = counter + 1
|
||||||
f.write(' ')
|
f.write(' </sect1>\n')
|
||||||
f.write(' ')
|
f.write(' \n')
|
||||||
f.write(' ')
|
f.write(' \n')
|
||||||
f.write('</appendix>')
|
f.write(' \n')
|
||||||
|
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 fix(self,line):
|
def write_ref( self, f, item,counter,category=None):
|
||||||
l = line.strip()
|
f.write('<sect2 id="sect2id%d">\n' % counter)
|
||||||
l = l.replace('&','&')
|
f.write(' <title>%s</title>\n' % item[0])
|
||||||
l = l.replace('>','>')
|
|
||||||
l = l.replace('<','<')
|
|
||||||
return l.replace('"','"')
|
|
||||||
|
|
||||||
def write_ref( self, f, item):
|
|
||||||
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(' <simplesect>\n')
|
||||||
f.write(' <title>Options</title>\n')
|
f.write(' <title>Options</title>\n')
|
||||||
f.write(' <variablelist>\n')
|
f.write(' <variablelist>\n')
|
||||||
for arg in ohelp.keys():
|
if category == None:
|
||||||
|
oclass = item[3]( item[0])
|
||||||
|
elif category == Report.CATEGORY_BOOK:
|
||||||
|
import BookReport
|
||||||
|
oclass = BookReport.BookOptions(item[0])
|
||||||
|
elif category == Report.CATEGORY_CODE:
|
||||||
|
import GraphViz
|
||||||
|
oclass = GraphViz.GraphVizOptions(item[0])
|
||||||
|
elif category == Report.CATEGORY_WEB:
|
||||||
|
if item[0] == "webpage":
|
||||||
|
import WebPage
|
||||||
|
oclass = WebPage.WebReportOptions(item[0])
|
||||||
|
elif item[0] == "navwebpage":
|
||||||
|
import NavWebPage
|
||||||
|
oclass = NavWebPage.WebReportOptions(item[0])
|
||||||
|
|
||||||
|
for arg in oclass.options_help.keys():
|
||||||
f.write(' <variablelist>\n')
|
f.write(' <variablelist>\n')
|
||||||
f.write(' <varlistentry>\n')
|
f.write(' <varlistentry>\n')
|
||||||
f.write(' <term><command>%s</command>: %s</term>\n' % (self.fix(arg), self.fix(ohelp[arg][0])))
|
f.write(' <term><command>%s</command>: %s</term>\n'
|
||||||
|
% (escape(arg), escape(oclass.options_help[arg][0])))
|
||||||
f.write(' <listitem>\n')
|
f.write(' <listitem>\n')
|
||||||
f.write(' <para>%s</para>\n' % self.fix(ohelp[arg][1]))
|
f.write(' <para>%s</para>\n'
|
||||||
if type(ohelp[arg][2]) in [list,tuple]:
|
% escape(oclass.options_help[arg][1]))
|
||||||
if ohelp[arg][3]:
|
if type(oclass.options_help[arg][2]) in [list,tuple]:
|
||||||
|
if oclass.options_help[arg][3]:
|
||||||
f.write(' <orderedlist>\n')
|
f.write(' <orderedlist>\n')
|
||||||
for val in ohelp[arg][2]:
|
for val in oclass.options_help[arg][2]:
|
||||||
f.write( " <listitem>%s</listitem>\n" % self.fix(val))
|
f.write( " <listitem>%s</listitem>\n"
|
||||||
|
% escape(val))
|
||||||
f.write(' </orderedlist>\n')
|
f.write(' </orderedlist>\n')
|
||||||
else:
|
else:
|
||||||
f.write(' <itemizedlist>\n')
|
f.write(' <itemizedlist>\n')
|
||||||
for val in ohelp[arg][2]:
|
for val in oclass.options_help[arg][2]:
|
||||||
f.write( " <listitem>%s</listitem>\n" % self.fix(val))
|
f.write( " <listitem>%s</listitem>\n"
|
||||||
|
% escape(val))
|
||||||
f.write(' </itemizedlist>\n')
|
f.write(' </itemizedlist>\n')
|
||||||
else:
|
else:
|
||||||
f.write(' <para>Value: <userinput>%s</userinput></para>\n' % self.fix(ohelp[arg][2]))
|
f.write(' <para>Value: <userinput>%s</userinput></para>\n'
|
||||||
|
% escape(oclass.options_help[arg][2]))
|
||||||
f.write(' </listitem>\n')
|
f.write(' </listitem>\n')
|
||||||
f.write(' </varlistentry>\n')
|
f.write(' </varlistentry>\n')
|
||||||
f.write(' </variablelist>\n')
|
f.write(' </variablelist>\n')
|
||||||
@ -139,8 +155,10 @@ register_tool(
|
|||||||
tool_class = CmdRef,
|
tool_class = CmdRef,
|
||||||
options_class = Tool.ToolOptions,
|
options_class = Tool.ToolOptions,
|
||||||
modes = Tool.MODE_GUI | Tool.MODE_CLI,
|
modes = Tool.MODE_GUI | Tool.MODE_CLI,
|
||||||
translated_name = _("Generate Commandline Reference for Reports and Tools"),
|
translated_name = _("Generate Commandline Reference "
|
||||||
|
"for Reports and Tools"),
|
||||||
author_name = "Martin Hawlisch",
|
author_name = "Martin Hawlisch",
|
||||||
author_email = "martin@hawlisch.de",
|
author_email = "martin@hawlisch.de",
|
||||||
description=_("Generates a DocBook XML file that contains a parameter reference of Reports and Tools.")
|
description=_("Generates a DocBook XML file that contains "
|
||||||
|
"a parameter reference of Reports and Tools.")
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user