Class: Erbse::BlockFilter
- Inherits:
-
Temple::Filter
- Object
- Temple::Filter
- Erbse::BlockFilter
- Defined in:
- lib/erbse.rb
Instance Method Summary collapse
-
#on_capture_block(code, content_ast) ⇒ Object
assign all code in the block to new local output buffer without outputting it.
-
#on_erb_block(code, content_ast) ⇒ Object
Highly inspired by github.com/slim-template/slim/blob/master/lib/slim/controls.rb#on_slim_output.
Instance Method Details
#on_capture_block(code, content_ast) ⇒ Object
assign all code in the block to new local output buffer without outputting it. handles <%@ do %>
23 24 25 26 27 28 29 |
# File 'lib/erbse.rb', line 23 def on_capture_block(code, content_ast) [:multi, [:block, code, # var = capture do [:capture, unique_name, compile(content_ast)] ] ] end |
#on_erb_block(code, content_ast) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/erbse.rb', line 7 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)] ], [:dynamic, outter_i] # return the outter buffer. # DISCUSS: why do we need that, again? ] end |