Class: Mullet::HTML::Layout
- Inherits:
-
Object
- Object
- Mullet::HTML::Layout
- Defined in:
- lib/mullet/html/layout.rb
Overview
Extracts content from an HTML page and renders it in a layout. The layout is a template given these variables:
‘title` : content of the `title` element from the page `body` : content of the `body` element from the page
The ‘body` variable typically contains HTML markup, so the layout must use the `data-escape-xml=“false”` command to prevent markup characters being escaped when rendering the variable.
Instance Method Summary collapse
-
#execute(page_html, output) ⇒ Object
Renders page data in a layout.
-
#initialize(template) ⇒ Layout
constructor
Constructor.
Constructor Details
#initialize(template) ⇒ Layout
Constructor
23 24 25 |
# File 'lib/mullet/html/layout.rb', line 23 def initialize(template) @template = template end |
Instance Method Details
#execute(page_html, output) ⇒ Object
Renders page data in a layout.
33 34 35 36 |
# File 'lib/mullet/html/layout.rb', line 33 def execute(page_html, output) page = parse_page(page_html) @template.execute(page, output) end |