-
Notifications
You must be signed in to change notification settings - Fork 16
/
jade.language.txt
141 lines (117 loc) · 7.78 KB
/
jade.language.txt
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
JADE
jade [DIR|FILE...] #Transcompile to HTML.
#Version 1.9.2
#Def. is stdin + stdout, otherwise rename *.jade to *.html, in same DIR or --out DIR
#There are also options to compile/render runtime, but it is better to do compile time.
#For locals rendering runtime, prefer Handlebars.
--obj JSON_FILE|STR #Specifies options (same as Node.js ones) as JSON
--pretty #Adds spaces for pretty priting (otherwise condensed)
--watch #Watch mode
--extension EXT #Instead of html
JADE #Node.js. Same version.
JADE.compile[File] #Returns FUNC(OBJ2)->STR2, where STR2 is final HTML output and OBJ2 JavaScript locals.
([PATH_]STR[, OBJ]) #OBJ:
# - filename|doctype|pretty: like --path|doctype|pretty
# - cache BOOL: if true (def: false), cache according to filename
# - self BOOL: if true (def: false), locals are available in Jade on object self.*,
# - globals STR_ARR: if self false, current environment can be used in Jade. Otherwise,
# must specify here.
JAD.render[File]([PATH_]STR[,OBJ])#Same but returns STR2 directly.
/=+===============================+=\
/ : : \
)==: SYNTAX :==(
\ :_______________________________: /
\=+===============================+=/
EXPR #Means JavaScript expression
: ...
#[...] #Can be used instead of newline, except in few cases.
TAG #<TAG>
TAG2 # <TAG2></TAG2>
#</TAG>
TAG/ #<TAG/> (usually automatically does it)
| ...
TAG.
...
TAG ... #<TAG>...</TAG>, when ... is plain text.
TAG(ATTR[=EXPR],...) #<TAG ATTR[="VAL"]>
TAG( #EXPR:
ATTR=EXPR # - is JavaScript, converted to STR|BOOL.
... # - EXPR.toString() is HTML escaped unless using !=EXPR instead of =EXPR
) # - can be:
# - OBJ for ATTR style
# - STR_ARR or BOOL_OBJ for ATTR class
[TAG].CLASS #<TAG class="CLASS"> (def TAG: div)
[TAG]#ID #<TAG id="ID"> (def TAG: div)
TAG&attributes(OBJ) #<TAG OBJ.VAR="OBJ.VAL" ...>. Does not HTML escape.
- EXPR #Interpolate JavaScript to nothing (only compile-time evaluation).
#{EXPR} #Interpolate JavaScript to Jade, escaping HTML.
!{EXPR} #Same but not escaping HTML.
= EXPR #Interpolate JavaScript to HTML plain text, escaping HTML. Must be full line.
!= EXPR #Same but not escaping HTML.
// RUNTIME COMMENT
//
COMMENT
MULTILINE
//- COMPILE-TIME COMMENT
if|unless BOOL_EXPR
...
[else if|unless BOOL_EXPR2
...]
[else
...] #
case VAR
when VAL
[when VAL2]...
...
...
default
... #
each VAR[, INDEX] in ARR|OBJ_EXPR
... #Repeats ... ARR.length times, changing VAR value (can be used as EXPR only)
while BOOL_EXPR
... #Repeats ...
doctype html #<!DOCTYPE html>. Can also use --doctype STR (uses it to compile, but does not output it)
doctype xml|transitional|strict|
frameset|1.1|basic|mobile #Others
:FILTER #Modifies ..., among (builtins):
... # - markdown: transcompile to HTML. Only works with "- EXPR"
# - coffee: transcompile to JavaScript
#Can add new ones with JADE.filters.FILTER = FUNC(STR)->STR2
PATH #Has no quotes aroung it and input must not be from stdin, unless using --path PATH
include PATH[:FILTER] #Include another file.
block [append|prepend] BLOCK #A first file ("layout") defines BLOCK.
... #Another one reuse it with:
# extends PATH
#but replace/append/prepend ... with another BLOCK ... using same syntax.
#The other file can also contain block redefinitions.
#It can be used as a layout itself, creating a chain.
mixin MIXIN[(VAR,...)]
... #Declares.
+MIXIN[(VAL,...)][(ATTR[=EXPR])] #Uses: replaces by declaration ..., which can also use:
...2 # - block: replaced by ...2. Can use test "if block"
# - attributes OBJ: according to ATTR[=EXPR]
#VAR can only be used as EXPR
/=+===============================+=\
/ : : \
)==: TOOLS :==(
\ :_______________________________: /
\=+===============================+=/
GULP-JADE([OBJ]) #OBJ: same as JADE, plus:
# - locals OBJ2: but compatible with GULP-DATA too
# - jade JADE: when defining own filters
#Version 0.11.0
html2jade [FILE...] #If one FILE or stdin, outputs to stdout, otherwise create *.jade
#Good for migration.
#Version 0.8.2
--output DIR #
--tabs
--nspaces NUM #Identation (def: 2)
--donotencode #No HTML encode. Useful if contains Handlebars
--double #Use double-quotes for ATTR values
--bodyless #Do not create body or html
HTML2JADE.convertHtml
(STR[, OBJ], FUNC(ERROR, STR2))
HTML2JADE.convertDocument
(FILE[, OBJ], FUNC(ERROR, STR2))