class Octopress::Ink::Tags::CategoryTag
Public Class Methods
new(tag, input, tokens)
click to toggle source
Calls superclass method
# File lib/octopress-ink/tags/category_tag.rb, line 5 def initialize(tag, input, tokens) super @tag = tag if !input.nil? @input = input.strip end end
Public Instance Methods
item_link(page, item)
click to toggle source
# File lib/octopress-ink/tags/category_tag.rb, line 65 def item_link(page, item) if dir = Bootstrap.send(item_name, item, page['lang']) path = File.join(@context['site']['baseurl'] || '', dir) %Q{<a class="#{item_name}-link" href="#{path}">#{item.capitalize}</a>} end end
item_list?()
click to toggle source
# File lib/octopress-ink/tags/category_tag.rb, line 53 def item_list? @tag.end_with? '_list' end
item_name()
click to toggle source
# File lib/octopress-ink/tags/category_tag.rb, line 57 def item_name @tag.match('tag') ? 'tag' : 'category' end
item_name_plural()
click to toggle source
# File lib/octopress-ink/tags/category_tag.rb, line 61 def item_name_plural @tag.match('tag') ? 'tags' : 'categories' end
render(context)
click to toggle source
# File lib/octopress-ink/tags/category_tag.rb, line 13 def render(context) @context = context # Check to see if post loop is active, otherwise default to current page page = context['post'] || context['page'] tags = Bootstrap.send(@tag)[page['url']] if tags.nil? if tags = item_tags(page) # Cache tags to speed up multiple references for the same post Bootstrap.send(@tag)[page['url']] = tags end end tags end