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

26 lines
436 B
Ruby
Raw Normal View History

2015-10-06 23:14:45 +09:00
module Hamlit
class Compiler
def initialize(options = {})
@options = options
end
2015-10-07 00:33:20 +09:00
def call(ast)
temple = ast.children.map do |node|
compile_node(node)
end
[:multi, *temple]
end
private
def compile_node(node)
case node.type
when :tag
[:html, :tag, node.value[:name], [:html, :attrs], [:multi]]
else
[:static, "\n"]
end
2015-10-06 23:14:45 +09:00
end
end
end