From becf92c39db3f2095cfdadbae3d62c9e2478230f Mon Sep 17 00:00:00 2001 From: Ricky White Date: Tue, 11 Jul 2023 21:05:14 -0400 Subject: [PATCH 1/2] Add Jinja Set (variable) snippet --- CHANGELOG.md | 6 +++++- README.md | 5 +++-- snippets/jinja-snippets.json | 8 ++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9d3210..19f4cd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ See below for details of all version changes and upgrades. +## [v1.3] + +- Added Jinja `set` snippet as per [issue #6](https://github.com/EndlessTrax/python-template-snippets/issues/6) + ## [v1.2] - Added Jinja comment snippet as per [issue #4](https://github.com/EndlessTrax/python-template-snippets/issues/4) @@ -19,4 +23,4 @@ See below for details of all version changes and upgrades. --- -### Happy coding! \ No newline at end of file +### Happy coding! diff --git a/README.md b/README.md index 302d2ee..339fdca 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This VS Code snippet extension includes snippets for both the Jinja2 and Django template engines. -Quickly add snippets to HTML template files in your project. +Quickly add snippets to HTML template files in your project. If there is a snippet that is not included in this extension, please open an issue on the [repo here](https://github.com/EndlessTrax/python-template-snippets). @@ -52,6 +52,7 @@ Prefix | Output ptj-url | {{ url_for('static', filename=' `*` ') }} ptj-mac | {% macro `*` %} {% endmacro %} ptj-com | {# `*` #} +ptj-set | {% set `*` = `*2` %} ### Django Specific Snippets @@ -68,7 +69,7 @@ See the [Changelog](https://github.com/EndlessTrax/python-template-snippets/blob --- -This snippet was authored by [Ricky White](https://twitter.com/endlesstrax), and is an open-source extension. Please help to improve this by [submitting issues here](https://github.com/EndlessTrax/python-template-snippets/issues). +This snippet was authored by [Ricky White](https://twitter.com/endlesstrax), and is an open-source extension. Please help to improve this by [submitting issues here](https://github.com/EndlessTrax/python-template-snippets/issues). If you'd like to sponsor the developwment of this extension, please consider [sponsoring me on GitHub](https://github.com/sponsors/EndlessTrax) diff --git a/snippets/jinja-snippets.json b/snippets/jinja-snippets.json index dd3135e..8204c5a 100644 --- a/snippets/jinja-snippets.json +++ b/snippets/jinja-snippets.json @@ -26,5 +26,13 @@ "{# $0 #}" ], "description": "Adds Jinja comment" + }, + "Jinja - Set Variable": { + "scope": "html", + "prefix": "ptj-set", + "body": [ + "{% set $1 = $2 %}" + ], + "description": "Adds Jinja set variable" } } \ No newline at end of file From ac17fa7d7d697ea0216e8a8eb8b0e53d6906577d Mon Sep 17 00:00:00 2001 From: Ricky White Date: Tue, 11 Jul 2023 21:05:59 -0400 Subject: [PATCH 2/2] Version Bump to v1.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9e8f881..f34d49e 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "Flask", "Web Development" ], - "version": "1.2.0", + "version": "1.3.0", "publisher": "RickyWhite", "engines": { "vscode": "^1.28.0"