Sha256: 5ec98a5a0a70d13a78e2b40290e47e6c2f595bdcb55aaa68ddb16a678c4da673
Contents?: true
Size: 1.92 KB
Versions: 14
Compression:
Stored size: 1.92 KB
Contents
--- name:tag.langbar pipeline:ruby ------------------------------------------------------------------ context.content = context[:nodes].map do |node| attrs = {'link_text' => context[:config]['tag.langbar.mapping'][node.lang] || node.lang} attrs['class'] = 'webgen-langbar-current-lang' if context.content_node.lang == node.lang context.dest_node.link_to(node, node.lang, attrs) end.join(context[:config]['tag.langbar.separator']) --- name:tag.breadcrumb_trail pipeline:ruby -------------------------------------------------------- context.content = context[:nodes].map do |node| context.dest_node.link_to(node, context.dest_node.lang) end.join(context[:config]['tag.breadcrumb_trail.separator']) --- name:tag.menu pipeline:ruby -------------------------------------------------------------------- start_tag = "<ul" start_tag << " class=\"#{context[:config]['tag.menu.css_class']}\"" if context[:config]['tag.menu.css_class'] start_tag << ">" nested_list = lambda do |nodes, level| out = (level == 1 ? start_tag.dup : "<ul>") nodes.each do |node, children| menu = (children ? nested_list.call(children, level + 1) : '') style, link = Webgen::Tag::Menu.menu_item_details(context.dest_node, node, context.content_node.lang, level, !children.nil?, context[:config]) out << "<li #{style}>#{link}" out << menu out << "</li>" end out << "</ul>" out end flat_list = lambda do |nodes, level| submenu = '' out = (level == 1 ? start_tag.dup : "<ul>") nodes.each do |node, children| submenu << (children ? flat_list.call(children, level + 1) : '') style, link = Webgen::Tag::Menu.menu_item_details(context.dest_node, node, context.content_node.lang, level, !children.nil?, context[:config]) out << "<li #{style}>#{link}</li>" end out << "</ul>" << submenu out end generator = (context[:config]['tag.menu.style'] == 'nested' ? nested_list : flat_list) context.content = generator.call(context[:nodes], 1)
Version data entries
14 entries across 14 versions & 1 rubygems