Class: Laze::Renderers::PageRenderer

Inherits:
Renderer
  • Object
show all
Defined in:
lib/laze/renderers/page_renderer.rb

Overview

Renders Page objects to an HTML page. This means applying text filters, layouts and the Liquid templating engine to a source file and returning the full HTML result file.

Instance Method Summary collapse

Constructor Details

#initialize(page) ⇒ PageRenderer

:nodoc:

Raises:

  • (ArgumentError)


7
8
9
10
# File 'lib/laze/renderers/page_renderer.rb', line 7

def initialize(page) #:nodoc:
  raise ArgumentError unless page.is_a?(Page)
  super(page.filtered_content, page.properties)
end

Instance Method Details

#render(locals = {}) ⇒ Object

Apply layouts and the liquid templating language.



13
14
15
# File 'lib/laze/renderers/page_renderer.rb', line 13

def render(locals = {})
  liquify(wrap_in_layout(string), (options[:locals] || {}).merge(locals))
end