示例#1
0
    def createTokenFromSyntax(self, parent, info, page, obj):

        primary = SyntaxList(None, **self.attributes)
        if self.settings['groups']:
            groups = self.settings['groups'].split()
        else:
            groups = list(set([child.group for child in obj if child.group is not None]))

        if 'MooseApp' in groups:
            groups.remove('MooseApp')
            groups.insert(0, 'MooseApp')

        for group in groups:
            if self.settings['group-headings']:
                header = SyntaxListItem(primary,
                                        header=True,
                                        string=str(mooseutils.camel_to_space(group)))

            count = 0
            if self.settings['actions']:
                count += self._addItems(primary, info, page, group, obj.actions(), 'Action')
            if self.settings['objects']:
                count += self._addItems(primary, info, page, group, obj.objects(), 'MooseObject')
            if self.settings['subsystems']:
                count += self._addItems(primary, info, page, group, obj.syntax())

            if count == 0:
                header.parent = None

        if primary.children:
            self.createHeading(parent, page)
            primary.parent = parent

        return parent
示例#2
0
    def createTokenFromSyntax(self, parent, info, page, obj):

        master = SyntaxList(None)

        groups = self.settings['groups'].split() if self.settings['groups'] else list(obj.groups)
        if 'MooseApp' in groups:
            groups.remove('MooseApp')
            groups.insert(0, 'MooseApp')

        for group in groups:
            header = SyntaxListItem(master,
                                    header=True,
                                    string=unicode(mooseutils.camel_to_space(group)))

            count = 0
            if self.settings['actions']:
                count += self._addItems(master, info, page, group, obj.actions(), 'Action')
            if self.settings['objects']:
                count += self._addItems(master, info, page, group, obj.objects(), 'MooseObject')
            if self.settings['subsystems']:
                count += self._addItems(master, info, page, group, obj.syntax())

            if count == 0:
                header.parent = None

        if master.children:
            self.createHeading(parent, page)
            master.parent = parent

        return parent
示例#3
0
    def createTokenFromSyntax(self, parent, info, page, obj):

        master = SyntaxList(None)

        groups = self.settings['groups'].split() if self.settings['groups'] else list(obj.groups)
        if 'MooseApp' in groups:
            groups.remove('MooseApp')
            groups.insert(0, 'MooseApp')

        for group in groups:
            header = SyntaxListItem(master,
                                    header=True,
                                    string=unicode(mooseutils.camel_to_space(group)))

            count = 0
            if self.settings['actions']:
                count += self._addItems(master, info, page, group, obj.actions())
            if self.settings['objects']:
                count += self._addItems(master, info, page, group, obj.objects())
            if self.settings['subsystems']:
                count += self._addItems(master, info, page, group, obj.syntax())

            if count == 0:
                header.parent = None

        if master.children:
            self.createHeading(parent, page)
            master.parent = parent

        return parent
示例#4
0
    def createMaterialize(self, token, parent):

        active_groups = [group.lower() for group in token.groups]
        errors = []

        groups = list(token.syntax.groups)
        if 'MOOSE' in groups:
            groups.remove('MOOSE')
            groups.insert(0, 'MOOSE')

        collection = html.Tag(None, 'ul', class_='collection with-header')
        n_groups = len(active_groups)
        for group in groups:

            if active_groups and group.lower() not in active_groups:
                continue

            if n_groups > 1:
                li = html.Tag(collection,
                              'li',
                              class_='moose-syntax-header collection-header',
                              string=unicode(mooseutils.camel_to_space(group)))

            count = len(collection.children)
            if token.actions:
                errors += self._addItems(collection, token,
                                         token.syntax.actions(group=group),
                                         'moose-syntax-actions')
            if token.objects:
                errors += self._addItems(collection, token,
                                         token.syntax.objects(group=group),
                                         'moose-syntax-objects')
            if token.subsystems:
                errors += self._addItems(collection, token,
                                         token.syntax.syntax(group=group),
                                         'moose-syntax-subsystems')

            if n_groups > 1 and len(collection.children) == count:
                li.parent = None

            if collection.children:
                collection.parent = parent

        if errors:
            msg = "The following errors were reported when accessing the '{}' syntax.\n\n"
            msg += '\n\n'.join(errors)
            raise exceptions.RenderException(token.info, msg,
                                             token.syntax.fullpath)
示例#5
0
文件: appsyntax.py 项目: FHilty/moose
    def createMaterialize(self, token, parent):

        active_groups = [group.lower() for group in token.groups]
        errors = []

        groups = list(token.syntax.groups)
        if 'MOOSE' in groups:
            groups.remove('MOOSE')
            groups.insert(0, 'MOOSE')

        collection = html.Tag(None, 'ul', class_='collection with-header')
        n_groups = len(active_groups)
        for group in groups:

            if active_groups and group.lower() not in active_groups:
                continue

            if n_groups > 1:
                li = html.Tag(collection, 'li',
                              class_='moose-syntax-header collection-header',
                              string=unicode(mooseutils.camel_to_space(group)))

            count = len(collection.children)
            if token.actions:
                errors += self._addItems(collection, token, token.syntax.actions(group=group),
                                         'moose-syntax-actions')
            if token.objects:
                errors += self._addItems(collection, token, token.syntax.objects(group=group),
                                         'moose-syntax-objects')
            if token.subsystems:
                errors += self._addItems(collection, token, token.syntax.syntax(group=group),
                                         'moose-syntax-subsystems')

            if n_groups > 1 and len(collection.children) == count:
                li.parent = None

            if collection.children:
                collection.parent = parent

        if errors:
            msg = "The following errors were reported when accessing the '{}' syntax.\n\n"
            msg += '\n\n'.join(errors)
            raise exceptions.RenderException(token.info, msg, token.syntax.fullpath)
示例#6
0
 def assertInvert(self, text, gold):
     self.assertEqual(camel_to_space(text), gold)
示例#7
0
 def _display(node):
     """
     Create the breadcumb display name (i.e., separate camel case).
     """
     return mooseutils.camel_to_space(node.display)
示例#8
0
 def _display(node):
     """
     Create the breadcumb display name (i.e., separate camel case).
     """
     return mooseutils.camel_to_space(node.display)