archive
/
md-pdf
Archived
1
Fork 0
This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
md-pdf/md_pdf/build/jinja.py

16 lines
358 B
Python
Raw Normal View History

2017-06-08 09:48:18 +01:00
from jinja2 import Environment
2017-06-10 10:35:57 +01:00
def render_content(content, context):
2017-06-08 09:48:18 +01:00
env = Environment(
2017-06-08 10:25:23 +01:00
autoescape=True,
2017-06-08 09:48:18 +01:00
trim_blocks=True,
lstrip_blocks=True,
extensions=[
'jinja2.ext.with_',
'jinja2.ext.loopcontrols'
]
)
template = env.from_string(content)
return template.render(**context)