module Hpricot
Permission is granted for use, copying, modification, distribution, and distribution of modified versions of this work as long as the above copyright notice is included.
++
Constants
- AttrCore
-
Common sets of attributes.
- AttrEvents
- AttrFocus
- AttrHAlign
- AttrI18n
- AttrVAlign
- Attrs
- FORM_TAGS
- SELF_CLOSING_TAGS
Public Class Methods
Source
# File lib/hpricot/parse.rb, line 20 def Hpricot.XML(input = nil, opts = {}, &blk) opts.merge! :xml => true make(input, opts, &blk) end
Hpricot::XML parses input, disregarding all the HTML rules and returning a document tree.
Source
# File lib/hpricot/builder.rb, line 15 def self.build(ele = Doc.new, assigns = {}, &blk) ele.extend Builder assigns.each do |k, v| ele.instance_variable_set("@#{k}", v) end ele.instance_eval(&blk) ele end
Source
# File lib/hpricot/parse.rb, line 14 def Hpricot.parse(input = nil, opts = {}, &blk) make(input, opts, &blk) end
Hpricot.parse parses input and return a document tree. represented by Hpricot::Doc.
Source
# File lib/hpricot/builder.rb, line 8 def self.uxs(str) str.to_s. gsub(/\&(\w+);/) { [NamedCharacters[$1] || 63].pack("U*") }. # 63 = ?? (query char) gsub(/\&\#(\d+);/) { [$1.to_i].pack("U*") }. gsub(/\&\#x([0-9a-fA-F]+);/) { [$1.to_i(16)].pack("U*") } end
XML unescape
Source
# File lib/hpricot/xchar.rb, line 70 def xchr(str) n = XChar::CP1252[str] || str case n when *XChar::VALID XChar::PREDEFINED[n] or (n<128 ? n.chr : "&##{n};") else '*' end end
XML escaped version of chr