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

Allow showing temple in CLI

This commit is contained in:
Takashi Kokubun 2015-11-22 23:27:52 +09:00
parent a7c735d7b0
commit 80ef73b233

View file

@ -15,6 +15,11 @@ module Hamlit
print_code generate_code(file)
end
desc 'temple HAML', 'Show temple intermediate expression'
def temple(file)
pp generate_temple(file)
end
desc 'parse HAML', 'Show parse result'
def parse(file)
pp generate_ast(file)
@ -48,6 +53,11 @@ module Hamlit
Hamlit::Parser.new(escape_html: true, escape_attrs: true, ugly: true).call(template)
end
def generate_temple(file)
ast = generate_ast(file)
Hamlit::Compiler.new.call(ast)
end
# Flexible default_task, compatible with haml's CLI
def method_missing(*args)
return super(*args) if args.length > 1