Changeset 139

Show
Ignore:
Timestamp:
04/17/2007 17:34:54 (20 months ago)
Author:
why
Message:
  • lib/hpricot/xchar.rb: in case of unknown characters.
  • lib/hpricot/builder.rb: subtle bug, was causing some Hackety Hack elements to be un-designable.
  • lib/hpricot/tag.rb: inner_text returns unescaped text.
Location:
trunk/lib/hpricot
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/lib/hpricot/builder.rb

    r137 r139  
    191191      if block or args.any? 
    192192        args.push(@attrs) 
    193         @builder.tag! @sym, *args, &block 
     193        return @builder.tag! @sym, *args, &block 
    194194      end 
    195195       
  • trunk/lib/hpricot/tag.rb

    r130 r139  
    138138    alterable :content 
    139139    def pathname; "text()" end 
    140     alias_method :inner_text, :content 
    141140    def to_s 
    142141      Hpricot.uxs(@content) 
    143142    end 
     143    alias_method :inner_text, :to_s 
    144144    alias_method :to_plain_text, :to_s 
    145145    def output(out, opts = {}) 
  • trunk/lib/hpricot/xchar.rb

    r125 r139  
    8787    # XML unescape 
    8888    def uxs(str) 
    89       str.gsub(/\&\w+;/) { |x| XChar::PREDEFINED_U[x].chr }. 
     89      str.gsub(/\&\w+;/) { |x| (XChar::PREDEFINED_U[x] || ??).chr }. 
    9090          gsub(/\&\#(\d+);/) { [$1.to_i].pack("U*") } 
    9191    end