# All files in the 'lib' directory will be loaded # before nanoc starts compiling. # module Tags def tags if @item[:tags].nil? return '' end @item[:tags].join(', ') end def alltags language=@item.path language =~ %r{/Scratch/([^/]*)/} language = $1 @items.select {|p| p.path =~ %r{/Scratch/#{language}/} and p[:kind].to_s == "article" and p.parent[:kind].to_s == 'blog'} end def tagNumber tags={} alltags.each do |p| if p[:tags].nil? next end p[:tags].each do |t| if tags[t] tags[t]+=1 else tags[t]=1 end end end return tags end def tagRefs tagLinks={} alltags.each do |p| if p[:tags].nil? next end p[:tags].each do |t| if tagLinks[t].nil? tagLinks[t]=[ p ] else tagLinks[t] <<= p end end end return tagLinks end def tagCloud(minval=0) tags=tagNumber.reject { |k,v| v $(document).ready( function(){$('.list').hide();} ); function tagSelected(id) { $('.list').hide(); $('#'+id).fadeIn(); $('.tag.selected').removeClass('selected'); $('#tag_'+id).addClass('selected'); }
} tagSize.sort{|a,b| a[0].downcase <=> b[0].downcase}.each do |t,s| protected=t.gsub(/\W/,'_') grouped=t.gsub(/&/,'&').gsub(/ /,' ').gsub(//,'>') tagCloud <<= %{#{grouped} } end tagCloud <<= %{
} language=@item.path language =~ %r{/Scratch/([^/]*)/} language = $1 tagLinks.sort{|a,b| a[0].downcase <=> b[0].downcase}.each do |t,l| protected=t.gsub(/\W/,'_') tagCloud <<= %{

#{t}

    } l.sort{|x,y| y[:created_at] <=> x[:created_at]}.each do |p| tagCloud <<= %{
  • #{calendar_for(p[:created_at], language)} #{p[:title]}
  • \n} end tagCloud <<= %{
} end tagCloud <<= %{
} return tagCloud end # end