Class: Bridgetown::Converters::SlimTemplates
- Inherits:
-
Converter
- Object
- Converter
- Bridgetown::Converters::SlimTemplates
- Defined in:
- lib/bridgetown-slim/slim_templates.rb
Instance Method Summary collapse
-
#convert(content, convertible) ⇒ String
Logic to do the Slim content conversion.
- #matches(ext, convertible) ⇒ Object
- #output_ext(ext) ⇒ Object
Instance Method Details
#convert(content, convertible) ⇒ String
Logic to do the Slim content conversion.
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/bridgetown-slim/slim_templates.rb', line 31 def convert(content, convertible) slim_view = Bridgetown::SlimView.new(convertible) slim_renderer = Slim::Template.new(convertible.relative_path) { content } if convertible.is_a?(Bridgetown::Layout) slim_renderer.render(slim_view) do convertible.current_document_output end else slim_renderer.render(slim_view) end end |
#matches(ext, convertible) ⇒ Object
45 46 47 48 49 |
# File 'lib/bridgetown-slim/slim_templates.rb', line 45 def matches(ext, convertible) return true if convertible.data[:template_engine] == "slim" super(ext) end |
#output_ext(ext) ⇒ Object
51 52 53 |
# File 'lib/bridgetown-slim/slim_templates.rb', line 51 def output_ext(ext) ext == ".slim" ? ".html" : ext end |