-
Notifications
You must be signed in to change notification settings - Fork 1
/
Django CSS.sublime-syntax
124 lines (110 loc) · 3.51 KB
/
Django CSS.sublime-syntax
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: Django CSS
file_extensions: [css, css.djt, dj.css, djcss]
scope: text.django
contexts:
main:
- match: ""
push: "Packages/CSS/CSS.sublime-syntax"
with_prototype:
- match: "{#(?=.*#})"
scope: punctuation.definition.comment.django
push:
- clear_scopes: true
- meta_scope: text.django comment.line.django
- include: commentline
- match: "{%\\s*comment\\s*(\"[^\"]*\"\\s*)?%}"
scope: punctuation.definition.comment.django
push:
- clear_scopes: true
- meta_scope: text.django comment.block.django
- include: commentblock
- match: "{%\\s*(?=.*%})"
scope: punctuation.section.block.begin constant.character.escape.django
push:
- clear_scopes: true
- meta_scope: text.django meta.function-call.django
- include: tagname
- match: "{{(?=.*}})"
scope: punctuation.section.block.begin constant.character.escape.django
push:
- clear_scopes: true
- meta_scope: text.django meta.block
- include: expr
tagname:
- match: "%}"
scope: punctuation.section.block.end constant.character.escape.django
pop: true
- match: "\\w+\\b"
scope: variable.function.tag.django
push: tagexpr
with_prototype:
- match: "\\bin\\b"
scope: keyword.control.flow.for.in.django
- match: "with\\b"
scope: variable.function.tag.django
push: withclause
- match: "(?=%})"
pop: true
withclause:
- match: "\\w+\\b"
scope: variable.parameter.django
push: tagexpr
with_prototype:
- match: "(?=%})"
pop: true
- match: "(?=%})"
pop: true
tagexpr:
- match: "="
scope: keyword.operator.assignment.django
- match: "'"
scope: punctuation.definition.string.begin.django
push: singlestring
- match: '"'
scope: punctuation.definition.string.begin.django
push: doublestring
- match: "\\w+"
scope: meta.generic-name.django
singlestring:
- meta_scope: string.quoted.single.django
- match: \'
scope: punctuation.definition.string.end.django
pop: true
doublestring:
- meta_scope: string.quoted.double.django
- match: \"
scope: punctuation.definition.string.end.django
pop: true
expr:
- match: "'"
scope: punctuation.definition.string.begin.django
push: singlestring
- match: '"'
scope: punctuation.definition.string.begin.django
push: doublestring
- match: "\\|"
push: exprfilter
- match: "\\w+"
scope: meta.generic-name.django
- match: "}}"
scope: punctuation.section.block.end constant.character.escape.django
pop: true
exprfilter:
- meta_content_scope: variable.function.filter.django
# End the filter expression when we encounter anything that can't be part of the filter name,
# typically a space, a colon (e.g. {{var|filter:arg}}), or the closing }}.
# We use a look-ahead so that we don't swallow the curly bracket, as if we do then the `expr`
# context won't be able to match "}}".
- match: "(?=[^\\w])"
pop: true
commentline:
- match: "#}"
scope: punctuation.definition.comment.django
pop: true
commentblock:
- match: "{%\\s*endcomment\\s*%}"
scope: punctuation.definition.comment.django
pop: true