mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
27 lines
398 B
Ruby
27 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
|