Class: Bridgetown::Converters::SerbeaTemplates

Inherits:
Bridgetown::Converter show all
Defined in:
lib/bridgetown-core/converters/serbea_templates.rb

Instance Method Summary collapse

Methods inherited from Bridgetown::Converter

#determine_template_engine, #initialize, input, #inspect, #line_start, #matches, #output_ext, support_slots, supports_slots?, template_engine

Methods inherited from Plugin

#initialize

Methods included from Prioritizable

#<=>, included

Constructor Details

This class inherits a constructor from Bridgetown::Converter

Instance Method Details

#convert(content, convertible) ⇒ String

Logic to do the Serbea content conversion

Parameters:

Returns:

  • (String)

    The converted content



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/bridgetown-core/converters/serbea_templates.rb', line 35

def convert(content, convertible)
  serb_view = Bridgetown::SerbeaView.new(convertible)
  serb_renderer = Tilt::SerbeaTemplate.new(
    convertible.path,
    line_start(convertible)
  ) { content }

  if convertible.is_a?(Bridgetown::Layout)
    serb_renderer.render(serb_view) do
      convertible.current_document_output
    end
  else
    serb_renderer.render(serb_view)
  end
end