mustache 0.99.4 → 0.99.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +3 -9
- data/lib/mustache.rb +3 -3
- data/lib/mustache/generator.rb +5 -5
- data/lib/mustache/parser.rb +9 -5
- data/lib/mustache/sinatra.rb +23 -4
- data/lib/mustache/version.rb +1 -1
- data/man/mustache.1 +25 -40
- data/man/mustache.1.html +86 -77
- data/man/mustache.1.ron +1 -1
- data/man/mustache.5 +44 -81
- data/man/mustache.5.html +87 -80
- data/man/mustache.5.ron +1 -1
- data/test/parser_test.rb +9 -4
- metadata +23 -47
data/man/mustache.1.ron
CHANGED
data/man/mustache.5
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
.\" generated with Ronn/v0.
|
2
|
-
.\" http://github.com/rtomayko/ronn/
|
1
|
+
.\" generated with Ronn/v0.7.3
|
2
|
+
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "MUSTACHE" "5" "
|
4
|
+
.TH "MUSTACHE" "5" "August 2011" "DEFUNKT" "Mustache Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
|
-
\fBmustache\fR
|
7
|
+
\fBmustache\fR \- Logic\-less templates\.
|
8
8
|
.
|
9
9
|
.SH "SYNOPSIS"
|
10
10
|
A typical Mustache template:
|
@@ -16,7 +16,7 @@ A typical Mustache template:
|
|
16
16
|
Hello {{name}}
|
17
17
|
You have just won {{value}} dollars!
|
18
18
|
{{#in_ca}}
|
19
|
-
Well, {{taxed_value}} dollars, after taxes
|
19
|
+
Well, {{taxed_value}} dollars, after taxes\.
|
20
20
|
{{/in_ca}}
|
21
21
|
.
|
22
22
|
.fi
|
@@ -33,7 +33,7 @@ Given the following hash:
|
|
33
33
|
{
|
34
34
|
"name": "Chris",
|
35
35
|
"value": 10000,
|
36
|
-
"taxed_value": 10000 \- (10000 * 0
|
36
|
+
"taxed_value": 10000 \- (10000 * 0\.4),
|
37
37
|
"in_ca": true
|
38
38
|
}
|
39
39
|
.
|
@@ -50,45 +50,32 @@ Will produce the following:
|
|
50
50
|
|
51
51
|
Hello Chris
|
52
52
|
You have just won 10000 dollars!
|
53
|
-
Well, 6000
|
53
|
+
Well, 6000\.0 dollars, after taxes\.
|
54
54
|
.
|
55
55
|
.fi
|
56
56
|
.
|
57
57
|
.IP "" 0
|
58
58
|
.
|
59
59
|
.SH "DESCRIPTION"
|
60
|
-
Mustache can be used for HTML, config files, source code \-
|
61
|
-
anything. It works by expanding tags in a template using values
|
62
|
-
provided in a hash or object.
|
60
|
+
Mustache can be used for HTML, config files, source code \- anything\. It works by expanding tags in a template using values provided in a hash or object\.
|
63
61
|
.
|
64
62
|
.P
|
65
|
-
We call it "logic\-less" because there are no if statements, else
|
66
|
-
clauses, or for loops. Instead there are only tags. Some tags are
|
67
|
-
replaced with a value, some nothing, and others a series of
|
68
|
-
values. This document explains the different types of Mustache tags.
|
63
|
+
We call it "logic\-less" because there are no if statements, else clauses, or for loops\. Instead there are only tags\. Some tags are replaced with a value, some nothing, and others a series of values\. This document explains the different types of Mustache tags\.
|
69
64
|
.
|
70
65
|
.SH "TAG TYPES"
|
71
|
-
Tags are indicated by the double mustaches
|
72
|
-
is \fB{{#person}}\fR. In both examples, we'd refer to \fBperson\fR as the key
|
73
|
-
or tag key. Let's talk about the different types of tags.
|
66
|
+
Tags are indicated by the double mustaches\. \fB{{person}}\fR is a tag, as is \fB{{#person}}\fR\. In both examples, we\'d refer to \fBperson\fR as the key or tag key\. Let\'s talk about the different types of tags\.
|
74
67
|
.
|
75
68
|
.SS "Variables"
|
76
|
-
The most basic tag type is the variable
|
77
|
-
template will try to find the \fBname\fR key in the current context. If
|
78
|
-
there is no \fBname\fR key, nothing will be rendered.
|
69
|
+
The most basic tag type is the variable\. A \fB{{name}}\fR tag in a basic template will try to find the \fBname\fR key in the current context\. If there is no \fBname\fR key, nothing will be rendered\.
|
79
70
|
.
|
80
71
|
.P
|
81
|
-
All variables are HTML escaped by default
|
82
|
-
unescaped HTML, use the triple mustache: \fB{{{name}}}\fR.
|
72
|
+
All variables are HTML escaped by default\. If you want to return unescaped HTML, use the triple mustache: \fB{{{name}}}\fR\.
|
83
73
|
.
|
84
74
|
.P
|
85
|
-
You can also use \fB&\fR to unescape a variable: \fB{{& name}}\fR
|
86
|
-
useful when changing delimiters (see "Set Delimiter" below).
|
75
|
+
You can also use \fB&\fR to unescape a variable: \fB{{& name}}\fR\. This may be useful when changing delimiters (see "Set Delimiter" below)\.
|
87
76
|
.
|
88
77
|
.P
|
89
|
-
By default a variable "miss" returns an empty string
|
90
|
-
be configured in your Mustache library. The Ruby version of Mustache
|
91
|
-
supports raising an exception in this situation, for instance.
|
78
|
+
By default a variable "miss" returns an empty string\. This can usually be configured in your Mustache library\. The Ruby version of Mustache supports raising an exception in this situation, for instance\.
|
92
79
|
.
|
93
80
|
.P
|
94
81
|
Template:
|
@@ -139,21 +126,19 @@ Output:
|
|
139
126
|
.IP "" 0
|
140
127
|
.
|
141
128
|
.SS "Sections"
|
142
|
-
Sections render blocks of text one or more times, depending on the
|
143
|
-
value of the key in the current context.
|
129
|
+
Sections render blocks of text one or more times, depending on the value of the key in the current context\.
|
144
130
|
.
|
145
131
|
.P
|
146
|
-
A section begins with a pound and ends with a slash
|
132
|
+
A section begins with a pound and ends with a slash\. That is, \fB{{#person}}\fR begins a "person" section while \fB{{/person}}\fR ends it\.
|
147
133
|
.
|
148
134
|
.P
|
149
|
-
The behavior of the section is determined by the value of the key
|
135
|
+
The behavior of the section is determined by the value of the key\.
|
150
136
|
.
|
151
137
|
.P
|
152
138
|
\fBFalse Values or Empty Lists\fR
|
153
139
|
.
|
154
140
|
.P
|
155
|
-
If the \fBperson\fR key exists and has a value of false or an empty
|
156
|
-
list, the HTML between the pound and slash will not be displayed.
|
141
|
+
If the \fBperson\fR key exists and has a value of false or an empty list, the HTML between the pound and slash will not be displayed\.
|
157
142
|
.
|
158
143
|
.P
|
159
144
|
Template:
|
@@ -162,7 +147,7 @@ Template:
|
|
162
147
|
.
|
163
148
|
.nf
|
164
149
|
|
165
|
-
Shown
|
150
|
+
Shown\.
|
166
151
|
{{#nothin}}
|
167
152
|
Never shown!
|
168
153
|
{{/nothin}}
|
@@ -193,7 +178,7 @@ Output:
|
|
193
178
|
.
|
194
179
|
.nf
|
195
180
|
|
196
|
-
Shown
|
181
|
+
Shown\.
|
197
182
|
.
|
198
183
|
.fi
|
199
184
|
.
|
@@ -203,14 +188,10 @@ Shown.
|
|
203
188
|
\fBNon\-Empty Lists\fR
|
204
189
|
.
|
205
190
|
.P
|
206
|
-
If the \fBperson\fR key exists and has a non\-false value, the HTML between
|
207
|
-
the pound and slash will be rendered and displayed one or more times.
|
191
|
+
If the \fBperson\fR key exists and has a non\-false value, the HTML between the pound and slash will be rendered and displayed one or more times\.
|
208
192
|
.
|
209
193
|
.P
|
210
|
-
When the value is a non\-empty list, the text in the block will be
|
211
|
-
displayed once for each item in the list. The context of the block
|
212
|
-
will be set to the current item for each iteration. In this way we can
|
213
|
-
loop over collections.
|
194
|
+
When the value is a non\-empty list, the text in the block will be displayed once for each item in the list\. The context of the block will be set to the current item for each iteration\. In this way we can loop over collections\.
|
214
195
|
.
|
215
196
|
.P
|
216
197
|
Template:
|
@@ -265,11 +246,7 @@ Output:
|
|
265
246
|
\fBLambdas\fR
|
266
247
|
.
|
267
248
|
.P
|
268
|
-
When the value is a callable object, such as a function or lambda, the
|
269
|
-
object will be invoked and passed the block of text. The text passed
|
270
|
-
is the literal block, unrendered. \fB{{tags}}\fR will not have been expanded
|
271
|
-
\- the lambda should do that on its own. In this way you can implement
|
272
|
-
filters or caching.
|
249
|
+
When the value is a callable object, such as a function or lambda, the object will be invoked and passed the block of text\. The text passed is the literal block, unrendered\. \fB{{tags}}\fR will not have been expanded \- the lambda should do that on its own\. In this way you can implement filters or caching\.
|
273
250
|
.
|
274
251
|
.P
|
275
252
|
Template:
|
@@ -279,7 +256,7 @@ Template:
|
|
279
256
|
.nf
|
280
257
|
|
281
258
|
{{#wrapped}}
|
282
|
-
{{name}} is awesome
|
259
|
+
{{name}} is awesome\.
|
283
260
|
{{/wrapped}}
|
284
261
|
.
|
285
262
|
.fi
|
@@ -313,7 +290,7 @@ Output:
|
|
313
290
|
.
|
314
291
|
.nf
|
315
292
|
|
316
|
-
<b>Willy is awesome
|
293
|
+
<b>Willy is awesome\.</b>
|
317
294
|
.
|
318
295
|
.fi
|
319
296
|
.
|
@@ -323,8 +300,7 @@ Output:
|
|
323
300
|
\fBNon\-False Values\fR
|
324
301
|
.
|
325
302
|
.P
|
326
|
-
When the value is non\-false but not a list, it will be used as the
|
327
|
-
context for a single rendering of the block.
|
303
|
+
When the value is non\-false but not a list, it will be used as the context for a single rendering of the block\.
|
328
304
|
.
|
329
305
|
.P
|
330
306
|
Template:
|
@@ -370,14 +346,10 @@ Hi Jon!
|
|
370
346
|
.IP "" 0
|
371
347
|
.
|
372
348
|
.SS "Inverted Sections"
|
373
|
-
An inverted section begins with a caret (hat) and ends with a
|
374
|
-
slash. That is \fB{{^person}}\fR begins a "person" inverted section while \fB{{/person}}\fR ends it.
|
349
|
+
An inverted section begins with a caret (hat) and ends with a slash\. That is \fB{{^person}}\fR begins a "person" inverted section while \fB{{/person}}\fR ends it\.
|
375
350
|
.
|
376
351
|
.P
|
377
|
-
While sections can be used to render text one or more times based on the
|
378
|
-
value of the key, inverted sections may render text once based
|
379
|
-
on the inverse value of the key. That is, they will be rendered
|
380
|
-
if the key doesn't exist, is false, or is an empty list.
|
352
|
+
While sections can be used to render text one or more times based on the value of the key, inverted sections may render text once based on the inverse value of the key\. That is, they will be rendered if the key doesn\'t exist, is false, or is an empty list\.
|
381
353
|
.
|
382
354
|
.P
|
383
355
|
Template:
|
@@ -426,13 +398,13 @@ No repos :(
|
|
426
398
|
.IP "" 0
|
427
399
|
.
|
428
400
|
.SS "Comments"
|
429
|
-
Comments begin with a bang and are ignored
|
401
|
+
Comments begin with a bang and are ignored\. The following template:
|
430
402
|
.
|
431
403
|
.IP "" 4
|
432
404
|
.
|
433
405
|
.nf
|
434
406
|
|
435
|
-
<h1>Today{{! ignore me }}
|
407
|
+
<h1>Today{{! ignore me }}\.</h1>
|
436
408
|
.
|
437
409
|
.fi
|
438
410
|
.
|
@@ -445,25 +417,23 @@ Will render as follows:
|
|
445
417
|
.
|
446
418
|
.nf
|
447
419
|
|
448
|
-
<h1>Today
|
420
|
+
<h1>Today\.</h1>
|
449
421
|
.
|
450
422
|
.fi
|
451
423
|
.
|
452
424
|
.IP "" 0
|
453
425
|
.
|
454
426
|
.P
|
455
|
-
Comments may contain newlines
|
427
|
+
Comments may contain newlines\.
|
456
428
|
.
|
457
429
|
.SS "Partials"
|
458
|
-
Partials begin with a greater than sign, like \fB{{> box}}\fR
|
430
|
+
Partials begin with a greater than sign, like \fB{{> box}}\fR\.
|
459
431
|
.
|
460
432
|
.P
|
461
|
-
Partials are rendered at runtime (as opposed to compile time), so
|
462
|
-
recursive partials are possible. Just avoid infinite loops.
|
433
|
+
Partials are rendered at runtime (as opposed to compile time), so recursive partials are possible\. Just avoid infinite loops\.
|
463
434
|
.
|
464
435
|
.P
|
465
|
-
They also inherit the calling context
|
466
|
-
this:
|
436
|
+
They also inherit the calling context\. Whereas in ERB you may have this:
|
467
437
|
.
|
468
438
|
.IP "" 4
|
469
439
|
.
|
@@ -489,11 +459,10 @@ Mustache requires only this:
|
|
489
459
|
.IP "" 0
|
490
460
|
.
|
491
461
|
.P
|
492
|
-
Why? Because the \fBnext_more
|
462
|
+
Why? Because the \fBnext_more\.mustache\fR file will inherit the \fBsize\fR and \fBstart\fR methods from the calling context\.
|
493
463
|
.
|
494
464
|
.P
|
495
|
-
In this way you may want to think of partials as includes, or template
|
496
|
-
expansion, even though it's not literally true.
|
465
|
+
In this way you may want to think of partials as includes, or template expansion, even though it\'s not literally true\.
|
497
466
|
.
|
498
467
|
.P
|
499
468
|
For example, this template and partial:
|
@@ -502,13 +471,13 @@ For example, this template and partial:
|
|
502
471
|
.
|
503
472
|
.nf
|
504
473
|
|
505
|
-
base
|
474
|
+
base\.mustache:
|
506
475
|
<h2>Names</h2>
|
507
476
|
{{#names}}
|
508
477
|
{{> user}}
|
509
478
|
{{/names}}
|
510
479
|
|
511
|
-
user
|
480
|
+
user\.mustache:
|
512
481
|
<strong>{{name}}</strong>
|
513
482
|
.
|
514
483
|
.fi
|
@@ -532,8 +501,7 @@ Can be thought of as a single, expanded template:
|
|
532
501
|
.IP "" 0
|
533
502
|
.
|
534
503
|
.SS "Set Delimiter"
|
535
|
-
Set Delimiter tags start with an equal sign and change the tag
|
536
|
-
delimiters from \fB{{\fR and \fB}}\fR to custom strings.
|
504
|
+
Set Delimiter tags start with an equal sign and change the tag delimiters from \fB{{\fR and \fB}}\fR to custom strings\.
|
537
505
|
.
|
538
506
|
.P
|
539
507
|
Consider the following contrived example:
|
@@ -553,18 +521,13 @@ Consider the following contrived example:
|
|
553
521
|
.IP "" 0
|
554
522
|
.
|
555
523
|
.P
|
556
|
-
Here we have a list with three items
|
557
|
-
tag style, the second uses erb style as defined by the Set Delimiter
|
558
|
-
tag, and the third returns to the default style after yet another Set
|
559
|
-
Delimiter declaration.
|
524
|
+
Here we have a list with three items\. The first item uses the default tag style, the second uses erb style as defined by the Set Delimiter tag, and the third returns to the default style after yet another Set Delimiter declaration\.
|
560
525
|
.
|
561
526
|
.P
|
562
|
-
According to \
|
563
|
-
double\-braces may occur in the text and are awkward to use for
|
564
|
-
markup."
|
527
|
+
According to ctemplates \fIhttp://google\-ctemplate\.googlecode\.com/svn/trunk/doc/howto\.html\fR, this "is useful for languages like TeX, where double\-braces may occur in the text and are awkward to use for markup\."
|
565
528
|
.
|
566
529
|
.P
|
567
|
-
Custom delimiters may not contain whitespace or the equals sign
|
530
|
+
Custom delimiters may not contain whitespace or the equals sign\.
|
568
531
|
.
|
569
532
|
.SH "COPYRIGHT"
|
570
533
|
Mustache is Copyright (C) 2009 Chris Wanstrath
|
@@ -573,4 +536,4 @@ Mustache is Copyright (C) 2009 Chris Wanstrath
|
|
573
536
|
Original CTemplate by Google
|
574
537
|
.
|
575
538
|
.SH "SEE ALSO"
|
576
|
-
mustache(1),
|
539
|
+
mustache(1), \fIhttp://mustache\.github\.com/\fR
|
data/man/mustache.5.html
CHANGED
@@ -2,70 +2,77 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<meta http-equiv='content-type' value='text/html;charset=utf8'>
|
5
|
-
<meta name='generator' value='Ronn/v0.
|
6
|
-
<title>mustache(5)
|
7
|
-
<style type='text/css'>
|
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
|
-
float:left; width:33%; list-style-type:none;
|
44
|
-
text-transform:uppercase; font-size:18px; color:#999;
|
45
|
-
letter-spacing:1px;}
|
46
|
-
#man ol.man { width:100%; }
|
47
|
-
#man ol.man li.tl { text-align:left }
|
48
|
-
#man ol.man li.tc { text-align:center;letter-spacing:4px }
|
49
|
-
#man ol.man li.tr { text-align:right }
|
50
|
-
#man ol.man a { color:#999 }
|
51
|
-
#man ol.man a:hover { color:#333231 }
|
5
|
+
<meta name='generator' value='Ronn/v0.7.3 (http://github.com/rtomayko/ronn/tree/0.7.3)'>
|
6
|
+
<title>mustache(5) - Logic-less templates.</title>
|
7
|
+
<style type='text/css' media='all'>
|
8
|
+
/* style: man */
|
9
|
+
body#manpage {margin:0}
|
10
|
+
.mp {max-width:100ex;padding:0 9ex 1ex 4ex}
|
11
|
+
.mp p,.mp pre,.mp ul,.mp ol,.mp dl {margin:0 0 20px 0}
|
12
|
+
.mp h2 {margin:10px 0 0 0}
|
13
|
+
.mp > p,.mp > pre,.mp > ul,.mp > ol,.mp > dl {margin-left:8ex}
|
14
|
+
.mp h3 {margin:0 0 0 4ex}
|
15
|
+
.mp dt {margin:0;clear:left}
|
16
|
+
.mp dt.flush {float:left;width:8ex}
|
17
|
+
.mp dd {margin:0 0 0 9ex}
|
18
|
+
.mp h1,.mp h2,.mp h3,.mp h4 {clear:left}
|
19
|
+
.mp pre {margin-bottom:20px}
|
20
|
+
.mp pre+h2,.mp pre+h3 {margin-top:22px}
|
21
|
+
.mp h2+pre,.mp h3+pre {margin-top:5px}
|
22
|
+
.mp img {display:block;margin:auto}
|
23
|
+
.mp h1.man-title {display:none}
|
24
|
+
.mp,.mp code,.mp pre,.mp tt,.mp kbd,.mp samp,.mp h3,.mp h4 {font-family:monospace;font-size:14px;line-height:1.42857142857143}
|
25
|
+
.mp h2 {font-size:16px;line-height:1.25}
|
26
|
+
.mp h1 {font-size:20px;line-height:2}
|
27
|
+
.mp {text-align:justify;background:#fff}
|
28
|
+
.mp,.mp code,.mp pre,.mp pre code,.mp tt,.mp kbd,.mp samp {color:#131211}
|
29
|
+
.mp h1,.mp h2,.mp h3,.mp h4 {color:#030201}
|
30
|
+
.mp u {text-decoration:underline}
|
31
|
+
.mp code,.mp strong,.mp b {font-weight:bold;color:#131211}
|
32
|
+
.mp em,.mp var {font-style:italic;color:#232221;text-decoration:none}
|
33
|
+
.mp a,.mp a:link,.mp a:hover,.mp a code,.mp a pre,.mp a tt,.mp a kbd,.mp a samp {color:#0000ff}
|
34
|
+
.mp b.man-ref {font-weight:normal;color:#434241}
|
35
|
+
.mp pre {padding:0 4ex}
|
36
|
+
.mp pre code {font-weight:normal;color:#434241}
|
37
|
+
.mp h2+pre,h3+pre {padding-left:0}
|
38
|
+
ol.man-decor,ol.man-decor li {margin:3px 0 10px 0;padding:0;float:left;width:33%;list-style-type:none;text-transform:uppercase;color:#999;letter-spacing:1px}
|
39
|
+
ol.man-decor {width:100%}
|
40
|
+
ol.man-decor li.tl {text-align:left}
|
41
|
+
ol.man-decor li.tc {text-align:center;letter-spacing:4px}
|
42
|
+
ol.man-decor li.tr {text-align:right;float:right}
|
52
43
|
</style>
|
53
44
|
</head>
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
<
|
63
|
-
|
64
|
-
|
65
|
-
<
|
66
|
-
<
|
67
|
-
|
68
|
-
<
|
45
|
+
<!--
|
46
|
+
The following styles are deprecated and will be removed at some point:
|
47
|
+
div#man, div#man ol.man, div#man ol.head, div#man ol.man.
|
48
|
+
|
49
|
+
The .man-page, .man-decor, .man-head, .man-foot, .man-title, and
|
50
|
+
.man-navigation should be used instead.
|
51
|
+
-->
|
52
|
+
<body id='manpage'>
|
53
|
+
<div class='mp' id='man'>
|
54
|
+
|
55
|
+
<div class='man-navigation' style='display:none'>
|
56
|
+
<a href="#NAME">NAME</a>
|
57
|
+
<a href="#SYNOPSIS">SYNOPSIS</a>
|
58
|
+
<a href="#DESCRIPTION">DESCRIPTION</a>
|
59
|
+
<a href="#TAG-TYPES">TAG TYPES</a>
|
60
|
+
<a href="#COPYRIGHT">COPYRIGHT</a>
|
61
|
+
<a href="#SEE-ALSO">SEE ALSO</a>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<ol class='man-decor man-head man head'>
|
65
|
+
<li class='tl'>mustache(5)</li>
|
66
|
+
<li class='tc'>Mustache Manual</li>
|
67
|
+
<li class='tr'>mustache(5)</li>
|
68
|
+
</ol>
|
69
|
+
|
70
|
+
<h2 id="NAME">NAME</h2>
|
71
|
+
<p class="man-name">
|
72
|
+
<code>mustache</code> - <span class="man-whatis">Logic-less templates.</span>
|
73
|
+
</p>
|
74
|
+
|
75
|
+
<h2 id="SYNOPSIS">SYNOPSIS</h2>
|
69
76
|
|
70
77
|
<p>A typical Mustache template:</p>
|
71
78
|
|
@@ -93,7 +100,7 @@ You have just won 10000 dollars!
|
|
93
100
|
Well, 6000.0 dollars, after taxes.
|
94
101
|
</code></pre>
|
95
102
|
|
96
|
-
<h2>DESCRIPTION</h2>
|
103
|
+
<h2 id="DESCRIPTION">DESCRIPTION</h2>
|
97
104
|
|
98
105
|
<p>Mustache can be used for HTML, config files, source code -
|
99
106
|
anything. It works by expanding tags in a template using values
|
@@ -104,13 +111,13 @@ clauses, or for loops. Instead there are only tags. Some tags are
|
|
104
111
|
replaced with a value, some nothing, and others a series of
|
105
112
|
values. This document explains the different types of Mustache tags.</p>
|
106
113
|
|
107
|
-
<h2>TAG TYPES</h2>
|
114
|
+
<h2 id="TAG-TYPES">TAG TYPES</h2>
|
108
115
|
|
109
116
|
<p>Tags are indicated by the double mustaches. <code>{{person}}</code> is a tag, as
|
110
117
|
is <code>{{#person}}</code>. In both examples, we'd refer to <code>person</code> as the key
|
111
118
|
or tag key. Let's talk about the different types of tags.</p>
|
112
119
|
|
113
|
-
<h3>Variables</h3>
|
120
|
+
<h3 id="Variables">Variables</h3>
|
114
121
|
|
115
122
|
<p>The most basic tag type is the variable. A <code>{{name}}</code> tag in a basic
|
116
123
|
template will try to find the <code>name</code> key in the current context. If
|
@@ -150,7 +157,7 @@ supports raising an exception in this situation, for instance.</p>
|
|
150
157
|
* <b>GitHub</b>
|
151
158
|
</code></pre>
|
152
159
|
|
153
|
-
<h3>Sections</h3>
|
160
|
+
<h3 id="Sections">Sections</h3>
|
154
161
|
|
155
162
|
<p>Sections render blocks of text one or more times, depending on the
|
156
163
|
value of the key in the current context.</p>
|
@@ -276,7 +283,7 @@ context for a single rendering of the block.</p>
|
|
276
283
|
<pre><code>Hi Jon!
|
277
284
|
</code></pre>
|
278
285
|
|
279
|
-
<h3>Inverted Sections</h3>
|
286
|
+
<h3 id="Inverted-Sections">Inverted Sections</h3>
|
280
287
|
|
281
288
|
<p>An inverted section begins with a caret (hat) and ends with a
|
282
289
|
slash. That is <code>{{^person}}</code> begins a "person" inverted section while
|
@@ -309,7 +316,7 @@ if the key doesn't exist, is false, or is an empty list.</p>
|
|
309
316
|
<pre><code>No repos :(
|
310
317
|
</code></pre>
|
311
318
|
|
312
|
-
<h3>Comments</h3>
|
319
|
+
<h3 id="Comments">Comments</h3>
|
313
320
|
|
314
321
|
<p>Comments begin with a bang and are ignored. The following template:</p>
|
315
322
|
|
@@ -323,7 +330,7 @@ if the key doesn't exist, is false, or is an empty list.</p>
|
|
323
330
|
|
324
331
|
<p>Comments may contain newlines.</p>
|
325
332
|
|
326
|
-
<h3>Partials</h3>
|
333
|
+
<h3 id="Partials">Partials</h3>
|
327
334
|
|
328
335
|
<p>Partials begin with a greater than sign, like <code>{{> box}}</code>.</p>
|
329
336
|
|
@@ -367,7 +374,7 @@ user.mustache:
|
|
367
374
|
{{/names}}
|
368
375
|
</code></pre>
|
369
376
|
|
370
|
-
<h3>Set Delimiter</h3>
|
377
|
+
<h3 id="Set-Delimiter">Set Delimiter</h3>
|
371
378
|
|
372
379
|
<p>Set Delimiter tags start with an equal sign and change the tag
|
373
380
|
delimiters from <code>{{</code> and <code>}}</code> to custom strings.</p>
|
@@ -392,24 +399,24 @@ markup."</p>
|
|
392
399
|
|
393
400
|
<p>Custom delimiters may not contain whitespace or the equals sign.</p>
|
394
401
|
|
395
|
-
<h2>COPYRIGHT</h2>
|
402
|
+
<h2 id="COPYRIGHT">COPYRIGHT</h2>
|
396
403
|
|
397
404
|
<p>Mustache is Copyright (C) 2009 Chris Wanstrath</p>
|
398
405
|
|
399
406
|
<p>Original CTemplate by Google</p>
|
400
407
|
|
401
|
-
<h2>SEE ALSO</h2>
|
408
|
+
<h2 id="SEE-ALSO">SEE ALSO</h2>
|
402
409
|
|
403
|
-
<p
|
404
|
-
<a href="http://mustache.github.com/">http://mustache.github.com/</a></p>
|
410
|
+
<p><a href="mustache.1.ron.html" class="man-ref">mustache<span class="s">(1)</span></a>,
|
411
|
+
<a href="http://mustache.github.com/" data-bare-link="true">http://mustache.github.com/</a></p>
|
405
412
|
|
406
413
|
|
407
|
-
<ol class='foot man'>
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
</ol>
|
414
|
+
<ol class='man-decor man-foot man foot'>
|
415
|
+
<li class='tl'>DEFUNKT</li>
|
416
|
+
<li class='tc'>August 2011</li>
|
417
|
+
<li class='tr'>mustache(5)</li>
|
418
|
+
</ol>
|
412
419
|
|
413
|
-
</div>
|
420
|
+
</div>
|
414
421
|
</body>
|
415
422
|
</html>
|