Sha256: 27e4326336632336cfb0324879afe0e3656587de547d05d10cf0e961eb7d581b

Contents?: true

Size: 915 Bytes

Versions: 15

Compression:

Stored size: 915 Bytes

Contents

# -*- encoding: utf-8 -*-

module Webgen::ContentProcessor

  # Uses the HTML headers h1, h2, ..., h6 to generate nested fragment nodes.
  class Fragments

    include Webgen::WebsiteAccess

    # Generate the nested fragment nodes from <tt>context.content</tt> under
    # <tt>content.content_node</tt> but only if there is no associated <tt>:block</tt> data in
    # +context+ or the block is named +content+.
    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

  end

end

Version data entries

15 entries across 15 versions & 3 rubygems

Version Path
gettalong-webgen-0.5.7.20090227 lib/webgen/contentprocessor/fragments.rb
gettalong-webgen-0.5.8.20090507 lib/webgen/contentprocessor/fragments.rb
gettalong-webgen-0.5.9.20090620 lib/webgen/contentprocessor/fragments.rb
gettalong-webgen-0.5.9.20090626 lib/webgen/contentprocessor/fragments.rb
thewoolleyman-webgen-0.5.8.20090419 lib/webgen/contentprocessor/fragments.rb
webgen-0.5.17 lib/webgen/contentprocessor/fragments.rb
webgen-0.5.15 lib/webgen/contentprocessor/fragments.rb
webgen-0.5.14 lib/webgen/contentprocessor/fragments.rb
webgen-0.5.13 lib/webgen/contentprocessor/fragments.rb
webgen-0.5.12 lib/webgen/contentprocessor/fragments.rb
webgen-0.5.11 lib/webgen/contentprocessor/fragments.rb
webgen-0.5.10 lib/webgen/contentprocessor/fragments.rb
webgen-0.5.9 lib/webgen/contentprocessor/fragments.rb
webgen-0.5.7 lib/webgen/contentprocessor/fragments.rb
webgen-0.5.8 lib/webgen/contentprocessor/fragments.rb