lib/nanoc/toolbox/helpers/tagging_extra.rb
# Creates in-memory tag pages from tags of the passed items or form all items
#
# @param [Array<Item>] item the item from which to extract tags
# @param [Item] options the options for the item to be created
# @option options [String] :tag_pattern ("%%tag%%") The pattern to be replace by the tag name
# @option options [String] :title ("options[:tag_pattern]") The text that will be in the link
# @option options [String] :identifier ("/tags/option[:tag_pattern]") The item identifer
# @option options [String] :template ("tag") The template/layout to use to render the tag
Creates in-memory tag pages from tags of the passed items or form all items
Creates in - memory tag pages from tags of the passed items or form all items
def create_tag_pages(items=nil, options={})
      options[:tag_pattern]     ||= "%%tag%%"
      options[:title]           ||= options[:tag_pattern]
      options[:identifier]      ||= "/tags/#{options[:tag_pattern]}/"
      options[:template]        ||= "tag"
      tag_set(items).each do |tagname|
        raw_content = "<%= render('#{options[:template]}', :tag => '#{tagname}') %>"
        attributes  = { :title => options[:title].gsub(options[:tag_pattern], tagname) }
        identifier  = options[:identifier].gsub(options[:tag_pattern], tagname)
        @items << Nanoc::Item.new(raw_content, attributes, identifier, :binary => false)
      end
    end
def create_tag_pages ( items = nil , options = { } ) options [ :tag_pattern ] ||= "%%tag%%" options [ :title ] ||= options [ :tag_pattern ] options [ :identifier ] ||= "/tags/#{options[:tag_pattern]}/" options [ :template ] ||= "tag" tag_set ( items ) . each do | tagname | raw_content = "<%= render('#{options[:template]}', :tag => '#{tagname}') %>" attributes = { :title => options [ :title ] . gsub ( options [ :tag_pattern ] , tagname ) } identifier = options [ :identifier ] . gsub ( options [ :tag_pattern ] , tagname ) @items << Nanoc :: Item . new ( raw_content , attributes , identifier , :binary => false ) end end
Creates in-memory tag pages from tags of the passed items or form all items
Creates in - memory tag pages from tags of the passed items or form all items
items
options
:template ("tag") The template/layout to use to render the tag
: template ( " tag " ) The template / layout to use to render the tag
options the options for the item to be created
options the options for the item to be created