Sha256: a229fc9235b86e8bcf0890509c289e6295850cfc03765c33a1b1b24e97d2276c

Contents?: true

Size: 692 Bytes

Versions: 5

Compression:

Stored size: 692 Bytes

Contents

# -*- encoding: utf-8 -*-
require 'cgi'

module Webgen::Tag

  # Provides easy access to the meta information of a node.
  class Metainfo

    include Base

    # Return the meta information key specified in +tag+ of the content node.
    def call(tag, body, context)
      output = ''
      if tag == 'lang'
        output = context.content_node.lang
      elsif context.content_node[tag]
        output = context.content_node[tag].to_s
        output = CGI::escapeHTML(output) if param('tag.metainfo.escape_html')
      else
        log(:error) { "No value for meta info key '#{tag}' in <#{context.ref_node}> found in <#{context.content_node}>" }
      end
      output
    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
webgen-0.5.17 lib/webgen/tag/metainfo.rb
webgen-0.5.15 lib/webgen/tag/metainfo.rb
webgen-0.5.14 lib/webgen/tag/metainfo.rb
webgen-0.5.13 lib/webgen/tag/metainfo.rb
webgen-0.5.12 lib/webgen/tag/metainfo.rb