mustache 0.11.0 → 0.11.1
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/README.md +7 -7
- data/bin/mustache +1 -1
- data/lib/mustache/version.rb +1 -1
- data/man/mustache.5 +4 -4
- data/man/mustache.5.html +4 -4
- data/man/mustache.5.ron +4 -4
- data/test/mustache_test.rb +17 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -75,9 +75,9 @@ reference others, some return values, some return only booleans.
|
|
75
75
|
Now let's write the template:
|
76
76
|
|
77
77
|
Hello {{name}}
|
78
|
-
You have just won
|
78
|
+
You have just won {{value}} dollars!
|
79
79
|
{{#in_ca}}
|
80
|
-
Well,
|
80
|
+
Well, {{taxed_value}} dollars, after taxes.
|
81
81
|
{{/in_ca}}
|
82
82
|
|
83
83
|
This template references our view methods. To bring it all together,
|
@@ -88,8 +88,8 @@ here's the code to render actual HTML;
|
|
88
88
|
Which returns the following:
|
89
89
|
|
90
90
|
Hello Chris
|
91
|
-
You have just won
|
92
|
-
Well,
|
91
|
+
You have just won 10000 dollars!
|
92
|
+
Well, 6000.0 dollars, after taxes.
|
93
93
|
|
94
94
|
Simple.
|
95
95
|
|
@@ -125,7 +125,7 @@ class-based and this more procedural style at your leisure.
|
|
125
125
|
Given this template (winner.mustache):
|
126
126
|
|
127
127
|
Hello {{name}}
|
128
|
-
You have just won
|
128
|
+
You have just won {{value}} bucks!
|
129
129
|
|
130
130
|
We can fill in the values at will:
|
131
131
|
|
@@ -137,14 +137,14 @@ We can fill in the values at will:
|
|
137
137
|
Which returns:
|
138
138
|
|
139
139
|
Hello George
|
140
|
-
You have just won
|
140
|
+
You have just won 100 bucks!
|
141
141
|
|
142
142
|
We can re-use the same object, too:
|
143
143
|
|
144
144
|
view[:name] = 'Tony'
|
145
145
|
view.render
|
146
146
|
Hello Tony
|
147
|
-
You have just won
|
147
|
+
You have just won 100 bucks!
|
148
148
|
|
149
149
|
|
150
150
|
Templates
|
data/bin/mustache
CHANGED
data/lib/mustache/version.rb
CHANGED
data/man/mustache.5
CHANGED
@@ -14,9 +14,9 @@ A typical Mustache template:
|
|
14
14
|
.nf
|
15
15
|
|
16
16
|
Hello {{name}}
|
17
|
-
You have just won
|
17
|
+
You have just won {{value}} dollars!
|
18
18
|
{{#in_ca}}
|
19
|
-
Well,
|
19
|
+
Well, {{taxed_value}} dollars, after taxes.
|
20
20
|
{{/in_ca}}
|
21
21
|
.
|
22
22
|
.fi
|
@@ -49,8 +49,8 @@ Will produce the following:
|
|
49
49
|
.nf
|
50
50
|
|
51
51
|
Hello Chris
|
52
|
-
You have just won
|
53
|
-
Well,
|
52
|
+
You have just won 10000 dollars!
|
53
|
+
Well, 6000.0 dollars, after taxes.
|
54
54
|
.
|
55
55
|
.fi
|
56
56
|
.
|
data/man/mustache.5.html
CHANGED
@@ -70,9 +70,9 @@
|
|
70
70
|
<p>A typical Mustache template:</p>
|
71
71
|
|
72
72
|
<pre><code>Hello {{name}}
|
73
|
-
You have just won
|
73
|
+
You have just won {{value}} dollars!
|
74
74
|
{{#in_ca}}
|
75
|
-
Well,
|
75
|
+
Well, {{taxed_value}} dollars, after taxes.
|
76
76
|
{{/in_ca}}
|
77
77
|
</code></pre>
|
78
78
|
|
@@ -89,8 +89,8 @@ Well, ${{taxed_value}}, after taxes.
|
|
89
89
|
<p>Will produce the following:</p>
|
90
90
|
|
91
91
|
<pre><code>Hello Chris
|
92
|
-
You have just won
|
93
|
-
Well,
|
92
|
+
You have just won 10000 dollars!
|
93
|
+
Well, 6000.0 dollars, after taxes.
|
94
94
|
</code></pre>
|
95
95
|
|
96
96
|
<h2>DESCRIPTION</h2>
|
data/man/mustache.5.ron
CHANGED
@@ -6,9 +6,9 @@ mustache(5) -- Logic-less templates.
|
|
6
6
|
A typical Mustache template:
|
7
7
|
|
8
8
|
Hello {{name}}
|
9
|
-
You have just won
|
9
|
+
You have just won {{value}} dollars!
|
10
10
|
{{#in_ca}}
|
11
|
-
Well,
|
11
|
+
Well, {{taxed_value}} dollars, after taxes.
|
12
12
|
{{/in_ca}}
|
13
13
|
|
14
14
|
Given the following hash:
|
@@ -23,8 +23,8 @@ Given the following hash:
|
|
23
23
|
Will produce the following:
|
24
24
|
|
25
25
|
Hello Chris
|
26
|
-
You have just won
|
27
|
-
Well,
|
26
|
+
You have just won 10000 dollars!
|
27
|
+
Well, 6000.0 dollars, after taxes.
|
28
28
|
|
29
29
|
|
30
30
|
## DESCRIPTION
|
data/test/mustache_test.rb
CHANGED
@@ -57,6 +57,22 @@ rendered
|
|
57
57
|
rendered
|
58
58
|
end
|
59
59
|
|
60
|
+
def test_multi_line_sections_preserve_trailing_newline
|
61
|
+
view = Mustache.new
|
62
|
+
view.template = <<template
|
63
|
+
{{#something}}
|
64
|
+
yay
|
65
|
+
{{/something}}
|
66
|
+
Howday.
|
67
|
+
template
|
68
|
+
|
69
|
+
view[:something] = true
|
70
|
+
assert_equal <<-rendered.strip, view.render.strip
|
71
|
+
yay
|
72
|
+
Howday.
|
73
|
+
rendered
|
74
|
+
end
|
75
|
+
|
60
76
|
def test_single_line_inverted_sections
|
61
77
|
html = %(<p class="flash-notice" {{^ flash }}style="display: none;"{{/ flash }}>)
|
62
78
|
|
@@ -448,7 +464,7 @@ template
|
|
448
464
|
base = Class.new(Mustache)
|
449
465
|
tmpl = Class.new(base)
|
450
466
|
|
451
|
-
{:template_path => File.expand_path('./foo'),
|
467
|
+
{:template_path => File.expand_path('./foo'),
|
452
468
|
:template_extension => 'stache',
|
453
469
|
:view_namespace => TestNamespace,
|
454
470
|
:view_path => './foo'
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 11
|
8
|
-
-
|
9
|
-
version: 0.11.
|
8
|
+
- 1
|
9
|
+
version: 0.11.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Chris Wanstrath
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-05-12 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|