diff options
author | Jamis Buck <jamis@37signals.com> | 2005-09-05 09:44:22 +0000 |
---|---|---|
committer | Jamis Buck <jamis@37signals.com> | 2005-09-05 09:44:22 +0000 |
commit | bfdb4375089cb16abd0a44e1a98194666986f491 (patch) | |
tree | 6fee19f3a71add6c51c08b97db4cb9a7a9a49be3 | |
parent | 873be1258e5150a5e0decaf76cfa0c04c01ba54c (diff) | |
download | rails-bfdb4375089cb16abd0a44e1a98194666986f491.tar.gz rails-bfdb4375089cb16abd0a44e1a98194666986f491.tar.bz2 rails-bfdb4375089cb16abd0a44e1a98194666986f491.zip |
Updated vendor copy of html-scanner to support better xml parsing
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2131 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rw-r--r-- | actionpack/lib/action_controller/vendor/html-scanner/html/document.rb | 4 | ||||
-rw-r--r-- | actionpack/lib/action_controller/vendor/html-scanner/html/node.rb | 3 |
3 files changed, 6 insertions, 3 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index f1c8122518..007847c42c 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Updated vendor copy of html-scanner to support better xml parsing + * Added :popup option to UrlHelper#link_to #1996 [gabriel.gironda@gmail.com]. Examples: link_to "Help", { :action => "help" }, :popup => true diff --git a/actionpack/lib/action_controller/vendor/html-scanner/html/document.rb b/actionpack/lib/action_controller/vendor/html-scanner/html/document.rb index c8e07b884c..9949afb6c9 100644 --- a/actionpack/lib/action_controller/vendor/html-scanner/html/document.rb +++ b/actionpack/lib/action_controller/vendor/html-scanner/html/document.rb @@ -11,7 +11,7 @@ module HTML #:nodoc: attr_reader :root # Create a new Document from the given text. - def initialize(text, strict=false) + def initialize(text, strict=false, xml=false) tokenizer = Tokenizer.new(text) @root = Node.new(nil) node_stack = [ @root ] @@ -38,7 +38,7 @@ ignoring attempt to close #{node_stack.last.name} with #{node.name} EOF strict ? raise(msg) : warn(msg) end - elsif !node.childless? && node.closing != :close + elsif !node.childless?(xml) && node.closing != :close node_stack.push node end end diff --git a/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb b/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb index 6d045b0367..f0f94d19cc 100644 --- a/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb +++ b/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb @@ -271,7 +271,8 @@ module HTML #:nodoc: end # Returns non-+nil+ if this tag can contain child nodes. - def childless? + def childless?(xml = false) + return false if xml && @closing.nil? !@closing.nil? || @name =~ /^(img|br|hr|link|meta|area|base|basefont| col|frame|input|isindex|param)$/ox |