Esempio n. 1
0
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)
Esempio n. 2
0
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)
Esempio n. 3
0
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')
Esempio n. 4
0
def test_shortcut_string():
    html = tuhinga.string('html5\n  head\n')
    eq_(html, '<!doctype html>\n<html>\n  <head></head>\n</html>\n')
Esempio n. 5
0
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)
Esempio n. 6
0
def api():
    '''Backend view: convert POST input to html'''
    string = request.forms.get('src')
    return {'html': template('{{ src }}', src=tuhinga.string(string))}