def to_html_document_tree
doc = Document.new(nil,{:respect_whitespace =>:all})
root = Element.new('html', doc)
root.add_namespace('http://www.w3.org/1999/xhtml')
root.add_namespace('svg', "http://www.w3.org/2000/svg" )
lang = self.attributes[:lang] || 'en'
root.attributes['xml:lang'] = lang
root << xml_newline
head = Element.new 'head', root
me = Element.new 'meta', head
me.attributes['http-equiv'] = 'Content-type'
me.attributes['content'] = 'application/xhtml+xml;charset=utf-8'
METAS.each do |m|
if value = self.attributes[m.to_sym]
meta = Element.new 'meta', head
meta.attributes['name'] = m
meta.attributes['content'] = value.to_s
end
end
self.attributes.each do |k,v|
if k.to_s =~ /\Ameta-(.*)\Z/
meta = Element.new 'meta', head
meta.attributes['name'] = $1
meta.attributes['content'] = v.to_s
end
end
doc_title = self.attributes[:title] || self.attributes[:subject] || ""
title = Element.new 'title', head
title << Text.new(doc_title)
add_css_to(head)
root << xml_newline
body = Element.new 'body'
children_to_html.each do |e|
body << e
end
if @doc.footnotes_order.size > 0
body << render_footnotes
end
if get_setting(:maruku_signature)
body << maruku_html_signature
end
root << body
doc
end