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, helper_delimiters, #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.
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
# File 'bridgetown-core/lib/bridgetown-core/converters/erb_templates.rb', line 167 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 |