Skip to content

Commit 330bb2d

Browse files
authored
Move cookiecutter filters to a Jinja2 extension (#143)
Move cookiecutter filters to a Jinja2 extension By using a full fledged Jinja2 extension we can not only add filters but also variables. This also simplifies the `cookiecutter.json` file, as we don't need to enumerate every single filter we want to use. This also simplifies the template update process as when new fitlers are added there is no need to update the cookiecutter replay file, also minimizing chances of weird erros when that happens. Also make sure we don't override existing filters, so we need to rename `title` as it was overriding the `title` built-in filter.
2 parents 9a7bbe9 + a8ecc55 commit 330bb2d

File tree

3 files changed

+261
-233
lines changed

3 files changed

+261
-233
lines changed

cookiecutter/cookiecutter.json

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
],
1010
"name": null,
1111
"description": null,
12-
"title": "{{cookiecutter | title}}",
12+
"title": "{{cookiecutter | proj_title}}",
1313
"keywords": "(comma separated: 'frequenz', <type> and <name> are included automatically)",
1414
"github_org": "frequenz-floss",
1515
"license": [
@@ -23,14 +23,6 @@
2323
"github_repo_name": "{{cookiecutter | github_repo_name}}",
2424
"default_codeowners": "(like @some-org/some-team; defaults to a team based on the repo type)",
2525
"_extensions": [
26-
"local_extensions.as_identifier",
27-
"local_extensions.default_codeowners",
28-
"local_extensions.github_repo_name",
29-
"local_extensions.introduction",
30-
"local_extensions.keywords",
31-
"local_extensions.pypi_package_name",
32-
"local_extensions.python_package",
33-
"local_extensions.src_path",
34-
"local_extensions.title"
26+
"local_extensions.RepoConfigExtension"
3527
]
3628
}

0 commit comments

Comments
 (0)