1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Carve out DoctypeCompiler

This commit is contained in:
Takashi Kokubun 2015-10-11 19:53:34 +09:00
parent f2e0a13032
commit c9007ea44b
2 changed files with 15 additions and 2 deletions

View file

@ -1,9 +1,11 @@
require 'hamlit/tag_compiler'
require 'hamlit/doctype_compiler'
module Hamlit
class Compiler
def initialize(options = {})
@tag_compiler = TagCompiler.new(options[:attr_quote])
@doctype_compiler = DoctypeCompiler.new(options[:format])
@tag_compiler = TagCompiler.new(options[:attr_quote])
end
def call(ast)
@ -37,7 +39,7 @@ module Hamlit
end
def compile_doctype(node)
[:html, :doctype, node.value[:type]]
@doctype_compiler.compile(node)
end
def compile_tag(node)

View file

@ -0,0 +1,11 @@
module Hamlit
class DoctypeCompiler
def initialize(format)
@format = format
end
def compile(node)
[:html, :doctype, node.value[:type]]
end
end
end