module Webgen::Tag::Link
Create a link to a given (A)LCN.
Public Class Methods
call(tag, body, context)
click to toggle source
Return an HTML link to the given (A)LCN.
# File lib/webgen/tag/link.rb 9 def self.call(tag, body, context) 10 path = context[:config]['tag.link.path'].to_s 11 if (dest_node = context.ref_node.resolve(path, context.dest_node.lang, true)) 12 context.website.ext.item_tracker.add(context.dest_node, :node_meta_info, dest_node) 13 context.dest_node.link_to(dest_node, context.content_node.lang, context[:config]['tag.link.attr']) 14 else 15 '' 16 end 17 rescue URI::InvalidURIError => e 18 raise Webgen::RenderError.new("Error while parsing path '#{path}': #{e.message}", 19 "tag.#{tag}", context.dest_node, context.ref_node) 20 end