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

27 lines
398 B
Ruby
Raw Normal View History

2015-03-09 11:37:41 -04:00
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