Class: Bridgetown::Converters::SerbeaTemplates
- Inherits:
-
Converter
- Object
- Converter
- Bridgetown::Converters::SerbeaTemplates
- Defined in:
- lib/serbea/bridgetown_support.rb
Instance Method Summary collapse
-
#convert(content, convertible) ⇒ String
Logic to do the Serbea content conversion.
- #matches(ext, convertible) ⇒ Object
- #output_ext(ext) ⇒ Object
Instance Method Details
#convert(content, convertible) ⇒ String
Logic to do the Serbea content conversion.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/serbea/bridgetown_support.rb', line 34 def convert(content, convertible) return content if convertible.data[:template_engine] != "serbea" 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 |
#matches(ext, convertible) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/serbea/bridgetown_support.rb', line 50 def matches(ext, convertible) if convertible.data[:template_engine] == "serbea" || (convertible.data[:template_engine].nil? && @config[:template_engine] == "serbea") convertible.data[:template_engine] = "serbea" return true end super(ext).tap do |ext_matches| convertible.data[:template_engine] = "serbea" if ext_matches end end |
#output_ext(ext) ⇒ Object
63 64 65 |
# File 'lib/serbea/bridgetown_support.rb', line 63 def output_ext(ext) ext == ".serb" ? ".html" : ext end |