Class: Bridgetown::SerbeaView

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

Instance Method Summary collapse

Methods included from Serbea::Helpers

#capture, #h, #helper, #pipeline

Instance Method Details

#markdownifyObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/serbea/bridgetown_support.rb', line 17

def markdownify
  previous_buffer_state = @_erbout
  @_erbout = +""
  result = yield
  @_erbout = previous_buffer_state

  content = Bridgetown::Utils.reindent_for_markdown(result)
  converter = site.find_converter_instance(Bridgetown::Converters::Markdown)
  md_output = converter.convert(content).strip
  @_erbout << md_output
end

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



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/serbea/bridgetown_support.rb', line 5

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

  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