Module: Awestruct::Extensions::Tagger::TagLinker

Defined in:
lib/awestruct/extensions/tagger.rb

Instance Method Summary collapse

Instance Method Details



21
22
23
24
25
26
27
28
# File 'lib/awestruct/extensions/tagger.rb', line 21

def tag_links(delimiter = ', ', style_class = nil)
  class_attr = (style_class ? ' class="' + style_class + '"' : '')
  tags.map do |tag|
    url = tag.primary_page.url
    url << '/' unless (url.include?('.htm') || url.end_with?('/'))
    %Q{<a#{class_attr} href="#{url}">#{tag}</a>}
  end.join(delimiter)
end