Sha256: afcc45938a384974e0e7d83e8e8cf7ec9e10b9ecd120428baa4fc12b1c000487
Contents?: true
Size: 931 Bytes
Versions: 18
Compression:
Stored size: 931 Bytes
Contents
module Hamlit class Compiler class DoctypeCompiler def initialize(options = {}) @format = options[:format] end def compile(node) case node.value[:type] when 'xml' xml_doctype when '' html_doctype(node) else [:html, :doctype, node.value[:type]] end end private def html_doctype(node) version = node.value[:version] || :transitional case @format when :xhtml [:html, :doctype, version] when :html4 [:html, :doctype, :transitional] when :html5 [:html, :doctype, :html] else [:html, :doctype, @format] end end def xml_doctype case @format when :xhtml [:static, "<?xml version='1.0' encoding='utf-8' ?>\n"] else [:multi] end end end end end
Version data entries
18 entries across 18 versions & 1 rubygems