Changeset 126
- Timestamp:
- 03/29/2007 18:39:54 (20 months ago)
- Location:
- trunk
- Files:
-
- 1 removed
- 5 modified
-
ext/hpricot_scan/hpricot_common.rl (modified) (1 diff)
-
lib/hpricot/builder.rb (modified) (1 diff)
-
lib/hpricot/tag.rb (modified) (1 diff)
-
lib/hpricot/text.rb (deleted)
-
lib/hpricot/traverse.rb (modified) (1 diff)
-
test/test_preserved.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ext/hpricot_scan/hpricot_common.rl
r116 r126 17 17 NameCap = Name >_tag %tag; 18 18 NameAttr = NameChar+ >_akey %akey ; 19 Q1Attr = [^']* >_aval %aval ; 20 Q2Attr = [^"]* >_aval %aval ; 19 Q1Char = ( "\\\'" | [^'] ) ; 20 Q1Attr = Q1Char* >_aval %aval ; 21 Q2Char = ( "\\\"" | [^"] ) ; 22 Q2Attr = Q2Char* >_aval %aval ; 21 23 UnqAttr = ( space >_aval | [^ \t\r\n<>"'] >_aval [^ \t\r\n<>]* %aunq ) ; 22 24 Nmtoken = NameChar+ >_akey %akey ; -
trunk/lib/hpricot/builder.rb
r125 r126 74 74 attrs = args.grep(Hash) 75 75 childs.concat((args - attrs).map { |x| Text.new(Hpricot.xs(x)) }) 76 attrs = attrs.inject({}) { |hsh, hsh2| hsh.merge(hsh2) } 76 attrs = attrs.inject({}) do |hsh, ath| 77 ath.each do |k, v| 78 hsh[k] = Hpricot.xs(v) 79 end 80 hsh 81 end 77 82 78 83 # create the element itself -
trunk/lib/hpricot/tag.rb
r125 r126 147 147 148 148 class CData < Text 149 alias_method : inner_text, :content149 alias_method :to_s, :content 150 150 alias_method :to_plain_text, :content 151 151 def output(out, opts = {}) -
trunk/lib/hpricot/traverse.rb
r123 r126 777 777 end 778 778 def get_attribute(name) 779 self.attributes && self.attributes[name.to_s] 779 a = self.attributes && self.attributes[name.to_s] 780 a = Hpricot.uxs(a) if a 781 a 780 782 end 781 783 alias_method :[], :get_attribute -
trunk/test/test_preserved.rb
r96 r126 44 44 assert_roundtrip TestFiles::CY0 45 45 end 46 47 def test_escaping_of_attrs 48 # ampersands in URLs 49 str = %{<a href="http://google.com/search?q=hpricot&l=en">Google</a>} 50 doc = Hpricot(str) 51 assert_equal "http://google.com/search?q=hpricot&l=en", doc.at(:a)['href'] 52 assert_equal str, doc.to_html 53 end 46 54 end
