Permalink
Browse files

Allow disabling escape_xml

  • Loading branch information...
1 parent d5c1e89 commit 677d08b9dd972367369a509987264ded25e70f9a @wycats wycats committed Dec 16, 2008
Showing with 12 additions and 3 deletions.
  1. +12 −3 merb-helpers/lib/merb-helpers/form/builder.rb
@@ -243,9 +243,14 @@ def options(col, text_meth, value_meth, sel, b = nil)
([b] + col.map do |item|
text_meth = text_meth && item.respond_to?(text_meth) ? text_meth : :last
value_meth = value_meth && item.respond_to?(value_meth) ? value_meth : :first
+
+ text = item.is_a?(String) ? item : item.send(text_meth)
+ value = item.is_a?(String) ? item : item.send(value_meth)
- text = item.is_a?(String) ? item : Merb::Parse.escape_xml(item.send(text_meth))
- value = item.is_a?(String) ? item : Merb::Parse.escape_xml(item.send(value_meth))
+ unless Merb.disabled?(:merb_helper_escaping)
+ text = Merb::Parse.escape_xml(text)
+ value = Merb::Parse.escape_xml(value)
+ end
option_attrs = {:value => value}
if sel.is_a?(Array)
@@ -272,7 +277,11 @@ def control_name(method)
def control_value(method)
value = @obj ? @obj.send(method) : @origin.params[method]
- Merb::Parse.escape_xml(value.to_s)
+ if Merb.disabled?(:merb_helper_escaping)
+ value.to_s
+ else
+ Merb::Parse.escape_xml(value.to_s)
+ end
end
def add_css_class(attrs, new_class)

0 comments on commit 677d08b

Please sign in to comment.