forked from naltatis/jade-syntax-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.jade
354 lines (347 loc) · 11 KB
/
index.jade
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
doctype 5
html
head
title Jade Template Syntax Documentation by Example
link(href="assets/global.min.css", rel="stylesheet", type="text/css")
meta(name="description", content="An interative Syntax Documentation for the Jade Templating Engine")
link(rel="author", href="https://plus.google.com/u/0/113306279128990179378")
script.
WebFontConfig = {
google: { families: [ 'Droid+Sans+Mono::latin', 'Ubuntu:400,700:latin' ] }
};
(function() {
var wf = document.createElement('script');
wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
'://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
wf.type = 'text/javascript';
wf.async = 'true';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(wf, s);
})();
body(data-spy="scroll", data-target=".subnav", data-offset="150")
a(href="https://github.com/naltatis/jade-syntax-docs")
img(style="position: absolute; top: 0; right: 0; border: 0;", src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png", alt="Fork me on GitHub")
.container
header.jumbotron.subhead
h1
| Jade Syntax Documentation
small by example
p.lead
| This <strong>interactive</strong> documentation illustrates the most important features of the Jade templating language.<br>
| You can play around with the examples and watch the html output in real time.<br>
| For more detailed explanations visit the
a(href="http://jade-lang.com/reference/") official documentation.
.subnav
ul.nav.nav-pills
li: a(href="#basics") Basics
li: a(href="#id-classes") id, classes
li: a(href="#nesting") Nesting
li: a(href="#text") Text
li: a(href="#variables") Variables
li: a(href="#escaping") Escaping
li: a(href="#attributes") Attributes
li: a(href="#comments") Comments
li: a(href="#if") if, unless
li: a(href="#for") for, each
li: a(href="#case") case
li: a(href="#mixin") mixin
li: a(href="#about") about
section#basics
.page-header
h2 Basics
.row
.span6
.jadeLabel
textarea.size7.jade.
doctype html
html
head
title my jade template
body
h1 Hello \#{name}
textarea.size1.json.
{"name": "Bob"}
.dataLabel
.span6.right
.htmlLabel
textarea.size9.html(readonly=true)
section#id-classes
.page-header
h2 id & classes
.row
.span6
textarea.size5.jade.
#content
.block
input#bar.foo1.foo2
.span6.right
textarea.size5.html(readonly=true)
section#nesting
.page-header
h2 Nesting
.row
.span6
textarea.size5.jade.
ul#books
li
a(href="#book-a") Book A
li
a(href="#book-b") Book B
.span6.right
textarea.size5.html(readonly=true)
hr
.row
.span6
textarea.size4.jade.
ul#books
li: a(href="#book-a") Book A
li: a(href="#book-b") Book B
.span6.right
textarea.size4.html(readonly=true)
section#text
.page-header
h2 Text
.row
.span6
textarea.size3.jade.
h1 foo
h2= book.name
h3 "\#{book.name}" for \#{book.price} €
textarea.size1.json.
{"book": {"name": "Hello", "price": 12.99}}
.span6.right
textarea.size5.html(readonly=true)
hr
.row
.span6
textarea.size4.jade.
p
| foo bar
| hello world
.span6.right
textarea.size4.html(readonly=true)
hr
.row
.span6
textarea.size4.jade.
p.
foo bar
hello world
.span6.right
textarea.size4.html(readonly=true)
section#variables
.page-header
h2 Variables
.row
.span6
textarea.size2.jade.
- var foo = "hello world"
h1= foo
.span6.right
textarea.size2.html(readonly=true)
hr
.row
.span6
textarea.size2.jade.
- var foo = book.name + " world"
h1= foo
textarea.size1.json.
{"book": {"name": "hello"}}
.span6.right
textarea.size4.html(readonly=true)
section#escaping
.page-header
h2 Escaping
.row
.span6
textarea.size1.jade.
li Hello <em>World</em>
.span6.right
textarea.size1.html(readonly=true)
hr
.row
.span6
textarea.size2.jade.
li= name
li!= name
textarea.size1.json.
{"name": "Hello <em>World</em>"}
.span6.right
textarea.size4.html(readonly=true)
hr
.row
.span6
textarea.size2.jade.
li Say \#{name}
li Say !{name}
textarea.size1.json.
{"name": "Hello <em>World</em>"}
.span6.right
textarea.size4.html(readonly=true)
section#attributes
.page-header
h2 Attributes
.row
.span6
textarea.size1.jade.
input(type="text", placeholder="your name")
.span6.right
textarea.size1.html(readonly=true)
hr
.row
.span6
textarea.size1.jade.
input(type=type, value='Hello \#{name}')
textarea.size1.json.
{"type": "text", "name": "Bob"}
.span6.right
textarea.size3.html(readonly=true)
hr
.row
.span6
textarea.size1.jade.
input(checked=true, disabled=false)
.span6.right
textarea.size1.html(readonly=true)
section#comments
.page-header
h2 Comments
.row
.span6
textarea.size2.jade.
// single line comment
//- invisible single line comment
.span6.right
textarea.size2.html(readonly=true)
hr
.row
.span6
textarea.size4.jade.
// block comment
h1 hello world
//- invisible block comment
h2 how are you?
.span6.right
textarea.size4.html(readonly=true)
hr
.row
.span6
textarea.size3.jade.
<!--[if IE 8]>
script(src='/ie.js')
<![endif]-->
.span6.right
textarea.size2.html(readonly=true)
section#if
.page-header
h2 if & unless
.row
.span6
textarea.size4.jade.
if name == "Bob"
h1 Hello Bob
else
h1 My name is \#{name}
textarea.size1.json.
{"name": "Bob"}
.span6.right
textarea.size6.html(readonly=true)
hr
.row
.span6
textarea.size2.jade.
unless errors
p no errors
textarea.size1.json.
{"errors": false}
.span6.right
textarea.size4.html(readonly=true)
section#for
.page-header
h2 for & each
.row
.span6
textarea.size3.jade.
select
each book, i in books
option(value=i) Book \#{book}
textarea.size1.json.
{"books": ["A", "B", "C"]}
.span6.right
textarea.size5.html(readonly=true)
hr
.row
.span6
textarea.size5.jade.
ul
for book in books
li= book
else
li sorry, no books!
textarea.size1.json.
{"books": []}
.span6.right
textarea.size7.html(readonly=true)
section#case
.page-header
h2 case
.row
.span6
textarea.size7.jade.
case name
when "Bob"
p Hi Bob!
when "Alice"
p Howdy Alice!
default
p Hello \#{name}!
textarea.size1.json.
{"name": "Bob"}
.span6.right
textarea.size9.html(readonly=true)
section#mixin
.page-header
h2 mixin
.row
.span6
textarea.size6.jade.
mixin book(name, price)
li \#{name} for \#{price} €
ul#books
+book("Book A", 12.99)
+book("Book B", 5.99)
.span6.right
textarea.size6.html(readonly=true)
hr
.row
.span6
textarea.size6.jade.
mixin book(name)
div&attributes(attributes)= name
+book("Book A")#first
+book("Book B")(title="book b")
+book("Book C").last
.span6.right
textarea.size6.html(readonly=true)
footer#about
p
| by <strong>naltatis</strong>
p
| follow me on
a(href="https://github.com/naltatis", title="naltatis on github") github
| and
a(href="https://twitter.com/naltatis", title="naltatis on twitter") twitter
p
a.FlattrButton
<script id='fb7pp5j'>(function(i){var f,s=document.getElementById(i);f=document.createElement('iframe');f.src='//api.flattr.com/button/view/?uid=tatilans&button=compact&url=https%3A%2F%2Fgithub.com%2Fnaltatis%2Fjade-syntax-docs';f.title='Flattr';f.height=20;f.width=110;f.style.borderWidth=0;s.parentNode.insertBefore(f,s);})('fb7pp5j');</script>
//-(rev="flattr;button:compact", href="https://github.com/naltatis/jade-syntax-docs", lang="de", title="interactive Jade Syntax Documentation");
script(src="assets/global.min.js", async)
script(type="text/javascript")
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-33399084-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();