Class: Bridgetown::Converters::ERBTemplates
- Inherits:
-
Bridgetown::Converter
- Object
- Plugin
- Bridgetown::Converter
- Bridgetown::Converters::ERBTemplates
- Defined in:
- bridgetown-core/lib/bridgetown-core/converters/erb_templates.rb
Instance Method Summary collapse
-
#convert(content, convertible) ⇒ String
Logic to do the ERB content conversion.
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
Methods included from Prioritizable
Constructor Details
This class inherits a constructor from Bridgetown::Converter
Instance Method Details
#convert(content, convertible) ⇒ String
Logic to do the ERB content conversion.
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'bridgetown-core/lib/bridgetown-core/converters/erb_templates.rb', line 119 def convert(content, convertible) erb_view = Bridgetown::ERBView.new(convertible) erb_renderer = convertible.site.tmp_cache["erb-tmpl:#{convertible.path}:#{content.hash}"] ||= Tilt::ErubiTemplate.new( convertible.path, line_start(convertible), outvar: "@_erbout", bufval: "Bridgetown::OutputBuffer.new", engine_class: ERBEngine ) do content end if convertible.is_a?(Bridgetown::Layout) erb_renderer.render(erb_view) do convertible.current_document_output.html_safe end else erb_renderer.render(erb_view) end end |