Class: Bridgetown::Converters::SerbeaTemplates

Inherits:
Converter
  • Object
show all
Defined in:
lib/serbea/bridgetown_support.rb

Instance Method Summary collapse

Instance Method Details

#convert(content, convertible) ⇒ String

Logic to do the Serbea content conversion.

Parameters:

  • content (String)

    Content of the file (without front matter).

Returns:

  • (String)

    The converted content.



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/serbea/bridgetown_support.rb', line 41

def convert(content, convertible)
  serb_view = Bridgetown::SerbeaView.new(convertible)

  serb_renderer = Tilt::SerbeaTemplate.new(convertible.relative_path) { 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