Esempio n. 1
0
def pdflatex_from_html(html):
    if os.system('which pdflatex > /dev/null') == 0:
        markmin = TAG(html).element('body').flatten(markmin_serializer)
        out, warnings, errors = markmin2pdf(markmin)
        if errors:
            current.response.headers['Content-Type'] = 'text/html'
            raise HTTP(405, HTML(BODY(H1('errors'),
                                      UL(*errors),
                                      H1('warnings'),
                                      UL(*warnings))).xml())
        else:
            return XML(out)
Esempio n. 2
0
 def test_H1(self):
     self.assertEqual(
         H1('<>', _a='1', _b='2').xml(), b'<h1 a="1" b="2">&lt;&gt;</h1>')