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
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')
def test_repeated_key(self): tpl = 'foo {{ key1 }} baz {{ key1 }}' out = makesite.render(tpl, key1='bar') self.assertEqual(out, 'foo bar baz bar')
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')
def test_multiline_template(self): tpl = 'foo {{ key1 }}\nbaz {{ key1 }}' out = makesite.render(tpl, key1='bar') self.assertEqual(out, 'foo bar\nbaz bar')