Class | Tags::BreadcrumbTrailTag |
In: |
lib/webgen/plugins/tags/breadcrumbtrail.rb
|
Parent: | DefaultTag |
Generates a breadcrumb trail. It consists of all pages in the hierarchy of the current page.
For example, assuming we have the following branch
/directory1/directory2/currentFile
this plugin will generate something like this:
root / directory1 / directory2 / currentFile
where each listed name is linked to the corresponding file.
# File lib/webgen/plugins/tags/breadcrumbtrail.rb, line 48 48: def process_tag( tag, chain ) 49: out = [] 50: node = chain.last 51: 52: omitIndexFile = if node.meta_info.has_key?( 'omitIndexFileInBreadcrumbTrail' ) 53: node['omitIndexFileInBreadcrumbTrail'] 54: else 55: param( 'omitIndexFile' ) 56: end 57: omitIndexFile = omitIndexFile && node.parent['indexFile'] && 58: node.parent['indexFile'].node_for_lang( node['lang'] ) == node 59: 60: node = node.parent if omitIndexFile 61: 62: until node.nil? 63: out.push( node.link_from( chain.last, :context => { :caller => self.class.plugin_name } ) ) 64: node = node.parent 65: end 66: 67: out[0] = '' if param( 'omitLast' ) && !omitIndexFile 68: out = out.reverse.join( param( 'separator' ) ) 69: log(:debug) { "Breadcrumb trail for <#{chain.last.node_info[:src]}>: #{out}" } 70: out 71: end