Class: Webgen::ContentProcessor::Fragments

Inherits:
Object
  • Object
show all
Includes:
WebsiteAccess
Defined in:
lib/webgen/contentprocessor/fragments.rb

Overview

Uses the HTML headers h1, h2, …, h6 to generate nested fragment nodes.

Instance Method Summary collapse

Methods included from WebsiteAccess

included, website

Instance Method Details

#call(context) ⇒ Object

Generate the nested fragment nodes from context.content under content.content_node but only if there is no associated :block data in context or the block is named content.



13
14
15
16
17
18
19
20
21
# File 'lib/webgen/contentprocessor/fragments.rb', line 13

def call(context)
  if !context[:block] || context[:block].name == 'content'
    sections = website.blackboard.invoke(:parse_html_headers, context.content)
    website.blackboard.invoke(:create_fragment_nodes, sections, context.content_node,
                              website.blackboard.invoke(:source_paths)[context.content_node.node_info[:src]],
                              context.content_node.meta_info['fragments_in_menu'])
  end
  context
end