Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 3153

Show
Ignore:
Timestamp:
11/21/05 20:43:35 (4 years ago)
Author:
minam
Message:

Update html-scanner to handle CDATA sections better. Closes #2970. [Jamis Buck]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/CHANGELOG

    r3151 r3153  
    11*SVN* 
     2 
     3* Update html-scanner to handle CDATA sections better. Closes #2970. [Jamis Buck] 
    24 
    35* Don't put flash in session if sessions are disabled.  [Jeremy Kemper] 
  • trunk/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb

    r2952 r3153  
    151151          end 
    152152 
     153          if scanner.skip(/!\[CDATA\[/) 
     154            scanner.scan_until(/\]\]>/) 
     155            return CDATA.new(parent, line, pos, scanner.pre_match) 
     156          end 
     157           
    153158          closing = ( scanner.scan(/\//) ? :close : nil ) 
    154159          return Text.new(parent, line, pos, content) unless name = scanner.scan(/[\w:]+/) 
     
    257262    end 
    258263  end 
     264   
     265  # A CDATA node is simply a text node with a specialized way of displaying 
     266  # itself. 
     267  class CDATA < Text 
     268    def to_s 
     269      "<![CDATA[#{super}]>" 
     270    end 
     271  end 
    259272 
    260273  # A Tag is any node that represents markup. It may be an opening tag, a 
  • trunk/actionpack/lib/action_controller/vendor/html-scanner/html/tokenizer.rb

    r1416 r3153  
    5353          tag << @scanner.matched 
    5454          tag << (@scanner.scan_until(/--\s*>/) || @scanner.scan_until(/\Z/)) 
     55        elsif @scanner.scan(/!\[CDATA\[/) 
     56          tag << @scanner.matched 
     57          tag << @scanner.scan_until(/\]\]>/) 
    5558        elsif @scanner.scan(/!/) # doctype 
    5659          tag << @scanner.matched