def test_multiline_content(): html = tuhinga.string('html5\n body\n' ' :: some test content\n' ' :: some more test content') comp = ('<!doctype html>\n<html>\n <body>\n' ' some test content\n' ' some more test content\n' ' </body>\n</html>\n') eq_(html, comp)
def test_mapping(): html = tuhinga.string('html5\n body\n input-checkbox test\n') comp = ('<!doctype html>\n<html>\n <body>\n' ' <input type="checkbox" value="test">\n' ' </body>\n</html>\n') eq_(html, comp)
def test_shortcut_string_args(): html = tuhinga.string('html5\n head\n', input_indent=3, output_indent=8) eq_(html, '<!doctype html>\n<html>\n <head></head>\n</html>\n')
def test_shortcut_string(): html = tuhinga.string('html5\n head\n') eq_(html, '<!doctype html>\n<html>\n <head></head>\n</html>\n')
def index(): '''Frontend view: convert tuhinga to html and pass as bottle template''' html = tuhinga.string(code) tpl = tuhinga.string(frontend) return template(tpl, initial_doc=code, initial_html=html)
def api(): '''Backend view: convert POST input to html''' string = request.forms.get('src') return {'html': template('{{ src }}', src=tuhinga.string(string))}