diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index b0947de99..e533a570d 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,7 @@ +2005-10-06 Alex Roitman + * src/plugins/CmdRef.py: Work out Report docs. + * src/Report.py: Typo. + 2005-10-06 Martin Hawlisch * src/plugins/CmdRef.py: New file. diff --git a/gramps2/src/Report.py b/gramps2/src/Report.py index 753b218a2..d3bf5f0eb 100644 --- a/gramps2/src/Report.py +++ b/gramps2/src/Report.py @@ -1596,7 +1596,7 @@ class CommandLineReport: def init_options(self): 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(), 'style' : self.option_class.handler.get_default_stylesheet_name(), 'papers' : self.option_class.handler.get_paper_name(), diff --git a/gramps2/src/plugins/CmdRef.py b/gramps2/src/plugins/CmdRef.py index 8f895865e..dc4a87ae1 100644 --- a/gramps2/src/plugins/CmdRef.py +++ b/gramps2/src/plugins/CmdRef.py @@ -22,14 +22,14 @@ "Export Report and Tools commandline parameters to DocBook XML" -import os - #------------------------------------------------------------------------- # # python modules # #------------------------------------------------------------------------- +import os import tempfile +from cgi import escape from gettext import gettext as _ #------------------------------------------------------------------------- @@ -40,6 +40,7 @@ from gettext import gettext as _ import Tool import Utils import PluginMgr +import Report #------------------------------------------------------------------------- # @@ -55,75 +56,90 @@ class CmdRef(Tool.Tool): f = tempfile.NamedTemporaryFile() fname = f.name f.write('\n') + f.write('\n') f.write('\n') - f.write('\n') + f.write('
\n') f.write(' Reports and Tools parameter reference\n') f.write(' \n') f.write(' Reports\n') + counter=0 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(' \n') - f.write(' \n') + f.write(' \n') f.write(' Tools\n') for item in PluginMgr.cli_tool_list: - self.write_ref( f, item) - f.write(' ') - f.write(' ') - f.write(' ') - f.write(' ') - f.write('') + self.write_ref( f, item, counter) + counter = counter + 1 + f.write(' \n') + f.write(' \n') + f.write(' \n') + f.write(' \n') + f.write('
\n') f.flush() os.spawnlp( os.P_WAIT, "yelp", "yelp", fname) f.close() - def fix(self,line): - l = line.strip() - l = l.replace('&','&') - l = l.replace('>','>') - l = l.replace('<','<') - return l.replace('"','"') - - def write_ref( self, f, item): - f.write('\n' % item[0]) - f.write(' %s\n' % self.fix(item[0])) - try: # For Tools + def write_ref( self, f, item,counter,category=None): + f.write('\n' % counter) + f.write(' %s\n' % item[0]) + f.write(' \n') + f.write(' Options\n') + f.write(' \n') + if category == None: oclass = item[3]( item[0]) - except: # For Reports - oclass = item[3] - try: - ohelp = oclass.options_help - except: - ohelp = None - if ohelp: - f.write(' \n') - f.write(' Options\n') - f.write(' \n') - for arg in ohelp.keys(): - f.write(' \n') - f.write(' \n') - f.write(' %s: %s\n' % (self.fix(arg), self.fix(ohelp[arg][0]))) - f.write(' \n') - f.write(' %s\n' % self.fix(ohelp[arg][1])) - if type(ohelp[arg][2]) in [list,tuple]: - if ohelp[arg][3]: - f.write(' \n') - for val in ohelp[arg][2]: - f.write( " %s\n" % self.fix(val)) - f.write(' \n') - else: - f.write(' \n') - for val in ohelp[arg][2]: - f.write( " %s\n" % self.fix(val)) - f.write(' \n') + 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(' \n') + f.write(' \n') + f.write(' %s: %s\n' + % (escape(arg), escape(oclass.options_help[arg][0]))) + f.write(' \n') + f.write(' %s\n' + % escape(oclass.options_help[arg][1])) + if type(oclass.options_help[arg][2]) in [list,tuple]: + if oclass.options_help[arg][3]: + f.write(' \n') + for val in oclass.options_help[arg][2]: + f.write( " %s\n" + % escape(val)) + f.write(' \n') else: - f.write(' Value: %s\n' % self.fix(ohelp[arg][2])) - f.write(' \n') - f.write(' \n') - f.write(' \n') + f.write(' \n') + for val in oclass.options_help[arg][2]: + f.write( " %s\n" + % escape(val)) + f.write(' \n') + else: + f.write(' Value: %s\n' + % escape(oclass.options_help[arg][2])) + f.write(' \n') + f.write(' \n') + f.write(' \n') - f.write(' \n') - f.write(' \n') + f.write(' \n') + f.write(' \n') f.write('\n') #------------------------------------------------------------------------ @@ -139,8 +155,10 @@ register_tool( tool_class = CmdRef, options_class = Tool.ToolOptions, 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_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.") )