aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2008-11-14 17:41:25 +0530
committerPratik Naik <pratiknaik@gmail.com>2008-11-14 17:41:25 +0530
commit17b1387646a9537c978e9d7c5f3a68f740cd9377 (patch)
tree81735b97603471bb9780ed0fd133dad7a16f59a7 /actionpack/lib/action_view
parentfa9ea057d1252a578f8e056defef41b93853bc8b (diff)
parent549b18c9286b6cccf4978093576325fd711dc421 (diff)
downloadrails-17b1387646a9537c978e9d7c5f3a68f740cd9377.tar.gz
rails-17b1387646a9537c978e9d7c5f3a68f740cd9377.tar.bz2
rails-17b1387646a9537c978e9d7c5f3a68f740cd9377.zip
Merge commit 'mainstream/master'
Conflicts: railties/doc/guides/html/actioncontroller_basics.html railties/doc/guides/html/activerecord_validations_callbacks.html railties/doc/guides/html/debugging_rails_applications.html railties/doc/guides/html/testing_rails_applications.html railties/doc/guides/source/actioncontroller_basics/methods.txt railties/doc/guides/source/actioncontroller_basics/params.txt railties/doc/guides/source/actioncontroller_basics/request_response_objects.txt railties/doc/guides/source/actioncontroller_basics/session.txt railties/doc/guides/source/activerecord_validations_callbacks.txt railties/doc/guides/source/debugging_rails_applications.txt railties/doc/guides/source/testing_rails_applications.txt
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r--actionpack/lib/action_view/helpers/atom_feed_helper.rb13
-rw-r--r--actionpack/lib/action_view/helpers/tag_helper.rb10
-rw-r--r--actionpack/lib/action_view/helpers/text_helper.rb4
3 files changed, 17 insertions, 10 deletions
diff --git a/actionpack/lib/action_view/helpers/atom_feed_helper.rb b/actionpack/lib/action_view/helpers/atom_feed_helper.rb
index ccb7df212a..cd25684940 100644
--- a/actionpack/lib/action_view/helpers/atom_feed_helper.rb
+++ b/actionpack/lib/action_view/helpers/atom_feed_helper.rb
@@ -1,3 +1,5 @@
+require 'set'
+
# Adds easy defaults to writing Atom feeds with the Builder template engine (this does not work on ERb or any other
# template languages).
module ActionView
@@ -121,6 +123,8 @@ module ActionView
end
class AtomBuilder
+ XHTML_TAG_NAMES = %w(content rights title subtitle summary).to_set
+
def initialize(xml)
@xml = xml
end
@@ -140,14 +144,15 @@ module ActionView
@xml.__send__(method, *arguments, &block)
end
end
-
+
# True if the method name matches one of the five elements defined
# in the Atom spec as potentially containing XHTML content and
# if :type => 'xhtml' is, in fact, specified.
def xhtml_block?(method, arguments)
- %w( content rights title subtitle summary ).include?(method.to_s) &&
- arguments.last.respond_to?(:[]) &&
- arguments.last[:type].to_s == 'xhtml'
+ if XHTML_TAG_NAMES.include?(method.to_s)
+ last = arguments.last
+ last.is_a?(Hash) && last[:type].to_s == 'xhtml'
+ end
end
end
diff --git a/actionpack/lib/action_view/helpers/tag_helper.rb b/actionpack/lib/action_view/helpers/tag_helper.rb
index de08672d2d..d37ca766af 100644
--- a/actionpack/lib/action_view/helpers/tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/tag_helper.rb
@@ -133,10 +133,12 @@ module ActionView
unless options.blank?
attrs = []
if escape
- options.each do |key, value|
- next unless value
- value = BOOLEAN_ATTRIBUTES.include?(key) ? key : escape_once(value)
- attrs << %(#{key}="#{value}")
+ options.each_pair do |key, value|
+ if BOOLEAN_ATTRIBUTES.include?(key)
+ attrs << %(#{key}="#{key}") if value
+ else
+ attrs << %(#{key}="#{escape_once(value)}") if !value.nil?
+ end
end
else
attrs = options.map { |key, value| %(#{key}="#{value}") }
diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb
index d80e7c6e57..36f7575652 100644
--- a/actionpack/lib/action_view/helpers/text_helper.rb
+++ b/actionpack/lib/action_view/helpers/text_helper.rb
@@ -559,7 +559,7 @@ module ActionView
(?:\.[-\w]+)* # remaining subdomains or domain
(?::\d+)? # port
(?:/(?:[~\w\+@%=\(\)-]|(?:[,.;:'][^\s$]))*)* # path
- (?:\?[\w\+@%&=.;-]+)? # query string
+ (?:\?[\w\+@%&=.;:-]+)? # query string
(?:\#[\w\-]*)? # trailing anchor
)
([[:punct:]]|<|$|) # trailing text
@@ -598,4 +598,4 @@ module ActionView
end
end
end
-end \ No newline at end of file
+end