Repository navigation
Expand file tree
/
Copy pathmustache.1
More file actions
138 lines (131 loc) · 1.98 KB
/
Copy pathmustache.1
File metadata and controls
138 lines (131 loc) · 1.98 KB
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
.\" generated with Ron/v0.3
.\" http://github.com/rtomayko/ron/
.
.TH "MUSTACHE" "1" "March 2010" "DEFUNKT" "Mustache Manual"
.
.SH "NAME"
\fBmustache\fR \-\- Mustache processor
.
.SH "SYNOPSIS"
\fBcat data.yml template.mustache | mustache\fR
.
.SH "DESCRIPTION"
Mustache is a logic\-less templating system for HTML, config files,
anything.
.
.P
The \fBmustache\fR command processes a Mustache template preceded by YAML
frontmatter from standard input and prints one or more documents to
standard output.
.
.P
YAML frontmatter beings with \fB---\fR on a single line, followed by YAML,
ending with another \fB---\fR on a single line, e.g.
.
.IP "" 4
.
.nf
\fB---
names: [ {name: chris}, {name: mark}, {name: scott} ]
--- \fR
.
.fi
.
.IP "" 0
.
.P
If you are unfamiliar with YAML, it is a superset of JSON. Valid JSON
should work fine.
.
.P
After the frontmatter should come any valid Mustache template. See
mustache(5) for an overview of Mustache templates.
.
.P
For example:
.
.IP "" 4
.
.nf
\fB{{#names}}
Hi {{name}}!
{{/names}} \fR
.
.fi
.
.IP "" 0
.
.P
Now let's combine them.
.
.IP "" 4
.
.nf
\fB$ cat data.yml
---
names: [ {name: chris}, {name: mark}, {name: scott} ]
---
$ cat template.mustache
{{#names}}
Hi {{name}}!
{{/names}}
$ cat data.yml template.mustache | mustache
Hi chris!
Hi mark!
Hi scott!
\fR
.
.fi
.
.IP "" 0
.
.P
If you provide multiple YAML documents (as delimited by \fB---\fR), your
template will be rendered multiple times. Like a mail merge.
.
.P
For example:
.
.IP "" 4
.
.nf
\fB$ cat data.yml
---
name: chris
---
name: mark
---
name: scott
---
$ cat template.mustache
Hi {{name}}!
$ cat data.yml template.mustache | mustache
Hi chris!
Hi mark!
Hi scott!
\fR
.
.fi
.
.IP "" 0
.
.SH "INSTALLATION"
If you have RubyGems installed:
.
.IP "" 4
.
.nf
\fBgem install mustache \fR
.
.fi
.
.IP "" 0
.
.SH "COPYRIGHT"
Mustache is Copyright (C) 2009 Chris Wanstrath
.
.P
Original CTemplate by Google
.
.SH "SEE ALSO"
mustache(5), mustache(7), gem(1),\fIhttp://defunkt.github.com/mustache/\fR