Exemplo n.º 1
0
def form_html(params):
    page_layout = fread('layout/page.html')
    form_layout = fread('layout/form.html')
    form_layout = render(page_layout, content=form_layout)
    params.update({
        'root':
        '../',
        'title':
        'Post Comment',
        'subtitle':
        ' - Susam Pal',
        'current_year':
        datetime.datetime.now().year,
        'canonical_url':
        '/comment/',
        'imports':
        '<link rel="stylesheet" type="text/css" href="/css/form.css">',
    })
    content = render(form_layout, **params)
    return content
Exemplo n.º 2
0
 def test_oneline_template(self):
     tpl = 'foo {{ key1 }} baz {{ key2 }}'
     out = makesite.render(tpl, key1='bar', key2='qux')
     self.assertEqual(out, 'foo bar baz qux')
Exemplo n.º 3
0
 def test_repeated_key(self):
     tpl = 'foo {{ key1 }} baz {{ key1 }}'
     out = makesite.render(tpl, key1='bar')
     self.assertEqual(out, 'foo bar baz bar')
Exemplo n.º 4
0
 def test_multiline_placeholder(self):
     tpl = 'foo {{\nkey1\n}} baz {{\nkey2\n}}'
     out = makesite.render(tpl, key1='bar', key2='qux')
     self.assertEqual(out, 'foo bar baz qux')
Exemplo n.º 5
0
 def test_multiline_template(self):
     tpl = 'foo {{ key1 }}\nbaz {{ key1 }}'
     out = makesite.render(tpl, key1='bar')
     self.assertEqual(out, 'foo bar\nbaz bar')