| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<meta http-equiv='content-type' value='text/html;charset=utf8'> |
| 5 |
<meta name='generator' value='Ronn/v0.7.3 (http://github.com/rtomayko/ronn/tree/0.7.3)'> |
| 6 |
<title>mustache(1) - Mustache processor</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} |
| 43 |
</style> |
| 44 |
</head> |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 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="#OPTIONS">OPTIONS</a> |
| 60 |
<a href="#INSTALLATION">INSTALLATION</a> |
| 61 |
<a href="#EXAMPLES">EXAMPLES</a> |
| 62 |
<a href="#COPYRIGHT">COPYRIGHT</a> |
| 63 |
<a href="#SEE-ALSO">SEE ALSO</a> |
| 64 |
</div> |
| 65 |
|
| 66 |
<ol class='man-decor man-head man head'> |
| 67 |
<li class='tl'>mustache(1)</li> |
| 68 |
<li class='tc'>Mustache Manual</li> |
| 69 |
<li class='tr'>mustache(1)</li> |
| 70 |
</ol> |
| 71 |
|
| 72 |
<h2 id="NAME">NAME</h2> |
| 73 |
<p class="man-name"> |
| 74 |
<code>mustache</code> - <span class="man-whatis">Mustache processor</span> |
| 75 |
</p> |
| 76 |
|
| 77 |
<h2 id="SYNOPSIS">SYNOPSIS</h2> |
| 78 |
|
| 79 |
<pre><code>mustache <YAML> <FILE> |
| 80 |
mustache --compile <FILE> |
| 81 |
mustache --tokens <FILE> |
| 82 |
</code></pre> |
| 83 |
|
| 84 |
<h2 id="DESCRIPTION">DESCRIPTION</h2> |
| 85 |
|
| 86 |
<p>Mustache is a logic-less templating system for HTML, config files, |
| 87 |
anything.</p> |
| 88 |
|
| 89 |
<p>The <code>mustache</code> command processes a Mustache template preceded by YAML |
| 90 |
frontmatter from standard input and prints one or more documents to |
| 91 |
standard output.</p> |
| 92 |
|
| 93 |
<p>YAML frontmatter begins with <code>---</code> on a single line, followed by YAML, |
| 94 |
ending with another <code>---</code> on a single line, e.g.</p> |
| 95 |
|
| 96 |
<pre><code>--- |
| 97 |
names: [ {name: chris}, {name: mark}, {name: scott} ] |
| 98 |
--- |
| 99 |
</code></pre> |
| 100 |
|
| 101 |
<p>If you are unfamiliar with YAML, it is a superset of JSON. Valid JSON |
| 102 |
should work fine.</p> |
| 103 |
|
| 104 |
<p>After the frontmatter should come any valid Mustache template. See |
| 105 |
<a class="man-ref" href="mustache.5.ronn.html">mustache<span class="s">(5)</span></a> for an overview of Mustache templates.</p> |
| 106 |
|
| 107 |
<p>For example:</p> |
| 108 |
|
| 109 |
<pre><code>{{#names}} |
| 110 |
Hi {{name}}! |
| 111 |
{{/names}} |
| 112 |
</code></pre> |
| 113 |
|
| 114 |
<p>Now let's combine them.</p> |
| 115 |
|
| 116 |
<pre><code>$ cat data.yml |
| 117 |
--- |
| 118 |
names: [ {name: chris}, {name: mark}, {name: scott} ] |
| 119 |
--- |
| 120 |
|
| 121 |
$ cat template.mustache |
| 122 |
{{#names}} |
| 123 |
Hi {{name}}! |
| 124 |
{{/names}} |
| 125 |
|
| 126 |
$ mustache data.yml template.mustache |
| 127 |
Hi chris! |
| 128 |
Hi mark! |
| 129 |
Hi scott! |
| 130 |
</code></pre> |
| 131 |
|
| 132 |
<p>If you provide multiple YAML documents (as delimited by <code>---</code>), your |
| 133 |
template will be rendered multiple times. Like a mail merge.</p> |
| 134 |
|
| 135 |
<p>For example:</p> |
| 136 |
|
| 137 |
<pre><code>$ cat data.yml |
| 138 |
--- |
| 139 |
name: chris |
| 140 |
--- |
| 141 |
name: mark |
| 142 |
--- |
| 143 |
name: scott |
| 144 |
--- |
| 145 |
|
| 146 |
$ cat template.mustache |
| 147 |
Hi {{name}}! |
| 148 |
|
| 149 |
$ mustache data.yml template.mustache |
| 150 |
Hi chris! |
| 151 |
Hi mark! |
| 152 |
Hi scott! |
| 153 |
</code></pre> |
| 154 |
|
| 155 |
<h2 id="OPTIONS">OPTIONS</h2> |
| 156 |
|
| 157 |
<p>By default <code>mustache</code> will try to render a Mustache template using the |
| 158 |
YAML frontmatter you provide. It can do a few other things, however.</p> |
| 159 |
|
| 160 |
<dl> |
| 161 |
<dt><code>-c</code>, <code>--compile</code></dt><dd><p>Print the compiled Ruby version of a given template. This is the |
| 162 |
code that is actually used when rendering a template into a |
| 163 |
string. Useful for debugging but only if you are familiar with |
| 164 |
Mustache's internals.</p></dd> |
| 165 |
<dt><code>-t</code>, <code>--tokens</code></dt><dd><p>Print the tokenized form of a given Mustache template. This can be |
| 166 |
used to understand how Mustache parses a template. The tokens are |
| 167 |
handed to a generator which compiles them into a Ruby |
| 168 |
string. Syntax errors and confused tags, therefore, can probably be |
| 169 |
identified by examining the tokens produced.</p></dd> |
| 170 |
</dl> |
| 171 |
|
| 172 |
|
| 173 |
<h2 id="INSTALLATION">INSTALLATION</h2> |
| 174 |
|
| 175 |
<p>If you have RubyGems installed:</p> |
| 176 |
|
| 177 |
<pre><code>gem install mustache |
| 178 |
</code></pre> |
| 179 |
|
| 180 |
<h2 id="EXAMPLES">EXAMPLES</h2> |
| 181 |
|
| 182 |
<pre><code>$ mustache data.yml template.mustache |
| 183 |
$ cat data.yml | mustache - template.mustache |
| 184 |
$ mustache -c template.mustache |
| 185 |
$ cat <<data | ruby mustache - template.mustache |
| 186 |
--- |
| 187 |
name: Bob |
| 188 |
age: 30 |
| 189 |
--- |
| 190 |
data |
| 191 |
</code></pre> |
| 192 |
|
| 193 |
<h2 id="COPYRIGHT">COPYRIGHT</h2> |
| 194 |
|
| 195 |
<p>Mustache is Copyright (C) 2009 Chris Wanstrath</p> |
| 196 |
|
| 197 |
<p>Original CTemplate by Google</p> |
| 198 |
|
| 199 |
<h2 id="SEE-ALSO">SEE ALSO</h2> |
| 200 |
|
| 201 |
<p><a class="man-ref" href="mustache.5.ronn.html">mustache<span class="s">(5)</span></a>, <span class="man-ref">gem<span class="s">(1)</span></span>, |
| 202 |
<a href="http://mustache.github.io/" data-bare-link="true">http://mustache.github.io/</a></p> |
| 203 |
|
| 204 |
|
| 205 |
<ol class='man-decor man-foot man foot'> |
| 206 |
<li class='tl'>DEFUNKT</li> |
| 207 |
<li class='tc'>November 2016</li> |
| 208 |
<li class='tr'>mustache(1)</li> |
| 209 |
</ol> |
| 210 |
|
| 211 |
</div> |
| 212 |
</body> |
| 213 |
</html> |