archive
/
md-pdf
Archived
1
Fork 0

Add unified helper for jinja rendering

This commit is contained in:
Jake Howard 2017-06-08 09:48:18 +01:00
parent 82fc33a1c4
commit 09b7cddcc2
1 changed files with 15 additions and 0 deletions

15
md_pdf/build/jinja.py Normal file
View File

@ -0,0 +1,15 @@
from jinja2 import Environment
def render_content(content, context):
env = Environment(
trim_blocks=True,
lstrip_blocks=True,
extensions=[
'jinja2.ext.with_',
'jinja2.ext.loopcontrols'
]
)
template = env.from_string(content)
return template.render(**context)