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:
parent
f2e0a13032
commit
c9007ea44b
2 changed files with 15 additions and 2 deletions
|
@ -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)
|
||||
|
|
11
lib/hamlit/doctype_compiler.rb
Normal file
11
lib/hamlit/doctype_compiler.rb
Normal 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
|
Loading…
Add table
Reference in a new issue