Sha256: 8a17d0c8d7deef3cf136c9a036db8774d8502f3def3c8797f9540f7d356bf774

Contents?: true

Size: 828 Bytes

Versions: 16

Compression:

Stored size: 828 Bytes

Contents

# -*- encoding: utf-8 -*-

module Webgen
  class Tag

    # Create a link to a given (A)LCN.
    module Link

      # Return an HTML link to the given (A)LCN.
      def self.call(tag, body, context)
        path = context[:config]['tag.link.path'].to_s
        if (dest_node = context.ref_node.resolve(path, context.dest_node.lang, true))
          context.website.ext.item_tracker.add(context.dest_node, :node_meta_info, dest_node)
          context.dest_node.link_to(dest_node, context.content_node.lang, context[:config]['tag.link.attr'])
        else
          ''
        end
      rescue URI::InvalidURIError => e
        raise Webgen::RenderError.new("Error while parsing path '#{path}': #{e.message}",
                                      "tag.#{tag}", context.dest_node, context.ref_node)
      end

    end

  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
webgen-1.7.3 lib/webgen/tag/link.rb
webgen-1.7.2 lib/webgen/tag/link.rb
webgen-1.7.1 lib/webgen/tag/link.rb
webgen-1.7.0 lib/webgen/tag/link.rb
webgen-1.6.0 lib/webgen/tag/link.rb
webgen-1.5.2 lib/webgen/tag/link.rb
webgen-1.5.1 lib/webgen/tag/link.rb
webgen-1.5.0 lib/webgen/tag/link.rb
webgen-1.4.1 lib/webgen/tag/link.rb
webgen-1.4.0 lib/webgen/tag/link.rb
webgen-1.3.0 lib/webgen/tag/link.rb
webgen-1.2.1 lib/webgen/tag/link.rb
webgen-1.2.0 lib/webgen/tag/link.rb
webgen-1.1.0 lib/webgen/tag/link.rb
webgen-1.0.0 lib/webgen/tag/link.rb
webgen-1.0.0.beta3 lib/webgen/tag/link.rb