def to_html_document_tree
root = xelem('html')
root['xmlns'] = 'http://www.w3.org/1999/xhtml'
root['xmlns:svg'] = "http://www.w3.org/2000/svg"
root['xml:lang'] = self.attributes[:lang] || 'en'
root << xml_newline
head = xelem('head')
root << head
me = xelem('meta')
me['http-equiv'] = 'Content-type'
me['content'] = 'application/xhtml+xml;charset=utf-8'
head << me
%w(description keywords author revised).each do |m|
if value = self.attributes[m.to_sym]
meta = xelem('meta')
meta['name'] = m
meta['content'] = value.to_s
head << meta
end
end
self.attributes.each do |k,v|
if k.to_s =~ /\Ameta-(.*)\z/
meta = xelem('meta')
meta['name'] = $1
meta['content'] = v.to_s
head << meta
end
end
doc_title = self.attributes[:title] || self.attributes[:subject] || ""
begin
title_content = MaRuKu::HTMLFragment.new(doc_title).to_html
rescue
title_content = xtext(doc_title)
end
title = xelem('title') << title_content
head << title
add_css_to(head)
root << xml_newline
body = xelem('body')
children_to_html.each do |e|
body << e.to_s
end
unless @doc.footnotes_order.empty?
body << render_footnotes
end
if get_setting(:maruku_signature)
body << maruku_html_signature
end
root << body
end