lib/faml/compiler.rb in faml-0.3.6 vs lib/faml/compiler.rb in faml-0.4.0

- old
+ new

@@ -395,14 +395,20 @@ temple << [:escape, ast.escape_html, [:dynamic, "#{sym}.to_s"]] end temple end + SKIP_END_KEYWORDS = %w[elsif else when].freeze + def compile_silent_script(ast) - temple = [:multi, [:code, ast.script], [:newline]] + temple = [:multi] + if SKIP_END_KEYWORDS.include?(ast.keyword) + temple << [:rmend] + end + temple << [:code, ast.script] << [:newline] compile_children(ast, temple) - if !ast.children.empty? && !ast.mid_block_keyword - temple << [:code, 'end'] + if !ast.children.empty? || ast.keyword + temple << [:mkend] end temple end def compile_filter(ast)