Class: Webgen::PathHandler::Page

Inherits:
Object
  • Object
show all
Includes:
Base, PageUtils
Defined in:
lib/webgen/path_handler/page.rb

Overview

Path handler for handling content files in Webgen Page Format.

Constant Summary

Constants included from Base

Base::DEST_PATH_PARENT_SEGMENTS, Base::DEST_PATH_SEGMENTS

Instance Method Summary collapse

Methods included from PageUtils

#create_node, #parse_meta_info!

Methods included from Base

#initialize, #parse_meta_info!

Instance Method Details

#content(node) ⇒ Object

Render the content of the given page node.



25
26
27
28
29
# File 'lib/webgen/path_handler/page.rb', line 25

def content(node)
  @website.ext.item_tracker.add(node, :template_chain, node)
  chain = node.template_chain << node
  chain.first.render_block('content', Webgen::Context.new(@website, :chain => chain)).content
end

#create_nodes(path, blocks) ⇒ Object

Create a page file from path.



16
17
18
19
20
21
22
# File 'lib/webgen/path_handler/page.rb', line 16

def create_nodes(path, blocks)
  path.meta_info['lang'] ||= @website.config['website.lang']
  path.ext = 'html' if path.ext == 'page'
  create_node(path) do |node|
    set_blocks(node, blocks)
  end
end