class Jekyll::ToolTag
The tool tag which allows us to do fancy tool links
Public Class Methods
new(tag_name, text, tokens)
click to toggle source
Calls superclass method
# File _plugins/jekyll-tool-tag.rb, line 6 def initialize(tag_name, text, tokens) super @text = text.strip end
Public Instance Methods
render(context)
click to toggle source
# File _plugins/jekyll-tool-tag.rb, line 11 def render(context) format = /\[(.*)\]\((.*)\)/ # The first part should be any text, the last should be the tool_id/tool_version # {% 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) %} 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