Skip to content

Commit

Permalink
Started templating
Browse files Browse the repository at this point in the history
  • Loading branch information
oksome committed Nov 12, 2013
1 parent 8f69821 commit d4e526a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions templating.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import html
import time

import tumulus.tags as t
import tumulus.formulas as f
import tumulus.embed as e


def template(filename, **locals):
path = 'templates/{}'.format(filename)
with open(path) as source:
code = compile(source.read(), path, 'eval')
return eval(code, {'t': t, 'f': f, 'e': e,
'escape': html.escape, 'ctime': time.ctime},
locals)


def build_template(filename, **locals):
return template(filename, **locals).build()

0 comments on commit d4e526a

Please sign in to comment.