Add templating folder and stub files/templates.
This commit is contained in:
parent
bfec7752cb
commit
0b8b77697b
3 changed files with 46 additions and 0 deletions
18
templating/build.py
Normal file
18
templating/build.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
from jinja2 import Environment, FileSystemLoader
|
||||
import json
|
||||
|
||||
def jsonify(input):
|
||||
return json.dumps(input, indent=4)
|
||||
|
||||
env = Environment(loader=FileSystemLoader("templates"))
|
||||
env.filters["jsonify"] = jsonify
|
||||
|
||||
example = {}
|
||||
with open("../example.json", "r") as f:
|
||||
example = json.loads(f.read())
|
||||
event = {}
|
||||
with open("../event_schema.json", "r") as f:
|
||||
event = json.loads(f.read())
|
||||
|
||||
template = env.get_template("events.tmpl")
|
||||
print template.render(example=example, event=event)
|
Loading…
Add table
Add a link
Reference in a new issue