Class: Frontman::SlimRenderer

Inherits:
Renderer
  • Object
show all
Defined in:
lib/frontman/renderers/slim_renderer.rb

Instance Method Summary collapse

Methods inherited from Renderer

#render

Constructor Details

#initializeSlimRenderer

Returns a new instance of SlimRenderer.



9
10
11
12
13
14
15
16
17
18
# File 'lib/frontman/renderers/slim_renderer.rb', line 9

def initialize
  Slim::Engine.set_options(
    pretty: true,
    buffer: :@_slim_buffer,
    sort_attrs: false,
    disable_escape: true
  )

  super
end

Instance Method Details

#compile(layout) ⇒ Object



20
21
22
23
24
# File 'lib/frontman/renderers/slim_renderer.rb', line 20

def compile(layout)
  Slim::Template.new(nil) do
    layout
  end
end

#render_content(compiled, content, scope, _data) ⇒ Object



26
27
28
# File 'lib/frontman/renderers/slim_renderer.rb', line 26

def render_content(compiled, content, scope, _data)
  compiled.render(scope) { content }
end