Class Webgen::Tag::BreadcrumbTrail
In: lib/webgen/tag/breadcrumbtrail.rb
Parent: Object
Error RenderError CommandNotFoundError LoadError NodeCreationError ::Rake::TaskLib WebgenTask Node Context\n[lib/webgen/context.rb\nlib/webgen/context/nodes.rb\nlib/webgen/context/render.rb\nlib/webgen/context/tags.rb] Tree FileSystem Sitemap Feed Copy Virtual Sitemap Directory Page Fragment Template Memory Metainfo Coderay Sitemap IncludeFile BreadcrumbTrail Langbar TikZ Menu Tags Fragments Resource Website Tidy Head Less Kramdown Xmllint Blocks Helpers Configuration Comparable Language Path StandardError CmdParse::CommandParser CommandParser CmdParse::Command RunCommand CreateCommand WebguiCommand ApplyCommand WebsiteAccess Main Loggable OutputPathHelpers ExecuteCommand Link Date Relocatable Metainfo ::Kramdown::Converter::Html KramdownHtmlConverter Cache Blackboard WebsiteManager Logger Page ProxyNode Utils Scss RDoc Sass Erb RDiscount Erubis Haml Maruku Builder RedCloth AccessHash TarArchive Stacked FileSystem lib/webgen/cache.rb lib/webgen/error.rb lib/webgen/languages.rb lib/webgen/website.rb lib/webgen/blackboard.rb lib/webgen/tree.rb lib/webgen/websitemanager.rb lib/webgen/logger.rb lib/webgen/context/tags.rb lib/webgen/configuration.rb lib/webgen/path.rb lib/webgen/webgentask.rb lib/webgen/page.rb lib/webgen/node.rb lib/webgen/cli/run_command.rb lib/webgen/cli/utils.rb lib/webgen/cli/apply_command.rb lib/webgen/cli/webgui_command.rb lib/webgen/cli.rb lib/webgen/cli/create_command.rb Color CLI ClassMethods WebsiteAccess LanguageManager lib/webgen/output/filesystem.rb Output lib/webgen/common/sitemap.rb Common lib/webgen/sourcehandler/metainfo.rb lib/webgen/sourcehandler/memory.rb lib/webgen/sourcehandler/copy.rb lib/webgen/sourcehandler/directory.rb lib/webgen/sourcehandler.rb lib/webgen/sourcehandler/page.rb lib/webgen/sourcehandler/template.rb lib/webgen/sourcehandler/fragment.rb lib/webgen/sourcehandler/sitemap.rb lib/webgen/sourcehandler/virtual.rb lib/webgen/sourcehandler/feed.rb OutputPathHelpers Base SourceHandler lib/webgen/tag/coderay.rb lib/webgen/tag/relocatable.rb lib/webgen/tag/menu.rb lib/webgen/tag/langbar.rb lib/webgen/tag/executecommand.rb lib/webgen/tag/breadcrumbtrail.rb lib/webgen/tag/metainfo.rb lib/webgen/tag/link.rb lib/webgen/tag/includefile.rb lib/webgen/tag/date.rb lib/webgen/tag/tikz.rb lib/webgen/tag/sitemap.rb Base Tag lib/webgen/contentprocessor/less.rb lib/webgen/contentprocessor/scss.rb lib/webgen/contentprocessor/blocks.rb lib/webgen/contentprocessor/rdoc.rb lib/webgen/contentprocessor/sass.rb lib/webgen/contentprocessor/erb.rb lib/webgen/contentprocessor/rdiscount.rb lib/webgen/contentprocessor/tags.rb lib/webgen/contentprocessor/erubis.rb lib/webgen/contentprocessor/kramdown/html.rb lib/webgen/contentprocessor/haml.rb lib/webgen/contentprocessor/maruku.rb lib/webgen/contentprocessor/xmllint.rb lib/webgen/contentprocessor/kramdown.rb lib/webgen/contentprocessor/head.rb lib/webgen/contentprocessor/builder.rb lib/webgen/contentprocessor/tidy.rb lib/webgen/contentprocessor/redcloth.rb lib/webgen/contentprocessor/fragments.rb lib/webgen/contentprocessor.rb ContentProcessor lib/webgen/source/tararchive.rb lib/webgen/source/stacked.rb lib/webgen/source/resource.rb lib/webgen/source/filesystem.rb Source Loggable Webgen dot/m_81_0.png

Generates a breadcrumb trail for the page. This is especially useful when pages are in deep hierarchies of directories.

Methods

Included Modules

Webgen::WebsiteAccess Base

Public Instance methods

Create the breadcrumb trail.

[Source]

    # File lib/webgen/tag/breadcrumbtrail.rb, line 17
17:     def call(tag, body, context)
18:       out = breadcrumb_trail_list(context.content_node)
19:       (context.dest_node.node_info[:tag_breadcrumb_trail] ||= {})[[@params.to_a.sort, context.content_node.alcn]] = out.map {|n| n.alcn}
20:       out = out.map {|n| context.dest_node.link_to(n, :lang => context.content_node.lang) }.
21:         join(param('tag.breadcrumbtrail.separator'))
22:       log(:debug) { "Breadcrumb trail for <#{context.content_node}>: #{out}" }
23:       out
24:     end

Private Instance methods

Return the list of nodes that make up the breadcrumb trail of node according to the current parameters.

[Source]

    # File lib/webgen/tag/breadcrumbtrail.rb, line 32
32:     def breadcrumb_trail_list(node)
33:       list = []
34:       omit_index_path = if node.meta_info.has_key?('omit_index_path')
35:                           node['omit_index_path']
36:                         else
37:                           param('tag.breadcrumbtrail.omit_index_path')
38:                         end
39:       omit_index_path = omit_index_path && node.parent.routing_node(node.lang) == node
40: 
41:       node = node.parent if omit_index_path
42: 
43:       until node == node.tree.dummy_root
44:         list.unshift(node)
45:         node = node.parent
46:       end
47:       list[param('tag.breadcrumbtrail.start_level')..param('tag.breadcrumbtrail.end_level')].to_a
48:     end

Check if the breadcrumb trails for node have changed.

[Source]

    # File lib/webgen/tag/breadcrumbtrail.rb, line 51
51:     def node_changed?(node)
52:       return if !node.node_info[:tag_breadcrumb_trail]
53: 
54:       node.node_info[:tag_breadcrumb_trail].each do |(params, cn_alcn), cached_list|
55:         cn = node.tree[cn_alcn]
56:         set_params(params.to_hash)
57:         list = breadcrumb_trail_list(cn)
58:         set_params({})
59: 
60:         if (list.map {|n| n.alcn} != cached_list) ||
61:             list.any? {|n| (r = n.routing_node(cn.lang)) && r != node && r.meta_info_changed?}
62:           node.flag(:dirty)
63:           break
64:         end
65:       end
66:     end

[Validate]