haml 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of haml might be problematic. Click here for more details.

data/REFERENCE CHANGED
@@ -171,7 +171,7 @@ by chaining the class names together with periods.
171
171
  They are placed immediately after the tag and before an attributes hash.
172
172
  For example:
173
173
 
174
- div#things
174
+ %div#things
175
175
  %span#rice Chicken Fried
176
176
  %p.beans{ :food => 'true' } The magical fruit
177
177
  %h1.class.otherclass#id La La La
@@ -181,7 +181,7 @@ is compiled to:
181
181
  <div id='things'>
182
182
  <span id='rice'>Chicken Fried</span>
183
183
  <p class='beans' food='true'>The magical fruit</p>
184
- <h1 class='class' id='id'>La La La</h1>
184
+ <h1 class='class otherclass' id='id'>La La La</h1>
185
185
  </div>
186
186
 
187
187
  And,
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.4
1
+ 1.0.5
@@ -32,11 +32,15 @@ if action_view_included
32
32
  end
33
33
 
34
34
  def concat(string, binding = nil) # :nodoc:
35
- buffer.buffer.concat(string)
35
+ if is_haml?
36
+ buffer.buffer.concat(string)
37
+ else
38
+ old_concat(string, binding)
39
+ end
36
40
  end
37
41
 
38
42
  def form_tag(url_for_options = {}, options = {}, *parameters_for_url, &proc) # :nodoc:
39
- if block_given?
43
+ if block_given? && is_haml?
40
44
  oldproc = proc
41
45
  proc = bind_proc do |*args|
42
46
  concat "\n"
data/lib/haml/helpers.rb CHANGED
@@ -214,7 +214,22 @@ module Haml
214
214
  end
215
215
  result.to_s
216
216
  end
217
+
218
+ # Returns whether or not the current template is a Haml template.
219
+ #
220
+ # This function, unlike other Haml::Helpers functions,
221
+ # also works in other ActionView templates,
222
+ # where it will always return false.
223
+ def is_haml?
224
+ @haml_stack ? @haml_stack.size > 0 : false
225
+ end
217
226
 
218
227
  include ActionViewMods if self.const_defined? "ActionViewMods"
219
228
  end
220
229
  end
230
+
231
+ class ActionView::Base # :nodoc:
232
+ def is_haml?
233
+ false
234
+ end
235
+ end
@@ -6,7 +6,7 @@
6
6
  </head>
7
7
  <body>
8
8
  <!-- You're In my house now! -->
9
- <div class='header'>
9
+ Foo <div class='header'>
10
10
  Yes, ladies and gentileman. He is just that egotistical.
11
11
  Fantastic! This should be multi-line output
12
12
  The question is if this would translate! Ahah!
@@ -6,6 +6,7 @@
6
6
  </head>
7
7
  <body>
8
8
  <!-- You're In my house now! -->
9
+ <% concat "Foo", Proc.new {} %>
9
10
  <div class='header'>
10
11
  Yes, ladies and gentileman. He is just that egotistical.
11
12
  Fantastic! This should be multi-line output
@@ -80,6 +80,14 @@ class TemplateTest < Test::Unit::TestCase
80
80
  end
81
81
 
82
82
  def test_rhtml_still_renders
83
+ # Make sure it renders normally
84
+ res = @base.render("../rhtml/standard")
85
+ assert !(res.nil? || res.empty?)
86
+
87
+ # Register Haml stuff in @base...
88
+ @base.render("standard")
89
+
90
+ # Does it still render?
83
91
  res = @base.render("../rhtml/standard")
84
92
  assert !(res.nil? || res.empty?)
85
93
  end
@@ -5,6 +5,7 @@
5
5
  %meta{"http-equiv" => "Content-Type", :content => "text/html; charset=utf-8"}/
6
6
  %body
7
7
  / You're In my house now!
8
+ - concat "Foo"
8
9
  .header
9
10
  Yes, ladies and gentileman. He is just that egotistical.
10
11
  Fantastic! This should be multi-line output
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: haml
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.4
7
- date: 2007-01-19 00:00:00 -08:00
6
+ version: 1.0.5
7
+ date: 2007-01-25 00:00:00 -08:00
8
8
  summary: An elegant, structured XHTML/XML templating engine.
9
9
  require_paths:
10
10
  - lib
@@ -47,9 +47,9 @@ files:
47
47
  - test/runner.rb
48
48
  - test/benchmark.rb
49
49
  - test/template_test.rb
50
+ - test/results/eval_suppressed.xhtml
50
51
  - test/results/silent_script.xhtml
51
52
  - test/results/whitespace_handling.xhtml
52
- - test/results/eval_suppressed.xhtml
53
53
  - test/results/very_basic.xhtml
54
54
  - test/results/original_engine.xhtml
55
55
  - test/results/list.xhtml
@@ -62,15 +62,15 @@ files:
62
62
  - test/results/helpers.xhtml
63
63
  - test/rhtml/standard.rhtml
64
64
  - test/mocks/article.rb
65
+ - test/templates/whitespace_handling.haml
65
66
  - test/templates/eval_suppressed.haml
66
67
  - test/templates/standard.haml
67
68
  - test/templates/helpful.haml
68
69
  - test/templates/helpers.haml
69
- - test/templates/whitespace_handling.haml
70
+ - test/templates/silent_script.haml
70
71
  - test/templates/partialize.haml
71
72
  - test/templates/_text_area.haml
72
73
  - test/templates/list.haml
73
- - test/templates/silent_script.haml
74
74
  - test/templates/content_for_layout.haml
75
75
  - test/templates/partials.haml
76
76
  - test/templates/very_basic.haml