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:
parent
a7c735d7b0
commit
80ef73b233
1 changed files with 10 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue