def testHeading(self): token = tokens.Heading(level=4) self.assertEqual(token.level, 4) with self.assertRaises(exceptions.MooseDocsException) as e: token = tokens.Heading(level='not int') gold = "The supplied property 'level' must be of type 'int', but 'str' was provided." self.assertEqual(e.exception.message, gold)
def _addList(self, parent, obj, actions, group, level): for child in obj.syntax(group=group): if child.removed: continue h = tokens.Heading(parent, level=level, string=unicode(child.fullpath.strip('/'))) # TODO: systems prefix is needed to be unique, there must be a better way url = os.path.join('systems', child.markdown()) a = autolink.AutoLink(h, url=url) materialicon.IconToken(a, icon=u'input', style="padding-left:10px;") SyntaxToken(parent, syntax=child, actions=actions, objects=True, subsystems=False, groups=[group] if group else [], level=level) self._addList(parent, child, actions, group, level + 1)
def createToken(self, token, parent): #pylint: disable=unused-argument if self.settings['title']: h = tokens.Heading(parent, level=self.settings['title-level']) self.translator.reader.parse(h, self.settings['title'], MooseDocs.INLINE) BibtexBibliography(parent, style=self.settings['style']) return parent
def createToken(self, info, parent): content = info['inline'] heading = tokens.Heading(parent, level=info['level'].count('#'), **self.attributes) tokens.Label(heading, text=content) return heading
def createHeading(self, token): heading = self.settings['heading'] if heading: h = tokens.Heading(None, level=int(self.settings['heading-level'])) self.translator.reader.parse(h, heading, group=MooseDocs.INLINE) token.heading = h token.level = int(self.settings['heading-level'])
def createToken(self, info, parent): #content = unicode(info['inline']) #TODO: is there a better way? content = info['inline'] heading = tokens.Heading(parent, level=info['level'].count('#'), **self.attributes) tokens.Label(heading, text=content) return heading
def createToken(self, info, parent): key = self.settings['key'] item = SQATemplateItem(parent, key=key) heading = self.settings.get('heading', None) if heading: item.heading = tokens.Heading(None, #pylint: disable=attribute-defined-outside-init level=int(self.settings['heading-level']), id_=key) self.translator.reader.parse(item.heading, heading) return item
def createToken(self, info, parent): col = ColumnToken(parent, width=self.settings['width'], **self.attributes) icon = self.settings.get('icon', None) if icon: block = materialicon.IconBlockToken(col) h = tokens.Heading(block, level=2, class_='center brown-text') materialicon.IconToken(h, icon=unicode(icon)) return block return col