Ejemplo n.º 1
0
 def write_macro_for_listof(self, sbml_class):
     if sbml_class['hasListOf']:
         if 'lo_elementName' in sbml_class \
                 and sbml_class['lo_elementName'] != '':
             lo_name = strFunctions.upper_first(
                 sbml_class['lo_elementName'])
         else:
             lo_name = strFunctions.cap_list_of_name(sbml_class['name'])
         self.write_line('\\newcommand{0}\\{1}{2}{0}\\defRef{0}{1}{2}'
                         '{0}{3}{2}{2}'
                         .format(self.start_b, lo_name, self.end_b,
                                 strFunctions.make_class(lo_name)))
         # hack for render
         if sbml_class['name'] == 'GradientBase':
             self.write_line('\\newcommand{0}\\{4}{2}{0}\\defRef{0}{1}{2}'
                             '{0}{3}{2}{2}'
                             .format(self.start_b, lo_name, self.end_b,
                                     strFunctions.make_class(lo_name),
                                     'ListOfGradientBases'))
         elif sbml_class['name'] == 'RenderPoint':
             self.write_line('\\newcommand{0}\\{4}{2}{0}\\defRef{0}{1}{2}'
                             '{0}{3}{2}{2}'
                             .format(self.start_b, lo_name, self.end_b,
                                     strFunctions.make_class(lo_name),
                                     'ListOfRenderPoints'))
Ejemplo n.º 2
0
 def write_macro_for_plugin(self, plugin):
     self.write_line('\\newcommand{0}\\{1}{2}{0}\\defRef{0}{4}{2}'
                     '{0}{3}{2}{2}'
                     .format(self.start_b, plugin['sbase'],
                             self.end_b,
                             strFunctions.make_class(plugin['sbase']),
                             plugin['sbase']))
Ejemplo n.º 3
0
 def write_macro_for_class(self, sbml_class):
     self.write_line('\\newcommand{0}\\{1}{2}{0}\\defRef{0}{4}{2}'
                     '{0}{3}{2}{2}'
                     .format(self.start_b, sbml_class['texname'],
                             self.end_b,
                             strFunctions.make_class(sbml_class['texname']),
                             sbml_class['name']))
Ejemplo n.º 4
0
    def write_body_for_extended_class(self, plugin):
        extended_object = plugin['sbase']
        ex_objects = []
        for i in range(0, len(plugin['extension'])):
            name = plugin['extension'][i]['name']
            indef = strFunctions.get_indefinite(name)
            ex_objects.append('{} \\{} object'.format(indef, name))
        for i in range(0, len(plugin['lo_extension'])):
            name = plugin['lo_extension'][i]['listOfClassName']
            ex_objects.append('a \\{} object'.format(name))
        if len(plugin['attribs']) > 0:
            ex_objects.append('the following attributes.')
        # section heading
        self.write_comment_line('---------------------------------------------'
                                '------------')
        self.write_line('\subsection{0}The extended \class{0}{1}{2} class{2}'
                        .format(self.start_b, plugin['sbase'], self.end_b))
        self.write_line('\\label{}{}{}'
                        .format(self.start_b,
                                strFunctions.make_class(plugin['sbase']),
                                self.end_b))
        self.skip_line()
        self.write_to_do('explain where {} comes from'.format(extended_object))

        self.write_line('The {} extends the \\class{}{}{} object '
                        'with the addition of '
                        .format(self.full_pkg_command, self.start_b,
                                extended_object, self.end_b))
        num_additions = len(ex_objects)
        if num_additions > 1:
            self.write_line('{}'.format(ex_objects[0]))
            for i in range(1, num_additions-1):
                self.write_line(', {}'.format(ex_objects[i]))
            self.write_line(' and {}.'.format(ex_objects[num_additions-1]))
        elif num_additions == 1:
            self.write_line('{}.'.format(ex_objects[0]))
        self.skip_line()

        for i in range(0, len(plugin['attribs'])):
            self.write_attibute_paragraph(plugin['attribs'][i],
                                          extended_object)

        # write body for child elements
        for i in range(0, len(plugin['extension'])):
            child = self.get_class(plugin['extension'][i]['name'])
            self.write_body_for_class(child)

        for i in range(0, len(plugin['lo_extension'])):
            child = self.get_class(plugin['lo_extension'][i]['name'])
            self.write_body_for_lo_class(child)