module Webgen::Tag::MetaInfo
Provides easy access to the meta information of a node.
Public Class Methods
call(tag, body, context)
click to toggle source
Treat tag
as a meta information key and return its value from the content node.
# File lib/webgen/tag/meta_info.rb 10 def self.call(tag, body, context) 11 tag = context[:config]['tag.meta_info.mi'] if tag == 'meta_info' 12 output = '' 13 if tag == 'lang' 14 output = context.content_node.lang 15 elsif context.content_node[tag] 16 output = context.content_node[tag].to_s 17 output = CGI::escapeHTML(output) if context[:config]['tag.meta_info.escape_html'] 18 else 19 context.website.logger.error do 20 ["No meta info key '#{tag}' found in <#{context.content_node}> (referenced in <#{context.ref_node}>)", 21 "Add the meta info key '#{tag}' to <#{context.content_node}> or remove the" + 22 " reference in <#{context.ref_node}> to fix this error."] 23 end 24 end 25 output 26 end