mustache 0.99.4 → 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.
- checksums.yaml +7 -0
- data/README.md +183 -183
- data/Rakefile +6 -14
- data/bin/mustache +28 -14
- data/lib/mustache/context.rb +98 -46
- data/lib/mustache/context_miss.rb +55 -0
- data/lib/mustache/enumerable.rb +3 -0
- data/lib/mustache/generator.rb +63 -42
- data/lib/mustache/parser.rb +173 -65
- data/lib/mustache/settings.rb +84 -24
- data/lib/mustache/template.rb +74 -4
- data/lib/mustache/utils.rb +31 -0
- data/lib/mustache/version.rb +1 -1
- data/lib/mustache.rb +116 -96
- data/man/mustache.1 +25 -40
- data/man/mustache.1.html +90 -81
- data/man/mustache.1.ron +6 -6
- data/man/mustache.5 +338 -298
- data/man/mustache.5.html +400 -115
- data/man/mustache.5.ron +292 -32
- data/test/autoloading_test.rb +7 -3
- data/test/fixtures/comments.rb +0 -1
- data/test/fixtures/complex_view.rb +0 -1
- data/test/fixtures/crazy_recursive.rb +0 -1
- data/test/fixtures/delimiters.rb +0 -1
- data/test/fixtures/dot_notation.rb +0 -1
- data/test/fixtures/double_section.rb +0 -1
- data/test/fixtures/inverted_section.rb +0 -1
- data/test/fixtures/lambda.rb +0 -1
- data/test/fixtures/liberal.mustache +1 -0
- data/test/fixtures/liberal.rb +25 -0
- data/test/fixtures/method_missing.rb +0 -1
- data/test/fixtures/namespaced.rb +0 -1
- data/test/fixtures/nested_objects.rb +0 -1
- data/test/fixtures/override/passenger.conf +6 -0
- data/test/fixtures/partial_with_module.rb +0 -1
- data/test/fixtures/passenger.rb +0 -1
- data/test/fixtures/recursive.rb +0 -1
- data/test/fixtures/simple.rb +0 -1
- data/test/fixtures/simply_complicated.mustache +25 -0
- data/test/fixtures/template_partial.rb +0 -1
- data/test/fixtures/unescaped.rb +0 -1
- data/test/helper.rb +5 -2
- data/test/mustache_test.rb +210 -25
- data/test/parser_test.rb +90 -7
- data/test/partial_test.rb +16 -4
- data/test/path_test.rb +49 -0
- data/test/spec_test.rb +5 -5
- data/test/template_test.rb +35 -3
- metadata +37 -59
- data/lib/mustache/sinatra.rb +0 -186
- data/lib/rack/bug/panels/mustache_panel/mustache_extension.rb +0 -27
- data/lib/rack/bug/panels/mustache_panel/view.mustache +0 -46
- data/lib/rack/bug/panels/mustache_panel.rb +0 -81
data/man/mustache.1.html
CHANGED
|
@@ -2,77 +2,86 @@
|
|
|
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(1)
|
|
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(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}
|
|
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="#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>
|
|
69
78
|
|
|
70
79
|
<pre><code>mustache <YAML> <FILE>
|
|
71
80
|
mustache --compile <FILE>
|
|
72
81
|
mustache --tokens <FILE>
|
|
73
82
|
</code></pre>
|
|
74
83
|
|
|
75
|
-
<h2>DESCRIPTION</h2>
|
|
84
|
+
<h2 id="DESCRIPTION">DESCRIPTION</h2>
|
|
76
85
|
|
|
77
86
|
<p>Mustache is a logic-less templating system for HTML, config files,
|
|
78
87
|
anything.</p>
|
|
@@ -81,7 +90,7 @@ anything.</p>
|
|
|
81
90
|
frontmatter from standard input and prints one or more documents to
|
|
82
91
|
standard output.</p>
|
|
83
92
|
|
|
84
|
-
<p>YAML frontmatter
|
|
93
|
+
<p>YAML frontmatter begins with <code>---</code> on a single line, followed by YAML,
|
|
85
94
|
ending with another <code>---</code> on a single line, e.g.</p>
|
|
86
95
|
|
|
87
96
|
<pre><code>---
|
|
@@ -93,7 +102,7 @@ names: [ {name: chris}, {name: mark}, {name: scott} ]
|
|
|
93
102
|
should work fine.</p>
|
|
94
103
|
|
|
95
104
|
<p>After the frontmatter should come any valid Mustache template. See
|
|
96
|
-
mustache(5) for an overview of Mustache templates.</p>
|
|
105
|
+
<a class="man-ref" href="mustache.5.ronn.html">mustache<span class="s">(5)</span></a> for an overview of Mustache templates.</p>
|
|
97
106
|
|
|
98
107
|
<p>For example:</p>
|
|
99
108
|
|
|
@@ -114,7 +123,7 @@ $ cat template.mustache
|
|
|
114
123
|
Hi {{name}}!
|
|
115
124
|
{{/names}}
|
|
116
125
|
|
|
117
|
-
$
|
|
126
|
+
$ mustache data.yml template.mustache
|
|
118
127
|
Hi chris!
|
|
119
128
|
Hi mark!
|
|
120
129
|
Hi scott!
|
|
@@ -137,13 +146,13 @@ name: scott
|
|
|
137
146
|
$ cat template.mustache
|
|
138
147
|
Hi {{name}}!
|
|
139
148
|
|
|
140
|
-
$
|
|
149
|
+
$ mustache data.yml template.mustache
|
|
141
150
|
Hi chris!
|
|
142
151
|
Hi mark!
|
|
143
152
|
Hi scott!
|
|
144
153
|
</code></pre>
|
|
145
154
|
|
|
146
|
-
<h2>OPTIONS</h2>
|
|
155
|
+
<h2 id="OPTIONS">OPTIONS</h2>
|
|
147
156
|
|
|
148
157
|
<p>By default <code>mustache</code> will try to render a Mustache template using the
|
|
149
158
|
YAML frontmatter you provide. It can do a few other things, however.</p>
|
|
@@ -156,19 +165,19 @@ Mustache's internals.</p></dd>
|
|
|
156
165
|
<dt><code>-t</code>, <code>--tokens</code></dt><dd><p>Print the tokenized form of a given Mustache template. This can be
|
|
157
166
|
used to understand how Mustache parses a template. The tokens are
|
|
158
167
|
handed to a generator which compiles them into a Ruby
|
|
159
|
-
string. Syntax errors and confused tags,
|
|
168
|
+
string. Syntax errors and confused tags, therefore, can probably be
|
|
160
169
|
identified by examining the tokens produced.</p></dd>
|
|
161
170
|
</dl>
|
|
162
171
|
|
|
163
172
|
|
|
164
|
-
<h2>INSTALLATION</h2>
|
|
173
|
+
<h2 id="INSTALLATION">INSTALLATION</h2>
|
|
165
174
|
|
|
166
175
|
<p>If you have RubyGems installed:</p>
|
|
167
176
|
|
|
168
177
|
<pre><code>gem install mustache
|
|
169
178
|
</code></pre>
|
|
170
179
|
|
|
171
|
-
<h2>EXAMPLES</h2>
|
|
180
|
+
<h2 id="EXAMPLES">EXAMPLES</h2>
|
|
172
181
|
|
|
173
182
|
<pre><code>$ mustache data.yml template.mustache
|
|
174
183
|
$ cat data.yml | mustache - template.mustache
|
|
@@ -181,24 +190,24 @@ age: 30
|
|
|
181
190
|
data
|
|
182
191
|
</code></pre>
|
|
183
192
|
|
|
184
|
-
<h2>COPYRIGHT</h2>
|
|
193
|
+
<h2 id="COPYRIGHT">COPYRIGHT</h2>
|
|
185
194
|
|
|
186
195
|
<p>Mustache is Copyright (C) 2009 Chris Wanstrath</p>
|
|
187
196
|
|
|
188
197
|
<p>Original CTemplate by Google</p>
|
|
189
198
|
|
|
190
|
-
<h2>SEE ALSO</h2>
|
|
199
|
+
<h2 id="SEE-ALSO">SEE ALSO</h2>
|
|
191
200
|
|
|
192
|
-
<p>mustache(5)
|
|
193
|
-
<a href="http://mustache.github.
|
|
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>
|
|
194
203
|
|
|
195
204
|
|
|
196
|
-
<ol class='foot man'>
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
</ol>
|
|
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>
|
|
201
210
|
|
|
202
|
-
</div>
|
|
211
|
+
</div>
|
|
203
212
|
</body>
|
|
204
213
|
</html>
|
data/man/mustache.1.ron
CHANGED
|
@@ -17,7 +17,7 @@ The `mustache` command processes a Mustache template preceded by YAML
|
|
|
17
17
|
frontmatter from standard input and prints one or more documents to
|
|
18
18
|
standard output.
|
|
19
19
|
|
|
20
|
-
YAML frontmatter
|
|
20
|
+
YAML frontmatter begins with `---` on a single line, followed by YAML,
|
|
21
21
|
ending with another `---` on a single line, e.g.
|
|
22
22
|
|
|
23
23
|
---
|
|
@@ -48,7 +48,7 @@ Now let's combine them.
|
|
|
48
48
|
Hi {{name}}!
|
|
49
49
|
{{/names}}
|
|
50
50
|
|
|
51
|
-
$
|
|
51
|
+
$ mustache data.yml template.mustache
|
|
52
52
|
Hi chris!
|
|
53
53
|
Hi mark!
|
|
54
54
|
Hi scott!
|
|
@@ -70,7 +70,7 @@ For example:
|
|
|
70
70
|
$ cat template.mustache
|
|
71
71
|
Hi {{name}}!
|
|
72
72
|
|
|
73
|
-
$
|
|
73
|
+
$ mustache data.yml template.mustache
|
|
74
74
|
Hi chris!
|
|
75
75
|
Hi mark!
|
|
76
76
|
Hi scott!
|
|
@@ -90,7 +90,7 @@ YAML frontmatter you provide. It can do a few other things, however.
|
|
|
90
90
|
Print the tokenized form of a given Mustache template. This can be
|
|
91
91
|
used to understand how Mustache parses a template. The tokens are
|
|
92
92
|
handed to a generator which compiles them into a Ruby
|
|
93
|
-
string. Syntax errors and confused tags,
|
|
93
|
+
string. Syntax errors and confused tags, therefore, can probably be
|
|
94
94
|
identified by examining the tokens produced.
|
|
95
95
|
|
|
96
96
|
|
|
@@ -123,5 +123,5 @@ Original CTemplate by Google
|
|
|
123
123
|
|
|
124
124
|
## SEE ALSO
|
|
125
125
|
|
|
126
|
-
mustache(5),
|
|
127
|
-
<http://mustache.github.
|
|
126
|
+
mustache(5), gem(1),
|
|
127
|
+
<http://mustache.github.io/>
|