Changeset 125

Show
Ignore:
Timestamp:
03/28/2007 22:15:06 (20 months ago)
Author:
why
Message:
  • lib/hpricot: more work on the markaby-like stuff, entities, simplifying css proxy.
Location:
trunk
Files:
2 added
2 modified

Legend:

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

    r123 r125  
    11require 'hpricot/tags' 
     2require 'hpricot/xchar' 
    23require 'hpricot/blankslate' 
    34 
     
    2526    def self.set(option, value) 
    2627      @@default[option] = value 
     28    end 
     29 
     30    # Write a +string+ to the HTML stream, making sure to escape it. 
     31    def text!(string) 
     32      @children << Text.new(Hpricot.xs(string)) 
    2733    end 
    2834 
     
    6773      childs = [] 
    6874      attrs = args.grep(Hash) 
    69       childs.concat((args - attrs).map { |x| Text.new(x) }) 
     75      childs.concat((args - attrs).map { |x| Text.new(Hpricot.xs(x)) }) 
    7076      attrs = attrs.inject({}) { |hsh, hsh2| hsh.merge(hsh2) } 
    7177 
     
    171177      end 
    172178       
    173       args.push(@attrs) 
    174        
    175       if block 
     179      if block or args.any? 
     180        args.push(@attrs) 
    176181        @builder.tag! @sym, *args, &block 
    177       else 
    178         @builder.tag! @sym, *args 
    179182      end 
    180183       
  • trunk/lib/hpricot/tag.rb

    r123 r125  
    134134    def pathname; "text()" end 
    135135    alias_method :inner_text, :content 
    136     alias_method :to_plain_text, :content 
     136    def to_s 
     137      Hpricot.uxs(@content) 
     138    end 
     139    alias_method :to_plain_text, :to_s 
    137140    def output(out, opts = {}) 
    138141      out <<