module HTree::Node

Public Instance Methods

format_xml(i=-1) click to toggle source
# File vendor/qwik/lib/qwik/htree-format-xml.rb, line 12
def format_xml(i=-1)
  str = ''
  display_xml(str)
  str.gsub!(%r! xmlns=\"http://www.w3.org/1999/xhtml\"!, "")
  str.gsub!(%r! xmlns=\"\"!, "")
  if i < 0
    str.gsub!(/\n>/, ">")
    str.gsub!(/\n\/>/, "/>")
  end
  str
end
to_wabisabi() click to toggle source
# File vendor/qwik/lib/qwik/htree-to-wabisabi.rb, line 41
def to_wabisabi
  ar = []

  element_name = name.sub('{http://www.w3.org/1999/xhtml}', '').intern
  ar << element_name

  if 0 < attributes.length
    h = {}
    attributes.each {|k, v|
      h[k.to_s.intern] = v.to_s
    }
    ar << h
  end

  children.each {|h|
    case h
    when Elem, Text, Comment, BogusETag
      ar << h.to_wabisabi
    else
      p 'what?', h
    end
  }

  return ar
end