Example #1
0
    def subsystemsElement(self, group, syntax, styles):
        """
        Create table of sub-systems.
        """

        node = self._yaml.find(syntax)
        if not node:
            return createErrorElement(
                message=
                "The are not any sub-systems for the supplied syntax: {} You likely need to remove the '!subobjects' syntax."
                .format(syntax))

        table = MooseDocs.MarkdownTable('Name', 'Description')
        if node['subblocks']:
            for child in node['subblocks']:
                name = child['name']
                if self._syntax[group].hasSystem(name):
                    name = name.split('/')[-1].strip()
                    a = etree.Element('a')
                    a.set('href', '{}/Overview'.format(name))
                    a.text = name
                    table.addRow(a, child['description'])

        if table.size() == 0:
            return self.createErrorElement(
                message=
                "No sub-systems exists for the supplied syntax: {}. You likely need to remove the '!subsystems' markdown."
                .format(syntax))

        el = etree.Element('div', styles)
        h2 = etree.SubElement(el, 'h2')
        h2.text = 'Available Sub-Systems'
        el.append(table.html())
        return table.html()
Example #2
0
    def subobjectsElement(self, group, syntax, styles, settings):
        """
    Create table of sub-objects.
    """

        node = self._yaml.find(os.path.join(syntax, '*'))
        if node:
            node = self._yaml.find(syntax)
        elif not node:
            node = self._yaml.find(os.path.join(syntax, '<type>'))

        if not node:
            return self.createErrorElement(
                "The are not any sub-objects for the supplied syntax: {}".
                format(syntax))

        table = MooseDocs.MarkdownTable('Name', 'Description')
        for child in node['subblocks']:
            name = child['name']
            if name.endswith('*'):
                continue

            name = name.split('/')[-1].strip()
            if self._syntax[group].hasObject(name):
                a = etree.Element('a')
                a.set('href', '{}/index.html'.format(name))
                a.text = name
                table.addRow(a, child['description'])

        if table.size() == 0:
            return self.createErrorElement(
                "No sub-objects exists for the supplied syntax: {}".format(
                    syntax))

        el = etree.Element('div', styles)
        h2 = etree.SubElement(el, 'h2')
        h2.text = settings['title'] if settings[
            'title'] else 'Available Sub-Objects'
        el.append(table.html())
        return el