mirror of
https://github.com/pantor/inja.git
synced 2026-02-17 09:03:58 +00:00
add jinja python test script
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -41,4 +41,6 @@ dist
|
||||
doc/html
|
||||
doc/latex
|
||||
|
||||
__pycache__
|
||||
|
||||
examples
|
||||
|
||||
11
test/jinja.py
Normal file
11
test/jinja.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from jinja2 import Environment, PackageLoader, select_autoescape
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
env = Environment(
|
||||
loader=PackageLoader("jinja"),
|
||||
autoescape=select_autoescape()
|
||||
)
|
||||
|
||||
template = env.get_template("example.txt")
|
||||
print(template.render(name="Jeff"))
|
||||
1
test/templates/example.txt
Normal file
1
test/templates/example.txt
Normal file
@@ -0,0 +1 @@
|
||||
Hello {{- name -}} !
|
||||
Reference in New Issue
Block a user