class Hamlit::Block::SilentScriptCompiler

Suppress block's internal rendering result and pass it to [:capture, …] if the silent script is `do .. end` block

Constants

BLOCK_REGEX

Public Class Methods

new(identity) click to toggle source
# File lib/hamlit/block/silent_script_compiler.rb, line 6
def initialize(identity)
  @identity = identity
end

Public Instance Methods

compile_with_children(node) { |node| ... } click to toggle source
Calls superclass method
# File lib/hamlit/block/silent_script_compiler.rb, line 12
def compile_with_children(node, &block)
  if node.value[:text] =~ BLOCK_REGEX
    [:multi,
     [:block, node.value[:text],
      [:multi,
       [:newline],
       [:capture, @identity.generate, yield(node)],
      ],
     ]
    ]
  else
    super
  end
end