Object
Generates a list with all the languages of the page.
Return a list of all translations of the content page.
# File lib/webgen/tag/langbar.rb, line 16 16: def call(tag, body, context) 17: lang_nodes = all_lang_nodes(context.content_node) 18: (context.dest_node.node_info[:tag_langbar_data] ||= {})[context.content_node.acn] = lang_nodes.map {|n| n.alcn} 19: result = lang_nodes. 20: reject {|n| (context.content_node.lang == n.lang && !param('tag.langbar.show_own_lang'))}. 21: sort {|a, b| a.lang <=> b.lang}. 22: collect do |n| 23: attrs = {:link_text => (param('tag.langbar.lang_names')[n.lang] || n.lang), :lang => n.lang} 24: attrs['class'] = 'webgen-langbar-current-lang' if context.content_node.lang == n.lang 25: context.dest_node.link_to(n, attrs) 26: end.join(param('tag.langbar.separator')) 27: 28: [(param('tag.langbar.show_single_lang') || lang_nodes.length > 1 ? result : ""), param('tag.langbar.process_output')] 29: end
Return all nodes with the same absolute cn as node.
# File lib/webgen/tag/langbar.rb, line 36 36: def all_lang_nodes(node) 37: node.tree.node_access[:acn][node.acn] 38: end
Check if the langbar tag for node changed.
# File lib/webgen/tag/langbar.rb, line 41 41: def node_changed?(node) 42: return unless (cdata = node.node_info[:tag_langbar_data]) 43: cdata.each do |acn, clang_nodes| 44: lang_nodes = all_lang_nodes(node.tree[acn, :acn]) rescue nil 45: if !lang_nodes || lang_nodes.length != clang_nodes.length || 46: lang_nodes.any? {|n| n.meta_info_changed?} 47: node.flag(:dirty) 48: break 49: end 50: end 51: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.