mustache 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/README.md +30 -197
  2. data/Rakefile +87 -46
  3. data/bin/mustache +5 -29
  4. data/lib/mustache/context.rb +54 -11
  5. data/lib/mustache/template.rb +2 -14
  6. data/lib/mustache/version.rb +1 -1
  7. data/man/mustache.1 +138 -0
  8. data/man/mustache.1.html +168 -0
  9. data/man/mustache.1.ron +94 -0
  10. data/man/mustache.5 +364 -0
  11. data/man/mustache.5.html +300 -0
  12. data/man/mustache.5.ron +220 -0
  13. data/test/helper.rb +1 -0
  14. data/test/mustache_test.rb +19 -16
  15. metadata +32 -65
  16. data/.gitignore +0 -1
  17. data/.kick +0 -26
  18. data/CONTRIBUTORS +0 -7
  19. data/HISTORY.md +0 -76
  20. data/benchmarks/complex.erb +0 -15
  21. data/benchmarks/complex.haml +0 -10
  22. data/benchmarks/helper.rb +0 -20
  23. data/benchmarks/simple.erb +0 -5
  24. data/benchmarks/speed.rb +0 -76
  25. data/contrib/mustache.vim +0 -69
  26. data/contrib/tpl-mode.el +0 -274
  27. data/examples/comments.mustache +0 -1
  28. data/examples/comments.rb +0 -14
  29. data/examples/complex_view.mustache +0 -16
  30. data/examples/complex_view.rb +0 -34
  31. data/examples/delimiters.mustache +0 -6
  32. data/examples/delimiters.rb +0 -22
  33. data/examples/double_section.mustache +0 -7
  34. data/examples/double_section.rb +0 -14
  35. data/examples/escaped.mustache +0 -1
  36. data/examples/escaped.rb +0 -14
  37. data/examples/inner_partial.mustache +0 -1
  38. data/examples/inner_partial.txt +0 -1
  39. data/examples/namespaced.mustache +0 -1
  40. data/examples/namespaced.rb +0 -25
  41. data/examples/partial_with_module.mustache +0 -3
  42. data/examples/partial_with_module.rb +0 -37
  43. data/examples/passenger.conf +0 -5
  44. data/examples/passenger.rb +0 -27
  45. data/examples/simple.mustache +0 -5
  46. data/examples/simple.rb +0 -26
  47. data/examples/template_partial.mustache +0 -2
  48. data/examples/template_partial.rb +0 -18
  49. data/examples/template_partial.txt +0 -4
  50. data/examples/unescaped.mustache +0 -1
  51. data/examples/unescaped.rb +0 -14
@@ -1 +0,0 @@
1
- <h1>{{title}}{{! just something interesting... #or not... }}</h1>
@@ -1,14 +0,0 @@
1
- $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
2
- require 'mustache'
3
-
4
- class Comments < Mustache
5
- self.path = File.dirname(__FILE__)
6
-
7
- def title
8
- "A Comedy of Errors"
9
- end
10
- end
11
-
12
- if $0 == __FILE__
13
- puts Comments.to_html
14
- end
@@ -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}}
@@ -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
@@ -1,6 +0,0 @@
1
- {{=<% %>=}}
2
- * <% first %>
3
- <%=| |=%>
4
- * | second |
5
- |={{ }}=|
6
- * {{ third }}
@@ -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
@@ -1,7 +0,0 @@
1
- {{#t}}
2
- * first
3
- {{/t}}
4
- * {{two}}
5
- {{#t}}
6
- * third
7
- {{/t}}
@@ -1,14 +0,0 @@
1
- $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
2
- require 'mustache'
3
-
4
- class DoubleSection < Mustache
5
- self.path = File.dirname(__FILE__)
6
-
7
- def t
8
- true
9
- end
10
-
11
- def two
12
- "second"
13
- end
14
- end
@@ -1 +0,0 @@
1
- <h1>{{title}}</h1>
@@ -1,14 +0,0 @@
1
- $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
2
- require 'mustache'
3
-
4
- class Escaped < Mustache
5
- self.path = File.dirname(__FILE__)
6
-
7
- def title
8
- "Bear > Shark"
9
- end
10
- end
11
-
12
- if $0 == __FILE__
13
- puts Escaped.to_html
14
- end
@@ -1 +0,0 @@
1
- Again, {{title}}!
@@ -1 +0,0 @@
1
- ## Again, {{title}}! ##
@@ -1 +0,0 @@
1
- <h1>{{title}}</h1>
@@ -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,3 +0,0 @@
1
- <h1>{{greeting}}</h1>
2
- {{>simple}}
3
- <h3>{{farewell}}</h3>
@@ -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
@@ -1,5 +0,0 @@
1
- <VirtualHost *>
2
- ServerName {{server}}
3
- DocumentRoot {{deploy_to}}
4
- RailsEnv {{stage}}
5
- </VirtualHost>
@@ -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
@@ -1,5 +0,0 @@
1
- Hello {{name}}
2
- You have just won ${{value}}!
3
- {{#in_ca}}
4
- Well, ${{ taxed_value }}, after taxes.
5
- {{/in_ca}}
@@ -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,2 +0,0 @@
1
- <h1>{{title}}</h1>
2
- {{>inner_partial}}
@@ -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
@@ -1,4 +0,0 @@
1
- {{title}}
2
- {{title_bars}}
3
-
4
- {{>inner_partial}}
@@ -1 +0,0 @@
1
- <h1>{{{title}}}</h1>
@@ -1,14 +0,0 @@
1
- $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
2
- require 'mustache'
3
-
4
- class Unescaped < Mustache
5
- self.path = File.dirname(__FILE__)
6
-
7
- def title
8
- "Bear > Shark"
9
- end
10
- end
11
-
12
- if $0 == __FILE__
13
- puts Unescaped.to_html
14
- end