Method: XX::XHTML#xhtml_

Defined in:
lib/xx.rb,
lib/xx-2.1.0.rb

#xhtml_(which = XHTML, *a, &b) ⇒ Object Also known as: xhtml__



523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
# File 'lib/xx.rb', line 523

def xhtml_ which = XHTML, *a, &b
#--{{{
  xx_which(which) do
    doc = xx_with_doc_in_effect *a, &b
    ddoc = doc.doc
    root = ddoc.root
    if root and root.name and root.name =~ %r/^html$/i 
      if root.attribute("lang",nil).nil? or root.attribute("lang",nil).to_s.empty?
        root.add_attribute "lang", "en"
      end
      if root.attribute("xml:lang").nil? or root.attribute("xml:lang").to_s.empty?
        root.add_attribute "xml:lang", "en"
      end
      if root.namespace.nil? or root.namespace.to_s.empty?
        root.add_namespace "http://www.w3.org/1999/xhtml"
      end
    end
    doc
  end
#--}}}
end