Skip to content

Commit becf92c

Browse files
committed
Add Jinja Set (variable) snippet
1 parent 8ef1019 commit becf92c

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
See below for details of all version changes and upgrades.
44

5+
## [v1.3]
6+
7+
- Added Jinja `set` snippet as per [issue #6](https://github.com/EndlessTrax/python-template-snippets/issues/6)
8+
59
## [v1.2]
610

711
- 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.
1923

2024
---
2125

22-
### Happy coding!
26+
### Happy coding!

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This VS Code snippet extension includes snippets for both the Jinja2 and Django template engines.
44

5-
Quickly add snippets to HTML template files in your project.
5+
Quickly add snippets to HTML template files in your project.
66

77
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).
88

@@ -52,6 +52,7 @@ Prefix | Output
5252
ptj-url | {{ url_for('static', filename=' `*` ') }}
5353
ptj-mac | {% macro `*` %} {% endmacro %}
5454
ptj-com | {# `*` #}
55+
ptj-set | {% set `*` = `*2` %}
5556

5657
### Django Specific Snippets
5758

@@ -68,7 +69,7 @@ See the [Changelog](https://github.com/EndlessTrax/python-template-snippets/blob
6869

6970
---
7071

71-
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).
72+
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).
7273

7374
If you'd like to sponsor the developwment of this extension, please consider [sponsoring me on GitHub](https://github.com/sponsors/EndlessTrax)
7475

snippets/jinja-snippets.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,13 @@
2626
"{# $0 #}"
2727
],
2828
"description": "Adds Jinja comment"
29+
},
30+
"Jinja - Set Variable": {
31+
"scope": "html",
32+
"prefix": "ptj-set",
33+
"body": [
34+
"{% set $1 = $2 %}"
35+
],
36+
"description": "Adds Jinja set variable"
2937
}
3038
}

0 commit comments

Comments
 (0)