mustache 1.1.1 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/man/mustache.5 CHANGED
@@ -1,220 +1,251 @@
1
- .\" generated with Ronn/v0.7.3
2
- .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
- .
4
- .TH "MUSTACHE" "5" "November 2016" "DEFUNKT" "Mustache Manual"
5
- .
1
+ .\" generated with Ronn-NG/v0.9.1
2
+ .\" http://github.com/apjanke/ronn-ng/tree/0.9.1
3
+ .TH "MUSTACHE" "5" "September 2022" "DEFUNKT" "Mustache Manual"
6
4
  .SH "NAME"
7
5
  \fBmustache\fR \- Logic\-less templates\.
8
- .
9
6
  .SH "SYNOPSIS"
10
7
  A typical Mustache template:
11
- .
12
8
  .IP "" 4
13
- .
14
9
  .nf
15
-
16
10
  Hello {{name}}
17
11
  You have just won {{value}} dollars!
18
12
  {{#in_ca}}
19
13
  Well, {{taxed_value}} dollars, after taxes\.
20
14
  {{/in_ca}}
21
- .
22
15
  .fi
23
- .
24
16
  .IP "" 0
25
- .
26
17
  .P
27
18
  Given the following hash:
28
- .
29
19
  .IP "" 4
30
- .
31
20
  .nf
32
-
33
21
  {
34
22
  "name": "Chris",
35
23
  "value": 10000,
36
24
  "taxed_value": 10000 \- (10000 * 0\.4),
37
25
  "in_ca": true
38
26
  }
39
- .
40
27
  .fi
41
- .
42
28
  .IP "" 0
43
- .
44
29
  .P
45
30
  Will produce the following:
46
- .
47
31
  .IP "" 4
48
- .
49
32
  .nf
50
-
51
33
  Hello Chris
52
34
  You have just won 10000 dollars!
53
35
  Well, 6000\.0 dollars, after taxes\.
54
- .
55
36
  .fi
56
- .
57
37
  .IP "" 0
58
- .
59
38
  .SH "DESCRIPTION"
60
39
  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\.
61
- .
62
40
  .P
63
41
  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\.
64
- .
42
+ .P
43
+ The Mustache language has a formal specification \fIhttps://github\.com/mustache/spec\fR\. The current manpage reflects version 1\.3\.0 of the specification, including the official\-but\-optional extensions for lambdas and inheritance\.
65
44
  .SH "TAG TYPES"
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\.
67
- .
45
+ 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\.
68
46
  .SS "Variables"
69
47
  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, the parent contexts will be checked recursively\. If the top context is reached and the \fBname\fR key is still not found, nothing will be rendered\.
70
- .
71
48
  .P
72
49
  All variables are HTML escaped by default\. If you want to return raw contents without escaping, use the triple mustache: \fB{{{name}}}\fR\.
73
- .
74
50
  .P
75
51
  You can also use \fB&\fR to return its raw contents: \fB{{& name}}\fR\. This may be useful when changing delimiters (see "Set Delimiter" below)\.
76
- .
77
52
  .P
78
53
  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\.
79
- .
80
54
  .P
81
55
  Template:
82
- .
83
56
  .IP "" 4
84
- .
85
57
  .nf
86
-
87
58
  * {{name}}
88
59
  * {{age}}
89
60
  * {{company}}
90
61
  * {{{company}}}
91
- .
92
62
  .fi
93
- .
94
63
  .IP "" 0
95
- .
96
64
  .P
97
65
  Hash:
98
- .
99
66
  .IP "" 4
100
- .
101
67
  .nf
102
-
103
68
  {
104
69
  "name": "Chris",
105
70
  "company": "<b>GitHub</b>"
106
71
  }
107
- .
108
72
  .fi
109
- .
110
73
  .IP "" 0
111
- .
112
74
  .P
113
75
  Output:
114
- .
115
76
  .IP "" 4
116
- .
117
77
  .nf
118
-
119
78
  * Chris
120
79
  *
121
80
  * &lt;b&gt;GitHub&lt;/b&gt;
122
81
  * <b>GitHub</b>
123
- .
124
82
  .fi
125
- .
126
83
  .IP "" 0
127
- .
84
+ .P
85
+ \fBDotted Names\fR
86
+ .P
87
+ If the \fBname\fR contains dots, it is split on the dots to obtain multiple keys\. The first key is looked up in the context as described above\. If it is found, the next key is looked up within the previous result\. This is repeated until a key is not found or until the last key is found\. The final result is interpolated as above\.
88
+ .P
89
+ Template:
90
+ .IP "" 4
91
+ .nf
92
+ * {{client\.name}}
93
+ * {{age}}
94
+ * {{client\.company\.name}}
95
+ * {{{company\.name}}}
96
+ .fi
97
+ .IP "" 0
98
+ .P
99
+ Hash:
100
+ .IP "" 4
101
+ .nf
102
+ {
103
+ "client": {
104
+ "name": "Chris & Friends",
105
+ "age": 50
106
+ },
107
+ "company": {
108
+ "name": "<b>GitHub</b>"
109
+ }
110
+ }
111
+ .fi
112
+ .IP "" 0
113
+ .P
114
+ Output:
115
+ .IP "" 4
116
+ .nf
117
+ * Chris &amp; Friends
118
+ *
119
+ *
120
+ * <b>GitHub</b>
121
+ .fi
122
+ .IP "" 0
123
+ .P
124
+ \fBImplicit Iterator\fR
125
+ .P
126
+ As a special case, if the \fBname\fR consists of only a dot and nothing else, the value that is the current context is interpolated as a whole\. This is especially useful if the parent context is a list; see \fBSections\fR below\.
127
+ .P
128
+ Template:
129
+ .IP "" 4
130
+ .nf
131
+ * {{\.}}
132
+ .fi
133
+ .IP "" 0
134
+ .P
135
+ Current context:
136
+ .IP "" 4
137
+ .nf
138
+ "Hello!"
139
+ .fi
140
+ .IP "" 0
141
+ .P
142
+ Output:
143
+ .IP "" 4
144
+ .nf
145
+ * Hello!
146
+ .fi
147
+ .IP "" 0
148
+ .P
149
+ \fBLambdas\fR
150
+ .P
151
+ If any value found during the lookup is a callable object, such as a function or lambda, this object will be invoked with zero arguments\. The value that is returned is then used instead of the callable object itself\.
152
+ .P
153
+ An \fBoptional\fR part of the specification states that if the final key in the \fBname\fR is a lambda that returns a string, then that string should be rendered as a Mustache template before interpolation\. It will be rendered using the default delimiters (see \fBSet Delimiter\fR below) against the current context\.
154
+ .P
155
+ Template:
156
+ .IP "" 4
157
+ .nf
158
+ * {{time\.hour}}
159
+ * {{today}}
160
+ .fi
161
+ .IP "" 0
162
+ .P
163
+ Hash:
164
+ .IP "" 4
165
+ .nf
166
+ {
167
+ "year": 1970,
168
+ "month": 1,
169
+ "day": 1,
170
+ "time": function() {
171
+ return {
172
+ "hour": 0,
173
+ "minute": 0,
174
+ "second": 0
175
+ }
176
+ },
177
+ "today": function() {
178
+ return "{{year}}\-{{month}}\-{{day}}"
179
+ }
180
+ }
181
+ .fi
182
+ .IP "" 0
183
+ .P
184
+ Output:
185
+ .IP "" 4
186
+ .nf
187
+ * 0
188
+ * 1970\-1\-1
189
+ .fi
190
+ .IP "" 0
128
191
  .SS "Sections"
129
192
  Sections render blocks of text zero or more times, depending on the value of the key in the current context\.
130
- .
193
+ .P
194
+ Lookup of dotted names works in the same way as with variables, except for slightly different treatment of lambdas\. More on this below\.
131
195
  .P
132
196
  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\.
133
- .
134
197
  .P
135
- The behavior of the section is determined by the value of the key\.
136
- .
198
+ The behavior of the section is determined by the final value of the key lookup\.
137
199
  .P
138
200
  \fBFalse Values or Empty Lists\fR
139
- .
140
201
  .P
141
202
  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\.
142
- .
143
203
  .P
144
204
  Template:
145
- .
146
205
  .IP "" 4
147
- .
148
206
  .nf
149
-
150
207
  Shown\.
151
208
  {{#person}}
152
209
  Never shown!
153
210
  {{/person}}
154
- .
155
211
  .fi
156
- .
157
212
  .IP "" 0
158
- .
159
213
  .P
160
214
  Hash:
161
- .
162
215
  .IP "" 4
163
- .
164
216
  .nf
165
-
166
217
  {
167
218
  "person": false
168
219
  }
169
- .
170
220
  .fi
171
- .
172
221
  .IP "" 0
173
- .
174
222
  .P
175
223
  Output:
176
- .
177
224
  .IP "" 4
178
- .
179
225
  .nf
180
-
181
226
  Shown\.
182
- .
183
227
  .fi
184
- .
185
228
  .IP "" 0
186
- .
187
229
  .P
188
230
  \fBNon\-Empty Lists\fR
189
- .
190
231
  .P
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\.
232
+ If the \fBrepo\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\.
192
233
  .
193
234
  .P
194
235
  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\.
195
- .
196
236
  .P
197
237
  Template:
198
- .
199
238
  .IP "" 4
200
- .
201
239
  .nf
202
-
203
240
  {{#repo}}
204
241
  <b>{{name}}</b>
205
242
  {{/repo}}
206
- .
207
243
  .fi
208
- .
209
244
  .IP "" 0
210
- .
211
245
  .P
212
246
  Hash:
213
- .
214
247
  .IP "" 4
215
- .
216
248
  .nf
217
-
218
249
  {
219
250
  "repo": [
220
251
  { "name": "resque" },
@@ -222,255 +253,181 @@ Hash:
222
253
  { "name": "rip" }
223
254
  ]
224
255
  }
225
- .
226
256
  .fi
227
- .
228
257
  .IP "" 0
229
- .
230
258
  .P
231
259
  Output:
232
- .
233
260
  .IP "" 4
234
- .
235
261
  .nf
236
-
237
- <b>resque</b>
238
- <b>hub</b>
239
- <b>rip</b>
240
- .
262
+ <b>resque</b>
263
+ <b>hub</b>
264
+ <b>rip</b>
265
+ .fi
266
+ .IP "" 0
267
+ .P
268
+ The same effect as above can be obtained without nested objects, by using the implicit iterator (see \fBVariables\fR above)\.
269
+ .P
270
+ Template:
271
+ .IP "" 4
272
+ .nf
273
+ {{#repo}}
274
+ <b>{{\.}}</b>
275
+ {{/repo}}
276
+ .fi
277
+ .IP "" 0
278
+ .P
279
+ Hash:
280
+ .IP "" 4
281
+ .nf
282
+ {
283
+ "repo": ["resque", "hub", "rip"]
284
+ }
285
+ .fi
286
+ .IP "" 0
287
+ .P
288
+ Output:
289
+ .IP "" 4
290
+ .nf
291
+ <b>resque</b>
292
+ <b>hub</b>
293
+ <b>rip</b>
241
294
  .fi
242
- .
243
295
  .IP "" 0
244
- .
245
296
  .P
246
297
  \fBLambdas\fR
247
- .
248
298
  .P
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\.
250
- .
299
+ When any value found during the lookup 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\.
300
+ .P
301
+ An \fBoptional\fR part of the specification states that if the final key in the \fBname\fR is a lambda that returns a string, then that string replaces the content of the section\. It will be rendered using the same delimiters (see \fBSet Delimiter\fR below) as the original section content\. In this way you can implement filters or caching\.
251
302
  .P
252
303
  Template:
253
- .
254
304
  .IP "" 4
255
- .
256
305
  .nf
257
-
258
- {{#wrapped}}
259
- {{name}} is awesome\.
260
- {{/wrapped}}
261
- .
306
+ {{#wrapped}}{{name}} is awesome\.{{/wrapped}}
262
307
  .fi
263
- .
264
308
  .IP "" 0
265
- .
266
309
  .P
267
310
  Hash:
268
- .
269
311
  .IP "" 4
270
- .
271
312
  .nf
272
-
273
313
  {
274
314
  "name": "Willy",
275
- "wrapped": function() {
276
- return function(text, render) {
277
- return "<b>" + render(text) + "</b>"
278
- }
315
+ "wrapped": function(text) {
316
+ return "<b>" + text + "</b>"
279
317
  }
280
318
  }
281
- .
282
319
  .fi
283
- .
284
320
  .IP "" 0
285
- .
286
321
  .P
287
322
  Output:
288
- .
289
323
  .IP "" 4
290
- .
291
324
  .nf
292
-
293
325
  <b>Willy is awesome\.</b>
294
- .
295
326
  .fi
296
- .
297
327
  .IP "" 0
298
- .
299
328
  .P
300
329
  \fBNon\-False Values\fR
301
- .
302
330
  .P
303
331
  When the value is non\-false but not a list, it will be used as the context for a single rendering of the block\.
304
- .
305
332
  .P
306
333
  Template:
307
- .
308
334
  .IP "" 4
309
- .
310
335
  .nf
311
-
312
336
  {{#person?}}
313
337
  Hi {{name}}!
314
338
  {{/person?}}
315
- .
316
339
  .fi
317
- .
318
340
  .IP "" 0
319
- .
320
341
  .P
321
342
  Hash:
322
- .
323
343
  .IP "" 4
324
- .
325
344
  .nf
326
-
327
345
  {
328
346
  "person?": { "name": "Jon" }
329
347
  }
330
- .
331
348
  .fi
332
- .
333
349
  .IP "" 0
334
- .
335
350
  .P
336
351
  Output:
337
- .
338
352
  .IP "" 4
339
- .
340
353
  .nf
341
-
342
- Hi Jon!
343
- .
354
+ Hi Jon!
344
355
  .fi
345
- .
346
356
  .IP "" 0
347
- .
348
357
  .SS "Inverted Sections"
349
358
  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\.
350
- .
351
359
  .P
352
- While sections can be used to render text zero 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\.
353
- .
360
+ While sections can be used to render text zero 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\.
354
361
  .P
355
362
  Template:
356
- .
357
363
  .IP "" 4
358
- .
359
364
  .nf
360
-
361
365
  {{#repo}}
362
366
  <b>{{name}}</b>
363
367
  {{/repo}}
364
368
  {{^repo}}
365
369
  No repos :(
366
370
  {{/repo}}
367
- .
368
371
  .fi
369
- .
370
372
  .IP "" 0
371
- .
372
373
  .P
373
374
  Hash:
374
- .
375
375
  .IP "" 4
376
- .
377
376
  .nf
378
-
379
377
  {
380
378
  "repo": []
381
379
  }
382
- .
383
380
  .fi
384
- .
385
381
  .IP "" 0
386
- .
387
382
  .P
388
383
  Output:
389
- .
390
384
  .IP "" 4
391
- .
392
385
  .nf
393
-
394
- No repos :(
395
- .
386
+ No repos :(
396
387
  .fi
397
- .
398
388
  .IP "" 0
399
- .
400
389
  .SS "Comments"
401
390
  Comments begin with a bang and are ignored\. The following template:
402
- .
403
391
  .IP "" 4
404
- .
405
392
  .nf
406
-
407
393
  <h1>Today{{! ignore me }}\.</h1>
408
- .
409
394
  .fi
410
- .
411
395
  .IP "" 0
412
- .
413
396
  .P
414
397
  Will render as follows:
415
- .
416
398
  .IP "" 4
417
- .
418
399
  .nf
419
-
420
400
  <h1>Today\.</h1>
421
- .
422
401
  .fi
423
- .
424
402
  .IP "" 0
425
- .
426
403
  .P
427
404
  Comments may contain newlines\.
428
- .
429
405
  .SS "Partials"
430
406
  Partials begin with a greater than sign, like \fB{{> box}}\fR\.
431
- .
432
407
  .P
433
408
  Partials are rendered at runtime (as opposed to compile time), so recursive partials are possible\. Just avoid infinite loops\.
434
- .
435
409
  .P
436
410
  They also inherit the calling context\. Whereas in ERB you may have this:
437
- .
438
411
  .IP "" 4
439
- .
440
412
  .nf
441
-
442
413
  <%= partial :next_more, :start => start, :size => size %>
443
- .
444
414
  .fi
445
- .
446
415
  .IP "" 0
447
- .
448
416
  .P
449
417
  Mustache requires only this:
450
- .
451
418
  .IP "" 4
452
- .
453
419
  .nf
454
-
455
420
  {{> next_more}}
456
- .
457
421
  .fi
458
- .
459
422
  .IP "" 0
460
- .
461
423
  .P
462
424
  Why? Because the \fBnext_more\.mustache\fR file will inherit the \fBsize\fR and \fBstart\fR methods from the calling context\.
463
- .
464
425
  .P
465
- In this way you may want to think of partials as includes, or template expansion, even though it\'s not literally true\.
466
- .
426
+ In this way you may want to think of partials as includes, or template expansion, even though it's not literally true\.
467
427
  .P
468
428
  For example, this template and partial:
469
- .
470
429
  .IP "" 4
471
- .
472
430
  .nf
473
-
474
431
  base\.mustache:
475
432
  <h2>Names</h2>
476
433
  {{#names}}
@@ -479,61 +436,181 @@ base\.mustache:
479
436
 
480
437
  user\.mustache:
481
438
  <strong>{{name}}</strong>
482
- .
483
439
  .fi
484
- .
485
440
  .IP "" 0
486
- .
487
441
  .P
488
442
  Can be thought of as a single, expanded template:
489
- .
490
443
  .IP "" 4
491
- .
492
444
  .nf
493
-
494
445
  <h2>Names</h2>
495
446
  {{#names}}
496
447
  <strong>{{name}}</strong>
497
448
  {{/names}}
498
- .
499
449
  .fi
500
- .
501
450
  .IP "" 0
502
- .
451
+ .P
452
+ \fBDynamic Names\fR
453
+ .P
454
+ Partials can be loaded dynamically at runtime using Dynamic Names; an \fBoptional\fR part of the Mustache specification which allows to dynamically determine a tag's content at runtime\.
455
+ .P
456
+ Dynamic Names consists of an asterisk, followed by a dotted name which follows the same notation and the same resolution as in an variable tag\. That is \fB{{>*dynamic}}\fR\. It can be thought as the following \fBhypothetical\fR tag (which is \fBnot allowed\fR!): \fB{{>{{dynamic}}}}\fR\.
457
+ .P
458
+ Templates:
459
+ .IP "" 4
460
+ .nf
461
+ main\.mustache:
462
+ Hello {{>*dynamic}}
463
+
464
+ world\.template:
465
+ everyone!
466
+ .fi
467
+ .IP "" 0
468
+ .P
469
+ Hash:
470
+ .IP "" 4
471
+ .nf
472
+ {
473
+ "dynamic": "world"
474
+ }
475
+ .fi
476
+ .IP "" 0
477
+ .P
478
+ Output:
479
+ .IP "" 4
480
+ .nf
481
+ Hello everyone!
482
+ .fi
483
+ .IP "" 0
484
+ .SS "Blocks"
485
+ A block begins with a dollar and ends with a slash\. That is, \fB{{$title}}\fR begins a "title" block and \fB{{/title}}\fR ends it\.
486
+ .P
487
+ Blocks mark parts of the template that may be overridden\. This can be done with a block of the same name within a parent section in the calling template (see \fBParents\fR below)\. If not overridden, the contents of a block render just as if the \fB{{$title}}\fR and \fB{{/title}}\fR tags weren't there\.
488
+ .P
489
+ Blocks could be thought of as template parameters or as inline partials that may be passed to another template\. They are part of the optional inheritance extension\.
490
+ .P
491
+ Template \fBarticle\.mustache\fR:
492
+ .IP "" 4
493
+ .nf
494
+ <h1>{{$title}}The News of Today{{/title}}</h1>
495
+ {{$body}}
496
+ <p>Nothing special happened\.</p>
497
+ {{/body}}
498
+ .fi
499
+ .IP "" 0
500
+ .P
501
+ Output:
502
+ .IP "" 4
503
+ .nf
504
+ <h1>The News of Today</h1>
505
+ <p>Nothing special happened\.</p>
506
+ .fi
507
+ .IP "" 0
508
+ .SS "Parents"
509
+ A parent begins with a less than sign and ends with a slash\. That is, \fB{{<article}}\fR begins an "article" parent and \fB{{/article}}\fR ends it\.
510
+ .P
511
+ Like an \fB{{>article}}\fR partial, a parent lets you expand another template inside the current one\. Unlike a partial, a parent also lets you override blocks of the other template\.
512
+ .P
513
+ Blocks within a parent can again be overridden by another including template\. Other content within a parent is ignored, like comments\.
514
+ .P
515
+ Template:
516
+ .IP "" 4
517
+ .nf
518
+ {{<article}}
519
+ Never shown
520
+ {{$body}}
521
+ {{#headlines}}
522
+ <p>{{\.}}</p>
523
+ {{/headlines}}
524
+ {{/body}}
525
+ {{/article}}
526
+
527
+ {{<article}}
528
+ {{$title}}Yesterday{{/title}}
529
+ {{/article}}
530
+ .fi
531
+ .IP "" 0
532
+ .P
533
+ Hash:
534
+ .IP "" 4
535
+ .nf
536
+ {
537
+ "headlines": [
538
+ "A pug's handler grew mustaches\.",
539
+ "What an exciting day!"
540
+ ]
541
+ }
542
+ .fi
543
+ .IP "" 0
544
+ .P
545
+ Output, assuming the \fBarticle\.mustache\fR from before:
546
+ .IP "" 4
547
+ .nf
548
+ <h1>The News of Today</h1>
549
+ <p>A pug's handler grew mustaches\.</p>
550
+ <p>What an exciting day!</p>
551
+
552
+ <h1>Yesterday</h1>
553
+ <p>Nothing special happened\.</p>
554
+ .fi
555
+ .IP "" 0
556
+ .P
557
+ \fBDynamic Names\fR
558
+ .P
559
+ Some mustache implementations may allow the use of Dynamic Names in parent tags, similar to dynamic names in partials\. Here's an example of how Dynamic Names in parent tags work\.
560
+ .P
561
+ Templates:
562
+ .IP "" 4
563
+ .nf
564
+ {{!normal\.mustache}}
565
+ {{$text}}Here goes nothing\.{{/text}}
566
+
567
+ {{!bold\.mustache}}
568
+ <b>{{$text}}Here also goes nothing but it's bold\.{{/text}}</b>
569
+
570
+ {{!dynamic\.mustache}}
571
+ {{<*dynamic}}
572
+ {{$text}}Hello World!{{/text}}
573
+ {{/*dynamic}}
574
+ .fi
575
+ .IP "" 0
576
+ .P
577
+ Hash:
578
+ .IP "" 4
579
+ .nf
580
+ {
581
+ "dynamic": "bold"
582
+ }
583
+ .fi
584
+ .IP "" 0
585
+ .P
586
+ Output:
587
+ .IP "" 4
588
+ .nf
589
+ <b>Hello World!</b>
590
+ .fi
591
+ .IP "" 0
503
592
  .SS "Set Delimiter"
504
593
  Set Delimiter tags start with an equal sign and change the tag delimiters from \fB{{\fR and \fB}}\fR to custom strings\.
505
- .
506
594
  .P
507
595
  Consider the following contrived example:
508
- .
509
596
  .IP "" 4
510
- .
511
597
  .nf
512
-
513
598
  * {{default_tags}}
514
599
  {{=<% %>=}}
515
600
  * <% erb_style_tags %>
516
601
  <%={{ }}=%>
517
602
  * {{ default_tags_again }}
518
- .
519
603
  .fi
520
- .
521
604
  .IP "" 0
522
- .
523
605
  .P
524
606
  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\.
525
- .
526
607
  .P
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\."
528
- .
608
+ According to ctemplates \fIhttp://goog\-ctemplate\.sourceforge\.net/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\."
529
609
  .P
530
610
  Custom delimiters may not contain whitespace or the equals sign\.
531
- .
532
611
  .SH "COPYRIGHT"
533
612
  Mustache is Copyright (C) 2009 Chris Wanstrath
534
- .
535
613
  .P
536
614
  Original CTemplate by Google
537
- .
538
615
  .SH "SEE ALSO"
539
616
  mustache(1), \fIhttp://mustache\.github\.io/\fR