Sha256: 797e321218a310cf2385eb3289fc42591cec65ab7fc480cf3eaf75eca56773aa
Contents?: true
Size: 939 Bytes
Versions: 12
Compression:
Stored size: 939 Bytes
Contents
module Awestruct module Extensions class TagCloud def initialize(tagged_items_property, output_path='tags', opts={}) @tagged_items_property = tagged_items_property @output_path = output_path @layout = opts[:layout].to_s @title = opts[:title] || 'Tags' @template = opts[:template] || File.join( File.dirname( __FILE__ ), 'tag_cloud.html.haml' ) end def execute(site) page = site.engine.load_page( @template ) page.output_path = File.join( @output_path ) page.layout = @layout page.title = @title page.tags = site.send( "#{@tagged_items_property}_tags" ) || [] site.pages << page site.send( "#{@tagged_items_property}_tag_cloud=", LazyPage.new( page ) ) end end class LazyPage def initialize(page) @page = page end def to_s @page.content end end end end
Version data entries
12 entries across 12 versions & 1 rubygems