haml-edge 2.3.222 → 2.3.223
Sign up to get free protection for your applications and to get access to all the features.
- data/EDGE_GEM_VERSION +1 -1
- data/VERSION +1 -1
- data/lib/haml/railtie.rb +1 -10
- data/lib/haml/template.rb +11 -3
- data/lib/haml/util.rb +1 -7
- metadata +1 -1
data/EDGE_GEM_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.223
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.223
|
data/lib/haml/railtie.rb
CHANGED
@@ -3,16 +3,7 @@
|
|
3
3
|
# Yehuda promises there will be soon,
|
4
4
|
# and once there is we should switch to that.
|
5
5
|
|
6
|
+
# Rails 3.0.0.beta.2+
|
6
7
|
if defined?(ActiveSupport) && Haml::Util.has?(:public_method, ActiveSupport, :on_load)
|
7
|
-
# Rails 3.0.0.beta.2+
|
8
8
|
ActiveSupport.on_load(:action_view) {Haml.init_rails(binding)}
|
9
|
-
elsif defined?(Rails::Railtie)
|
10
|
-
# Rails 3.0.0.beta1
|
11
|
-
module Haml
|
12
|
-
class Railtie < Rails::Railtie
|
13
|
-
ActiveSupport.on_load(:action_view) do
|
14
|
-
Haml.init_rails(binding)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
9
|
end
|
data/lib/haml/template.rb
CHANGED
@@ -19,7 +19,11 @@ module Haml
|
|
19
19
|
#
|
20
20
|
# @return [Boolean] Whether the XSS integration was enabled.
|
21
21
|
def try_enabling_xss_integration
|
22
|
-
return false unless ActionView::Base.respond_to?(:xss_safe?) && ActionView::Base.xss_safe?
|
22
|
+
return false unless (ActionView::Base.respond_to?(:xss_safe?) && ActionView::Base.xss_safe?) ||
|
23
|
+
# We check for ActiveSupport#on_load here because if we're loading Haml that way, it means:
|
24
|
+
# A) we're in Rails 3 so XSS support is always on, and
|
25
|
+
# B) we might be in Rails 3 beta 3 where the load order is broken and xss_safe? is undefined
|
26
|
+
(defined?(ActiveSupport) && Haml::Util.has?(:public_method, ActiveSupport, :on_load))
|
23
27
|
|
24
28
|
Haml::Template.options[:escape_html] = true
|
25
29
|
|
@@ -55,10 +59,14 @@ else
|
|
55
59
|
require 'haml/template/patch'
|
56
60
|
end
|
57
61
|
|
58
|
-
# Enable XSS integration. Use Rails' after_initialize method
|
62
|
+
# Enable XSS integration. Use Rails' after_initialize method
|
59
63
|
# so that integration will be checked after the rails_xss plugin is loaded
|
60
64
|
# (for Rails 2.3.* where it's not enabled by default).
|
61
|
-
|
65
|
+
#
|
66
|
+
# If we're running under Rails 3, though, we don't want to use after_intialize,
|
67
|
+
# since Haml loading has already been deferred via ActiveSupport.on_load.
|
68
|
+
if defined?(Rails.configuration.after_initialize) &&
|
69
|
+
!(defined?(ActiveSupport) && Haml::Util.has?(:public_method, ActiveSupport, :on_load))
|
62
70
|
Rails.configuration.after_initialize {Haml::Template.try_enabling_xss_integration}
|
63
71
|
else
|
64
72
|
Haml::Template.try_enabling_xss_integration
|
data/lib/haml/util.rb
CHANGED
@@ -274,13 +274,7 @@ module Haml
|
|
274
274
|
ActionPack::VERSION::Major
|
275
275
|
end
|
276
276
|
|
277
|
-
|
278
|
-
# for purposes of this method
|
279
|
-
# (checking whether block helpers require = or -).
|
280
|
-
# This extra check can be removed when beta2 is out.
|
281
|
-
version >= 3 &&
|
282
|
-
!(defined?(ActionPack::VERSION::TINY) &&
|
283
|
-
ActionPack::VERSION::TINY == "0.beta")
|
277
|
+
version >= 3
|
284
278
|
end
|
285
279
|
|
286
280
|
# Returns whether this environment is using ActionPack
|