Module: XX::XHTML

Includes:
Markup
Included in:
Strict, Transitional
Defined in:
lib/xx.rb,
lib/xx-2.1.0.rb

Defined Under Namespace

Modules: Strict, Transitional

Constant Summary

Constants included from Markup

Markup::XX_MARKUP_RECURSIVE_INCLUSION_PROC

Instance Method Summary collapse

Methods included from Markup

included

Methods included from Markup::ClassMethods

#xx_ancestors, #xx_config, #xx_config_for, #xx_configure, #xx_define_tag_method, #xx_define_tmp_method, #xx_remove_tag_method, #xx_tag_method_name

Methods included from Markup::InstanceMethods

#_, #method_missing, #xx_ancestors, #xx_any_, #xx_cdata_, #xx_class, #xx_config, #xx_config_for, #xx_configure, #xx_define_tag_method, #xx_define_tmp_method, #xx_doc, #xx_markup_, #xx_parse_attributes, #xx_parse_yaml_attributes, #xx_remove_tag_method, #xx_tag_method_name, #xx_text_, #xx_which, #xx_with_doc_in_effect

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class XX::Markup::InstanceMethods

Instance Method Details

#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