haml 3.2.0.alpha.2 → 3.2.0.alpha.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.
Potentially problematic release.
This version of haml might be problematic. Click here for more details.
- data/REVISION +1 -1
- data/VERSION +1 -1
- data/lib/haml/helpers/action_view_mods.rb +14 -2
- data/lib/haml/parser.rb +1 -1
- data/test/haml/engine_test.rb +14 -0
- data/test/haml/helper_test.rb +4 -0
- metadata +2 -2
data/REVISION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
881d7e66546964138bcc0458302d97b62e6e703a
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.2.0.alpha.
|
1
|
+
3.2.0.alpha.3
|
@@ -51,7 +51,10 @@ module ActionView
|
|
51
51
|
# We've got to do the same thing for compatibility.
|
52
52
|
|
53
53
|
if is_haml? && block_is_haml?(block)
|
54
|
-
|
54
|
+
value = nil
|
55
|
+
buffer = capture_haml(*args) { value = yield(*args) }
|
56
|
+
return buffer unless buffer.empty?
|
57
|
+
return value if value.is_a?(String)
|
55
58
|
else
|
56
59
|
capture_without_haml(*args, &block)
|
57
60
|
end
|
@@ -85,7 +88,16 @@ module ActionView
|
|
85
88
|
module CaptureHelper
|
86
89
|
def capture_with_haml(*args, &block)
|
87
90
|
if Haml::Helpers.block_is_haml?(block)
|
88
|
-
|
91
|
+
value = nil
|
92
|
+
buffer = capture_haml(*args) { value = yield(*args) }
|
93
|
+
str =
|
94
|
+
if !buffer.empty?
|
95
|
+
buffer
|
96
|
+
elsif value.is_a?(String)
|
97
|
+
value
|
98
|
+
else
|
99
|
+
''
|
100
|
+
end
|
89
101
|
return ActionView::NonConcattingString.new(str) if defined?(ActionView::NonConcattingString)
|
90
102
|
return str
|
91
103
|
else
|
data/lib/haml/parser.rb
CHANGED
@@ -146,7 +146,7 @@ END
|
|
146
146
|
|
147
147
|
@tab_up = nil
|
148
148
|
process_line(@line.text, @line.index) unless @line.text.empty? || @haml_comment
|
149
|
-
if block_opened? || @tab_up
|
149
|
+
if @parent.type != :haml_comment && (block_opened? || @tab_up)
|
150
150
|
@template_tabs += 1
|
151
151
|
@parent = @parent.children.last
|
152
152
|
end
|
data/test/haml/engine_test.rb
CHANGED
@@ -382,6 +382,20 @@ SOURCE
|
|
382
382
|
assert_equal("<p foo='bar'></p>\n", render('%p{:foo => "bar"}', :attr_wrapper => nil))
|
383
383
|
end
|
384
384
|
|
385
|
+
def test_comment_with_crazy_nesting
|
386
|
+
assert_equal(<<HTML, render(<<HAML))
|
387
|
+
foo
|
388
|
+
bar
|
389
|
+
HTML
|
390
|
+
foo
|
391
|
+
-#
|
392
|
+
ul
|
393
|
+
%li{
|
394
|
+
foo
|
395
|
+
bar
|
396
|
+
HAML
|
397
|
+
end
|
398
|
+
|
385
399
|
# Regression tests
|
386
400
|
|
387
401
|
def test_whitespace_nuke_with_both_newlines
|
data/test/haml/helper_test.rb
CHANGED
@@ -357,6 +357,10 @@ HAML
|
|
357
357
|
assert_equal("1\n\n2\n\n3\n\n", render("- trc([1, 2, 3]) do |i|\n = i.inspect"))
|
358
358
|
end
|
359
359
|
|
360
|
+
def test_capture_with_string_block
|
361
|
+
assert_equal("foo\n", render("= capture { 'foo' }", :action_view))
|
362
|
+
end
|
363
|
+
|
360
364
|
def test_find_and_preserve_with_block
|
361
365
|
assert_equal("<pre>Foo
Bar</pre>\nFoo\nBar\n",
|
362
366
|
render("= find_and_preserve do\n %pre\n Foo\n Bar\n Foo\n Bar"))
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: haml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.0.alpha.
|
4
|
+
version: 3.2.0.alpha.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Weizenbaum
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-05-10 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|