class Jekyll::Tags::ToolTag

The tool tag which allows us to do fancy tool links

Public Class Methods

Calls superclass method
# File _plugins/jekyll-tool-tag.rb, line 24
def initialize(tag_name, text, tokens)
  super
  @text = text.strip
end

Public Instance Methods

{% tool %} - the Tool rendering tag

The first part should be any text, the last should be the tool_id/tool_version

Examples:

{% tool Group on Column %}
{% tool [Group on Column](Grouping1) %}
{% tool [Group on Column](Grouping1/1.0.0) %}
{% tool [Group on Column](toolshed.g2.bx.psu.edu/repos/devteam/fastqc/fastqc/0.72+galaxy1) %}
# File _plugins/jekyll-tool-tag.rb, line 40
def render(context)
  format = /\[(.*)\]\((.*)\)/


  m = @text.match(format)

  if m
    # check if a variable was provided for the tool id
    tool = context[m[2].tr('{}', '')] || m[2]
    version = tool.split('/').last

    if tool.count('/').zero?
      "<span class=\"tool\" data-tool=\"#{tool}\" title=\"#{m[1]} tool\" aria-role=\"button\">" \
        '<i class="fas fa-wrench" aria-hidden="true"></i> ' \
        "<strong>#{m[1]}</strong>" \
        '</span>'
    else
      "<span class=\"tool\" data-tool=\"#{tool}\" title=\"#{m[1]} tool\" aria-role=\"button\">" \
        '<i class="fas fa-wrench" aria-hidden="true"></i> ' \
        "<strong>#{m[1]}</strong> " \
        '(' \
        '<i class="fas fa-cubes" aria-hidden="true"></i> ' \
        "Galaxy version #{version}" \
        ')' \
        '</span>'
    end
  else
    %(<span><strong>#{@text}</strong> <i class="fas fa-wrench" aria-hidden="true"></i></span>)
  end
end