Sha256: f41208a89229f9fc872ad31c968d8008046c928c8c7e1ce93359e0a038015bea
Contents?: true
Size: 948 Bytes
Versions: 1
Compression:
Stored size: 948 Bytes
Contents
require "temple" require "erbse/parser" module Erbse class BlockFilter < Temple::Filter # Highly inspired by https://github.com/slim-template/slim/blob/master/lib/slim/controls.rb#on_slim_output def on_erb_block(code, content_ast) # this is for <%= do %> outter_i = unique_name inner_i = unique_name # this still needs the Temple::Filters::ControlFlow run-through. [:multi, [:block, "#{outter_i} = #{code}", [:capture, inner_i, compile(content_ast)] # compile() is recursion on nested block content. ], [:dynamic, outter_i] # return the outter buffer. # DISCUSS: why do we need that, again? ] end end class Engine < Temple::Engine use Parser use BlockFilter # filter :MultiFlattener # filter :StaticMerger # filter :DynamicInliner filter :ControlFlow generator :ArrayBuffer end # DISCUSS: can we add more optimizers? end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
erbse-0.1.0 | lib/erbse.rb |