Engine
Hpricot Adaptor
# File lib/jam/hpricot.rb, line 67 def append(ns, child) ns.append(child.to_s) end
# File lib/jam/hpricot.rb, line 97 def attribute(ns, att, val) ns.set(att, val) end
Remove jam nodes that ask for it, and all jam attributes.
# File lib/jam/hpricot.rb, line 103 def cleanup(node) #node = node.root if ::Nokogiri::XML::Document === node # remove unwanted tags node.search("//*[@jam='erase']").each do |n| unwrap(n) end # remove jam attributes # node end
deep copy # TODO: works?
# File lib/jam/hpricot.rb, line 52 def copy(node) node.dup end
# File lib/jam/hpricot.rb, line 42 def document(source) ::Hpricot.parse(source) #, *@options) end
Iterate over each node.
# File lib/jam/hpricot.rb, line 125 def each_node(nodes) unless ::Hpricot::Elements === nodes nodes = [nodes] end nodes.each do |node| yield(node) end end
# File lib/jam/hpricot.rb, line 78 def remove(node) node.remove end
# File lib/jam/hpricot.rb, line 57 def remove(node) node.remove end
# File lib/jam/hpricot.rb, line 72 def replace(ns, child) empty(ns) append(ns, child) end
# File lib/jam/hpricot.rb, line 83 def replace_content_with_text(node, text) case node when ::Hpricot::Elements node.inner_html = text when ::Array node.each do |n| n.inner_html = text end else end end
Disabled; run with --debug to generate this.