-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9fe218c
Showing
7 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
```shell | ||
poetry install | ||
poetry run python -m template_in_filename | ||
``` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[tool.poetry] | ||
name = "template-in-filename" | ||
version = "0.1.0" | ||
description = "" | ||
authors = ["Raphael Krupinski <[email protected]>"] | ||
readme = "README.md" | ||
packages = [{include = "template_in_filename"}] | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.10" | ||
jinja2 = "^3.1.2" | ||
|
||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import os | ||
|
||
from jinja2 import Environment, loaders | ||
|
||
print(os.path.dirname(os.path.realpath(__file__))) | ||
environment = Environment( | ||
loader=loaders.FileSystemLoader(os.path.dirname(os.path.realpath(__file__))+"/templates"), | ||
) | ||
|
||
environment.get_template('{% if True %}a{%endif%}.txt.jinja').render(var=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{%- macro print_hello() %} | ||
hello | ||
{%- endmacro -%} |
1 change: 1 addition & 0 deletions
1
template_in_filename/templates/{% if True %}a{%endif%}.txt.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{% from "incl.txt.jinja" import print_helo %} |
Empty file.