Method: HTMLPage#initialize

Defined in:
lib/html_page.rb

#initialize(content_filename, layout_filename = nil) ⇒ HTMLPage

Compile an HTML page from the content_filename and layout_filename sources.

Content files must be markdown or embedded ruby and have an “md” or “erb” extension. If markdown, content is first evaluated as Erb. Layouts files must be “erb”. The content renders within the layout template if specified.

Attributes specified in the preamble of the content file will be set in page and are available to layout and embedded templates.



25
26
27
28
29
# File 'lib/html_page.rb', line 25

def initialize(content_filename, layout_filename = nil)
  @content_filename = content_filename
  @layout_filename  = layout_filename&.delete_prefix(TEMPLATES_DIR)
  @page = PageAttributes.new
end