1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00
haml--haml/lib/hamilton/parser.rb
Takashi Kokubun afef4d8e5f Parse doctype
2015-03-10 00:41:21 +09:00

26 lines
398 B
Ruby

require 'temple'
module Hamilton
class Parser < Temple::Parser
def initialize(options = {})
super
@ast = [:multi]
end
def call(template)
template.each_line do |line|
parse_line(line)
end
@ast
end
private
def parse_line(line)
case line
when /\A!!!/
@ast << [:html, :doctype, 'html']
end
end
end
end