Пример #1
0
 def testNonLocalEqRefWithHeading(self):
     ast = katex.EquationReference(None, label='second_law', filename='katex_include2.md')
     res = self.render(ast, renderer=base.HTMLRenderer())
     self.assertHTMLTag(res, 'body', size=1)
     self.assertHTMLTag(res(0), 'a', size=9, class_='moose-equation-reference')
     self.assertIn('extensions/katex_include2.html#moose-equation-', res(0)['href'])
     self.assertIn('Equations', res(0,0)['content'])
     self.assertIn('Eq. (2)', res(0,8)['content'])
Пример #2
0
 def testLocalEqRef(self):
     ast = katex.EquationReference(None, label='second_law')
     res = self.render(ast, renderer=base.HTMLRenderer())
     self.assertHTMLTag(res, 'body', size=1)
     self.assertHTMLTag(res(0),
                        'a',
                        size=1,
                        class_='moose-equation-reference',
                        href='#None',
                        string='Eq. (None)')
Пример #3
0
 def testExceptions(self):
     ast = katex.EquationReference(None, label='first_law', filename='katex_include2.md')
     with self.assertLogs(level=logging.ERROR) as cm:
         res = self.render(ast, renderer=base.HTMLRenderer())
     self.assertHTMLTag(res, 'body', size=1)
     self.assertHTMLTag(res(0), 'a', size=9, class_='moose-error')
     self.assertIn('extensions/katex_include2.html#None', res(0)['href'])
     self.assertIn('Equations', res(0,0)['content'])
     self.assertIn('extensions/katex_include2.md#first_law', res(0,8)['content'])
     self.assertEqual(len(cm.output), 2)
     self.assertIn('Could not find equation with key first_law on page extensions/katex_include2.md', cm.output[1])
Пример #4
0
 def testLocalEqRef(self):
     ast = katex.EquationReference(None, label='second_law')
     res = self.render(ast, renderer=base.LatexRenderer())
     self.assertLatexString(res(0), content='Eq.~')
     self.assertLatexCommand(res(1), 'eqref', string='second_law')