Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0153a5a

Browse files
author
Christian Strappazzon
committed
Added abbreviations list
Bump version
1 parent 5d333cd commit 0153a5a

File tree

6 files changed

+96
-40
lines changed

6 files changed

+96
-40
lines changed

‎CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Change Log
22
All notable changes to the "flask-snippets" extension will be documented in this file.
33

4+
## [0.0.4]
5+
- Added abbreviations list with description
6+
47
## [0.0.3]
58
- [flask-snippets](https://github.com/jleonra/flask-snippets) ported from Atom
69
- Splitting snippets into category files

‎README.md

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,69 @@
11
# Flask snippets
22

3-
Flask snippets collections, ported from PyCharm, TextMate, SublimeText and other editors/IDEs.
3+
Flask snippets collections.
4+
Initially ported from PyCharm, TextMate, SublimeText and other editors/IDEs.
5+
6+
If you'd like to contribute, feel free to [submit a pull request on github](https://github.com/cstrap/flask-snippets)
7+
8+
Thanks!
49

510
## Features
611

7-
Snippets for Flask framework
12+
### Base snippets
13+
14+
| Abbreviation | Description |
15+
|--------------|----------------------------|
16+
| hw | Flask hello world |
17+
| route | Flask route |
18+
| routegp | Flask route with GET, POST |
19+
| routegp | Flask route POST only |
20+
21+
### Controls snippets
22+
23+
| Abbreviation | Description |
24+
|--------------|-----------------|
25+
| """ | ML docstring |
26+
| "" | SL docstring |
27+
| fapp | Flask App |
28+
| froute | Flask route |
29+
| furl | URL generator |
30+
| fmeth | URL methods |
31+
| frt | Render template |
32+
| ftreq | Test request |
33+
| fup | Flask upload |
34+
| fsup | Secure upload |
35+
| frc | Read cookie |
36+
| fsc | Set cookie |
37+
| feh | Error handler |
38+
| flog | Flask logging |
39+
40+
### Templates snippets
841

9-
Public repo on [GitHub](https://github.com/cstrap/flask-snippets), feel free to contribute! :-)
42+
| Abbreviation | Description |
43+
|--------------|--------------------|
44+
| fexp | Flask expresion |
45+
| ffilter | Flask filter |
46+
| fcomment | Flask comment |
47+
| fblock | Flask block |
48+
| fextends | Flask extends |
49+
| fself | Flask self |
50+
| fsuper | Flask super |
51+
| ffor | Flask for |
52+
| fif | Flask if |
53+
| fife | Flask ife |
54+
| felif | Flask elif |
55+
| fmacro | Flask macro |
56+
| ffb | Flask filter block |
57+
| fset | Flask set |
58+
| finclude | Flask include |
59+
| fimport | Flask import |
60+
| fautoescape | Flask autoescape |
61+
| furl | Flask url |
1062

1163
## Release Notes
1264

13-
## [0.0.3]
65+
## [0.0.4]
1466

15-
- [flask-snippets](https://github.com/jleonra/flask-snippets) ported from Atom
16-
- Splitting snippets into category files
67+
- Added abbreviations list with description on README file
1768

1869
See [changelog](CHANGELOG.md) for all changes and releases.

‎package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "flask-snippets",
33
"displayName": "flask-snippets",
44
"description": "Flask snippets",
5-
"version": "0.0.3",
5+
"version": "0.0.4",
66
"publisher": "cstrap",
77
"icon": "images/flask.png",
88
"engines": {
@@ -11,6 +11,11 @@
1111
"categories": [
1212
"Snippets"
1313
],
14+
"keywords": [
15+
"snippets",
16+
"flask",
17+
"python"
18+
],
1419
"repository": {
1520
"type": "git",
1621
"url": "https://github.com/cstrap/flask-snippets.git"

‎snippets/base.json

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"Hello world": {
2+
"Flask hello world": {
33
"prefix": "hw",
44
"body": [
55
"from flask import Flask",
@@ -19,25 +19,22 @@
1919
"@app.route('/${1:route_name}')",
2020
"def ${2:method_name}():",
2121
" pass0ドル"
22-
],
23-
"description": "Flask route function"
22+
]
2423
},
25-
"Flask route GET, POST": {
24+
"Flask route with GET, POST": {
2625
"prefix": "routegp",
2726
"body": [
2827
"@app.route('/${1:route_name}', methods=['GET', 'POST'])",
2928
"def ${2:method_name}():",
3029
" pass0ドル"
31-
],
32-
"description": "Flask route with GET and POST"
30+
]
3331
},
3432
"Flask route POST only": {
3533
"prefix": "routegp",
3634
"body": [
3735
"@app.route('/${1:route_name}', methods=['POST'])",
3836
"def ${2:method_name}():",
3937
" pass0ドル"
40-
],
41-
"description": "Flask route POST only"
38+
]
4239
}
4340
}

‎snippets/controls.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,31 @@
1111
"prefix": "fapp",
1212
"body": "from flask import Flask, render_template\napp = Flask(__name__)\n\n\n@app.route('${1:/}')\ndef ${2:index}():\n return render_template('${3:index}.html')\n\nif __name__ == '__main__':\n app.run(host:'${4:127.0.0.1}', port=${5:8000}, debug=${6:True})\n0ドル 0ドル"
1313
},
14-
"Flask Route": {
14+
"Flask route": {
1515
"prefix": "froute",
1616
"body": "@app.route('${1:path}')\ndef ${2:func_name}(${3:foo}):\n return render_template('${4:expression}')0ドル"
1717
},
18-
"URL Generator": {
18+
"URL generator": {
1919
"prefix": "furl",
2020
"body": "url_for('${1:foo}'2ドル)0ドル"
2121
},
22-
"URL Methods": {
22+
"URL methods": {
2323
"prefix": "fmeth",
2424
"body": "methods=['GET', 'POST']0ドル"
2525
},
26-
"Render Template": {
26+
"Render template": {
2727
"prefix": "frt",
2828
"body": "render_template('${1:page}.html', ${2:foo}=${3:bar})0ドル"
2929
},
30-
"Test Request": {
30+
"Test request": {
3131
"prefix": "ftreq",
3232
"body": "with app.test_request_context('${1:path}', method='${2:POST}'):\n\t\tassert request.path == '${1:path}'\n\t\tassert.method == '${2:POST}'\n0ドル"
3333
},
34-
"Flask Upload": {
34+
"Flask upload": {
3535
"prefix": "fup",
3636
"body": "@app.route('${1:/upload}', methods=['GET', 'POST'])\ndef ${2:upload_file}():\n if request.method == 'POST':\n ${3:f} = request.files['${4:the_file}']\n ${3:f}.save('${6:/path/to/save/}${4:the_file}.${5:txt}')\n0ドル"
3737
},
38-
"Secure Upload": {
38+
"Secure upload": {
3939
"prefix": "fsup",
4040
"body": "from werkzeug.utils import secure_filename\n\n@app.route('${1:/upload}', methods=['GET', 'POST'])\ndef ${2:upload_file}():\n if request.method == 'POST':\n ${3:f} = request.files['${4:the_file}']\n ${3:f}.save('${5:/path/to/save/}' + secure_filename(${3:f}.filename))0ドル"
4141
},
@@ -47,7 +47,7 @@
4747
"prefix": "fsc",
4848
"body": "${1:foo} = make_response(${2:expression})\n${1:foo}.set_cookie('${3:key}', '${4:value}')\nreturn ${1:foo}\n0ドル"
4949
},
50-
"Error Handler": {
50+
"Error handler": {
5151
"prefix": "feh",
5252
"body": "@app.errorhandler(${1:404})\ndef ${2:bar}(error):\n\t\treturn render_template('${3:error.html}'), ${1:404}\n0ドル"
5353
},

‎snippets/templates.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,69 @@
11
{
2-
"Flask Expresion": {
2+
"Flask expresion": {
33
"prefix": "fexp",
44
"body": "{{ ${1:foo.bar} }}0ドル"
55
},
6-
"Flask Filter": {
6+
"Flask filter": {
77
"prefix": "ffilter",
88
"body": "{{ ${1:foo.bar}|${2:filter} }}0ドル"
99
},
10-
"Flask Comment": {
10+
"Flask comment": {
1111
"prefix": "fcomment",
1212
"body": "{# \n\t${1:comment} \n#}0ドル"
1313
},
14-
"Flask Block": {
14+
"Flask block": {
1515
"prefix": "fblock",
1616
"body": "{% ${1:block} ${2:foo} %}3ドル{% end${1:block} %}\n0ドル"
1717
},
18-
"Flask Extends": {
18+
"Flask extends": {
1919
"prefix": "fextends",
2020
"body": "{% extends ${1:layout_template} %}\n\n0ドル"
2121
},
22-
"Flask Self": {
22+
"Flask self": {
2323
"prefix": "fself",
2424
"body": "{{ self.${1:block_name}() }}0ドル"
2525
},
26-
"Flask Super": {
26+
"Flask super": {
2727
"prefix": "fsuper",
2828
"body": "{{ self.supper() }}0ドル"
2929
},
30-
"Flask For": {
30+
"Flask for": {
3131
"prefix": "ffor",
3232
"body": "{% for ${1:element} in ${2:collection} %}\n\t\t3ドル{{ ${1:element}|e }}4ドル\n{% endfor %}\n0ドル"
3333
},
34-
"Flask If": {
34+
"Flask if": {
3535
"prefix": "fif",
3636
"body": "{% if ${1:expression} %}\n\t\t${2:blockofcode}\n{% endif %}\n0ドル"
3737
},
38-
"Flask Ife": {
38+
"Flask ife": {
3939
"prefix": "fife",
4040
"body": "{% if ${1:expression} %}\n\t\t${2:blockofcode}\n{% else %}\n\t\t${3:blockofcode}\n{% endif %}\n0ドル"
4141
},
42-
"Flask Elif": {
42+
"Flask elif": {
4343
"prefix": "felif",
4444
"body": "{% if ${1:expression} %}\n\t\t${2:blockofcode}\n{% elif ${3:expression2} %}\n\t\t${4:blockofcode}\n{% else %}\n\t\t${5:blockofcode}\n{% endif %}\n0ドル"
4545
},
46-
"Flask Macro": {
46+
"Flask macro": {
4747
"prefix": "fmacro",
4848
"body": "{% macro ${1:expression} -%}\n\t\t${2:blockofcode}\n{%- endmacro %}0ドル"
4949
},
50-
"Flask Filter Block": {
50+
"Flask filter block": {
5151
"prefix": "ffb",
5252
"body": "{% filter ${1:foo} %}\n\t\t${2:blockofcode}\n{% endfilter %}0ドル"
5353
},
54-
"Flask Set": {
54+
"Flask set": {
5555
"prefix": "fset",
5656
"body": "{% set ${1:expression} %}0ドル"
5757
},
58-
"Flask Include": {
58+
"Flask include": {
5959
"prefix": "finclude",
6060
"body": "{% include \"${1:template}\" %}0ドル"
6161
},
62-
"Flask Import": {
62+
"Flask import": {
6363
"prefix": "fimport",
6464
"body": "{% import \"${1:template}\" as ${2:alias} %}\n0ドル"
6565
},
66-
"Flask Autoescape": {
66+
"Flask autoescape": {
6767
"prefix": "fautoescape",
6868
"body": "{% autoescape ${1:true} %}\n\t\t${2:blockofcode}\n{% endautoescape %}\n0ドル"
6969
},

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /