Beispiel #1
0
    def _addRequirement(self, parent, req):
        item = SQARequirementMatrixItem(parent,
                                        label=unicode(req.label),
                                        satisfied=req.satisfied,
                                        id_=req.path)
        self.translator.reader.parse(item, req.text)

        p = tokens.Paragraph(item, 'p')
        tokens.String(p, content=u'Specification: ')

        with codecs.open(req.filename, encoding='utf-8') as fid:
            content = fid.read()
            floats.ModalLink(p,
                             'a',
                             tooltip=False,
                             url=u"#",
                             string=u"{}:{}".format(req.path, req.name),
                             title=tokens.String(None,
                                                 content=unicode(
                                                     req.filename)),
                             content=tokens.Code(None,
                                                 language=u'text',
                                                 code=content))

        p = tokens.Paragraph(item, 'p')
        tokens.String(p, content=u'Details: ')
        filename = u'{}/{}.md'.format(req.path, req.name)
        autolink.AutoShortcutLink(p, key=unicode(filename))
Beispiel #2
0
    def _addRequirement(self, parent, req):
        item = SQARequirementMatrixItem(parent, label=unicode(req.label), id_=req.path)
        self.translator.reader.parse(item, req.text)

        if self.settings['link']:
            if self.settings['link-spec']:
                p = tokens.Paragraph(item, 'p')
                tokens.String(p, content=u'Specification: ')

                with codecs.open(req.filename, encoding='utf-8') as fid:
                    content = fid.read()

                floats.ModalLink(p, 'a', tooltip=False, url=u"#",
                                 string=u"{}:{}".format(req.path, req.name),
                                 title=tokens.String(None, content=unicode(req.filename)),
                                 content=tokens.Code(None, language=u'text', code=content))

            if self.settings['link-design'] and req.design:
                p = tokens.Paragraph(item, 'p')
                tokens.String(p, content=u'Design: ')
                for design in req.design:
                    autolink.AutoShortcutLink(p, key=unicode(design))

            if self.settings['link-issues'] and req.issues:
                p = tokens.Paragraph(item, 'p')
                tokens.String(p, content=u'Issues: ')
                for issue in req.issues:
                    url = u"https://github.com/idaholab/moose/issues/{}".format(issue[1:])
                    tokens.Link(p, url=url, string=unicode(issue))
Beispiel #3
0
    def _addRequirement(self, parent, req, requirements):
        item = SQARequirementMatrixItem(parent,
                                        label=unicode(req.label),
                                        satisfied=req.satisfied,
                                        id_=req.path)
        self.translator.reader.parse(item, req.text)

        if self.settings['link']:
            if self.settings['link-spec']:
                p = tokens.Paragraph(item, 'p')
                tokens.String(p, content=u'Specification: ')

                with codecs.open(req.filename, encoding='utf-8') as fid:
                    content = fid.read()

                floats.ModalLink(p,
                                 'a',
                                 tooltip=False,
                                 url=u"#",
                                 string=u"{}:{}".format(req.path, req.name),
                                 title=tokens.String(None,
                                                     content=unicode(
                                                         req.filename)),
                                 content=tokens.Code(None,
                                                     language=u'text',
                                                     code=content))

            if self.settings['link-design'] and req.design:
                p = tokens.Paragraph(item, 'p')
                tokens.String(p, content=u'Design: ')
                for design in req.design:
                    autolink.AutoShortcutLink(p, key=unicode(design))

            if self.settings['link-issues'] and req.issues:
                p = tokens.Paragraph(item, 'p')
                tokens.String(p, content=u'Issues: ')
                for issue in req.issues:
                    if issue.startswith('#'):
                        url = u"https://github.com/idaholab/moose/issues/{}".format(
                            issue[1:])
                    else:
                        url = u"https://github.com/idaholab/moose/commit/{}".format(
                            issue[1:])
                    tokens.Link(p, url=url, string=unicode(issue))
                    tokens.Space(p)

            if self.settings['link-prerequisites'] and req.prerequisites:
                labels = []
                for prereq in req.prerequisites:
                    for other in requirements:
                        if other.name == prereq:
                            labels.append(other.label)

                p = tokens.Paragraph(item, 'p')
                tokens.String(p,
                              content=u'Prerequisites: {}'.format(
                                  ' '.join(labels)))
Beispiel #4
0
    def createToken(self, info, parent):
        design = collections.defaultdict(list)
        for requirements in self.extension.requirements.itervalues():
            for req in requirements:
                for d in req.design:
                    node = self.translator.current.findall(d)[0]
                    design[node].append(req)

        for node, requirements in design.iteritems():
            link = autolink.AutoShortcutLink(None, key=unicode(node.fullpath))
            matrix = SQARequirementMatrix(parent, heading=link)

            for req in requirements:
                self._addRequirement(matrix, req)

        return parent
Beispiel #5
0
    def createToken(self, info, parent):
        matrix = SQARequirementMatrix(parent)
        for req in self.extension.requirements:
            item = SQARequirementMatrixItem(matrix)
            self.translator.reader.parse(item, unicode(req.requirement))

            #TODO: Make option
            p = tokens.Paragraph(item, 'p')
            tokens.String(p, content=u'Specification: ')

            with codecs.open(req.filename, encoding='utf-8') as fid:
                content = fid.read()

            floats.ModalLink(p,
                             'a',
                             tooltip=False,
                             url=u"#",
                             string=u"{}:{}".format(req.path, req.name),
                             title=tokens.String(None,
                                                 content=unicode(
                                                     req.filename)),
                             content=tokens.Code(None,
                                                 language=u'text',
                                                 code=content))

            #TODO: Make option
            if req.design:
                p = tokens.Paragraph(item, 'p')
                tokens.String(p, content=u'Design: ')
                for design in req.design.split():
                    autolink.AutoShortcutLink(p, key=unicode(design))

            #TODO: Make option
            if req.issues:
                p = tokens.Paragraph(item, 'p')
                tokens.String(p, content=u'Issues: ')
                for issue in req.issues.split():
                    url = u"https://github.com/idaholab/moose/issues/{}".format(
                        issue[1:])
                    tokens.Link(p, url=url, string=unicode(issue))

        return parent
Beispiel #6
0
 def testAutoShortcutLink(self):
     token = autolink.AutoShortcutLink(key=u'foo',
                                       header=True,
                                       bookmark=u'sub')
     self.assertEqual(token.bookmark, u'sub')
     self.assertTrue(token.header)