public
Description: HTML Abstraction Markup Language - A Markup Haiku
Homepage: http://haml.hamptoncatlin.com
Clone URL: git://github.com/nex3/haml.git
:suppres_eval works properly in stable.


git-svn-id: svn://hamptoncatlin.com/haml/tags/stable@456 
7063305b-7217-0410-af8c-cdc13e5119b9
nex3 (author)
Thu Mar 29 19:22:39 -0700 2007
commit  5e5c34e65603b42868825ed30982937902733787
tree    dad941d23364fecc058adb3821f7b1cf566defbc
parent  fb95cc2d21e75ae7c910eb68f96e4db6cbbf339c
...
129
130
131
132
133
134
135
136
137
138
139
140
141
...
149
150
151
 
 
 
 
 
 
 
 
152
153
154
...
589
590
591
592
 
593
594
595
...
129
130
131
 
 
 
 
 
 
 
132
133
134
...
142
143
144
145
146
147
148
149
150
151
152
153
154
155
...
590
591
592
 
593
594
595
596
0
@@ -129,13 +129,6 @@ END
0
         }
0
       }
0
 
0
- unless @options[:suppress_eval]
0
- @options[:filters].merge!({
0
- 'erb' => ERB,
0
- 'ruby' => Haml::Filters::Ruby
0
- })
0
- end
0
-
0
       if !NOT_LOADED.include? 'redcloth'
0
         @options[:filters].merge!({
0
           'redcloth' => RedCloth,
0
@@ -149,6 +142,14 @@ END
0
 
0
       @options.rec_merge! options
0
 
0
+ unless @options[:suppress_eval]
0
+ @options[:filters].merge!({
0
+ 'erb' => ERB,
0
+ 'ruby' => Haml::Filters::Ruby
0
+ })
0
+ end
0
+ @options[:filters].rec_merge! options[:filters] if options[:filters]
0
+
0
       @precompiled = @options[:precompiled]
0
 
0
       @template = template.strip #String
0
@@ -589,7 +590,7 @@ END
0
         warn(FLAT_WARNING) if flattened && !defined?(Test::Unit)
0
 
0
         value_exists = !value.empty?
0
- attributes_hash = "nil" unless attributes_hash
0
+ attributes_hash = "nil" if attributes_hash.nil? || @options[:suppress_eval]
0
         object_ref = "nil" unless object_ref
0
 
0
         if @block_opened
...
57
58
59
 
 
 
 
 
 
 
 
 
60
61
62
...
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
0
@@ -57,6 +57,15 @@ class EngineTest < Test::Unit::TestCase
0
 
0
   def test_stop_eval
0
     assert_equal("", render("= 'Hello'", :suppress_eval => true))
0
+ assert_equal("<div id='foo' />\n", render("#foo{:yes => 'no'}/", :suppress_eval => true))
0
+
0
+ begin
0
+ assert_equal("", render(":ruby\n puts 'hello'", :suppress_eval => true))
0
+ rescue Haml::HamlError => err
0
+ caught = true
0
+ assert_equal('Filter "ruby" is not defined!', err.message)
0
+ end
0
+ assert(caught, "Rendering a ruby filter without evaluating didn't throw an error!")
0
   end
0
 
0
   def test_attr_wrapper

Comments

    No one has commented yet.