Class: Bridgetown::SerbeaView

Inherits:
ERBView
  • Object
show all
Includes:
Serbea::Helpers
Defined in:
lib/serbea/bridgetown_support.rb

Instance Method Summary collapse

Methods included from Serbea::Helpers

#append, #assign_to, #capture, #h, #helper, included, #pipeline, #prepend, #safe

Instance Method Details

#partial(partial_name, options = {}, &block) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/serbea/bridgetown_support.rb', line 8

def partial(partial_name, options = {}, &block)
  options.merge!(options[:locals]) if options[:locals]
  options[:content] = capture(&block) if block

  partial_segments = partial_name.split("/")
  partial_segments.last.sub!(%r!^!, "_")
  partial_name = partial_segments.join("/")

  Tilt::SerbeaTemplate.new(
    site.in_source_dir(site.config[:partials_dir], "#{partial_name}.serb")
  ).render(self, options)
end