mustache 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +30 -197
- data/Rakefile +87 -46
- data/bin/mustache +5 -29
- data/lib/mustache/context.rb +54 -11
- data/lib/mustache/template.rb +2 -14
- data/lib/mustache/version.rb +1 -1
- data/man/mustache.1 +138 -0
- data/man/mustache.1.html +168 -0
- data/man/mustache.1.ron +94 -0
- data/man/mustache.5 +364 -0
- data/man/mustache.5.html +300 -0
- data/man/mustache.5.ron +220 -0
- data/test/helper.rb +1 -0
- data/test/mustache_test.rb +19 -16
- metadata +32 -65
- data/.gitignore +0 -1
- data/.kick +0 -26
- data/CONTRIBUTORS +0 -7
- data/HISTORY.md +0 -76
- data/benchmarks/complex.erb +0 -15
- data/benchmarks/complex.haml +0 -10
- data/benchmarks/helper.rb +0 -20
- data/benchmarks/simple.erb +0 -5
- data/benchmarks/speed.rb +0 -76
- data/contrib/mustache.vim +0 -69
- data/contrib/tpl-mode.el +0 -274
- data/examples/comments.mustache +0 -1
- data/examples/comments.rb +0 -14
- data/examples/complex_view.mustache +0 -16
- data/examples/complex_view.rb +0 -34
- data/examples/delimiters.mustache +0 -6
- data/examples/delimiters.rb +0 -22
- data/examples/double_section.mustache +0 -7
- data/examples/double_section.rb +0 -14
- data/examples/escaped.mustache +0 -1
- data/examples/escaped.rb +0 -14
- data/examples/inner_partial.mustache +0 -1
- data/examples/inner_partial.txt +0 -1
- data/examples/namespaced.mustache +0 -1
- data/examples/namespaced.rb +0 -25
- data/examples/partial_with_module.mustache +0 -3
- data/examples/partial_with_module.rb +0 -37
- data/examples/passenger.conf +0 -5
- data/examples/passenger.rb +0 -27
- data/examples/simple.mustache +0 -5
- data/examples/simple.rb +0 -26
- data/examples/template_partial.mustache +0 -2
- data/examples/template_partial.rb +0 -18
- data/examples/template_partial.txt +0 -4
- data/examples/unescaped.mustache +0 -1
- data/examples/unescaped.rb +0 -14
data/examples/comments.mustache
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
<h1>{{title}}{{! just something interesting... #or not... }}</h1>
|
data/examples/comments.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
<h1>{{header}}</h1>
|
2
|
-
{{#list}}
|
3
|
-
<ul>
|
4
|
-
{{#item}}
|
5
|
-
{{#current}}
|
6
|
-
<li><strong>{{name}}</strong></li>
|
7
|
-
{{/current}}
|
8
|
-
{{#link}}
|
9
|
-
<li><a href="{{url}}">{{name}}</a></li>
|
10
|
-
{{/link}}
|
11
|
-
{{/item}}
|
12
|
-
</ul>
|
13
|
-
{{/list}}
|
14
|
-
{{#empty}}
|
15
|
-
<p>The list is empty.</p>
|
16
|
-
{{/empty}}
|
data/examples/complex_view.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
|
2
|
-
require 'mustache'
|
3
|
-
|
4
|
-
class ComplexView < Mustache
|
5
|
-
self.path = File.dirname(__FILE__)
|
6
|
-
|
7
|
-
def header
|
8
|
-
"Colors"
|
9
|
-
end
|
10
|
-
|
11
|
-
def item
|
12
|
-
items = []
|
13
|
-
items << { :name => 'red', :current => true, :url => '#Red' }
|
14
|
-
items << { :name => 'green', :current => false, :url => '#Green' }
|
15
|
-
items << { :name => 'blue', :current => false, :url => '#Blue' }
|
16
|
-
items
|
17
|
-
end
|
18
|
-
|
19
|
-
def link
|
20
|
-
not self[:current]
|
21
|
-
end
|
22
|
-
|
23
|
-
def list
|
24
|
-
not item.empty?
|
25
|
-
end
|
26
|
-
|
27
|
-
def empty
|
28
|
-
item.empty?
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
if $0 == __FILE__
|
33
|
-
puts ComplexView.to_html
|
34
|
-
end
|
data/examples/delimiters.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
|
2
|
-
require 'mustache'
|
3
|
-
|
4
|
-
class Delimiters < Mustache
|
5
|
-
self.path = File.dirname(__FILE__)
|
6
|
-
|
7
|
-
def first
|
8
|
-
"It worked the first time."
|
9
|
-
end
|
10
|
-
|
11
|
-
def second
|
12
|
-
"And it worked the second time."
|
13
|
-
end
|
14
|
-
|
15
|
-
def third
|
16
|
-
"Then, surprisingly, it worked the third time."
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
if $0 == __FILE__
|
21
|
-
puts Delimiters.to_html
|
22
|
-
end
|
data/examples/double_section.rb
DELETED
data/examples/escaped.mustache
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
<h1>{{title}}</h1>
|
data/examples/escaped.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Again, {{title}}!
|
data/examples/inner_partial.txt
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
## Again, {{title}}! ##
|
@@ -1 +0,0 @@
|
|
1
|
-
<h1>{{title}}</h1>
|
data/examples/namespaced.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
|
2
|
-
require 'mustache'
|
3
|
-
|
4
|
-
module TestViews
|
5
|
-
class Namespaced < Mustache
|
6
|
-
self.path = File.dirname(__FILE__)
|
7
|
-
|
8
|
-
def title
|
9
|
-
"Dragon < Tiger"
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
class NamespacedWithPartial < Mustache
|
14
|
-
self.path = File.dirname(__FILE__)
|
15
|
-
self.template = "My opinion: {{>inner_partial}}"
|
16
|
-
|
17
|
-
def title
|
18
|
-
"Victory"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
if $0 == __FILE__
|
24
|
-
puts TestViews::Namespaced.to_html
|
25
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
|
2
|
-
require 'mustache'
|
3
|
-
|
4
|
-
module SimpleView
|
5
|
-
def name
|
6
|
-
"Bob"
|
7
|
-
end
|
8
|
-
|
9
|
-
def value
|
10
|
-
100_000
|
11
|
-
end
|
12
|
-
|
13
|
-
def taxed_value
|
14
|
-
value - (value * 0.4)
|
15
|
-
end
|
16
|
-
|
17
|
-
def in_ca
|
18
|
-
false
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
class PartialWithModule < Mustache
|
23
|
-
include SimpleView
|
24
|
-
self.path = File.dirname(__FILE__)
|
25
|
-
|
26
|
-
def greeting
|
27
|
-
"Welcome"
|
28
|
-
end
|
29
|
-
|
30
|
-
def farewell
|
31
|
-
"Fair enough, right?"
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
if $0 == __FILE__
|
36
|
-
puts PartialWithModule.to_html
|
37
|
-
end
|
data/examples/passenger.conf
DELETED
data/examples/passenger.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
|
2
|
-
require 'mustache'
|
3
|
-
|
4
|
-
class Passenger < Mustache
|
5
|
-
self.path = File.dirname(__FILE__)
|
6
|
-
self.template_extension = 'conf'
|
7
|
-
|
8
|
-
def server
|
9
|
-
"example.com"
|
10
|
-
end
|
11
|
-
|
12
|
-
def deploy_to
|
13
|
-
"/var/www/example.com"
|
14
|
-
end
|
15
|
-
|
16
|
-
def stage
|
17
|
-
"production"
|
18
|
-
end
|
19
|
-
|
20
|
-
def timestamp
|
21
|
-
Time.now.strftime('%Y%m%d%H%M%S')
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
if $0 == __FILE__
|
26
|
-
puts Passenger.to_text
|
27
|
-
end
|
data/examples/simple.mustache
DELETED
data/examples/simple.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
|
2
|
-
require 'mustache'
|
3
|
-
|
4
|
-
class Simple < Mustache
|
5
|
-
self.path = File.dirname(__FILE__)
|
6
|
-
|
7
|
-
def name
|
8
|
-
"Chris"
|
9
|
-
end
|
10
|
-
|
11
|
-
def value
|
12
|
-
10_000
|
13
|
-
end
|
14
|
-
|
15
|
-
def taxed_value
|
16
|
-
value - (value * 0.4)
|
17
|
-
end
|
18
|
-
|
19
|
-
def in_ca
|
20
|
-
true
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
if $0 == __FILE__
|
25
|
-
puts Simple.to_html
|
26
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
|
2
|
-
require 'mustache'
|
3
|
-
|
4
|
-
class TemplatePartial < Mustache
|
5
|
-
self.path = File.dirname(__FILE__)
|
6
|
-
|
7
|
-
def title
|
8
|
-
"Welcome"
|
9
|
-
end
|
10
|
-
|
11
|
-
def title_bars
|
12
|
-
'-' * title.size
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
if $0 == __FILE__
|
17
|
-
puts TemplatePartial.to_html
|
18
|
-
end
|
data/examples/unescaped.mustache
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
<h1>{{{title}}}</h1>
|
data/examples/unescaped.rb
DELETED