Skip to content

Commit

Permalink
Merge pull request #3 from ELIXIR-Belgium/more-forgiving
Browse files Browse the repository at this point in the history
Strip id to make the snippet more forgiving
  • Loading branch information
bedroesb authored Jun 20, 2023
2 parents 35f3b57 + 2d23eb2 commit c4abf65
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
37 changes: 19 additions & 18 deletions lib/elixir-toolkit-theme-plugins/tool_tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,48 +17,49 @@ def load_tools

def render(context)
tool = find_tool(context[@content.strip])
if tool["registry"]
tags = create_tags(tool["registry"])
end
tags = create_tags(tool)
%Q{<a
tabindex="0"
class="tool"
aria-description="#{tool["description"]}"
data-bs-toggle="popover"
data-bs-placement="bottom"
data-bs-trigger="focus"
data-bs-content="<h5>#{tool["name"]}</h5><div class='mb-2'>#{tool["description"]}</div><a href='#{tool["url"]} class='mt-2 me-2' 'target='_blank'><span class='badge bg-dark text-white hover-primary'><i class='fa-solid fa-link me-2'></i>Website</span></a>#{tags}"
data-bs-content="<h5>#{tool["name"]}</h5><div class='mb-2'>#{tool["description"]}</div>#{tags}"
data-bs-template="<div class='popover popover-tool' role='tooltip'><div class='popover-arrow'></div><h3 class='popover-header'></h3><div class='popover-body'></div></div>"
data-bs-html="true"
><i class="fa-solid fa-wrench me-2"></i>#{ tool["name"] }</a>}
end

def find_tool(tool_id)
tool = @tools.find { |t| t["id"] == tool_id }
tool = @tools.find { |t| t["id"] == tool_id.strip }
return tool if tool

raise Exception.new "Undefined tool ID: #{tool_id}"
end

def create_tags(registry)
def create_tags(tool)
tags = ""
tags << create_tag("#{tool["url"]}", "fa-link", "Website")
if tool["registry"]
registry = tool["registry"]

if registry["biotools"]
tags << create_tag("https://bio.tools/#{registry["biotools"]}", "fa-info", "Tool info")
end
if registry["biotools"]
tags << create_tag("https://bio.tools/#{registry["biotools"]}", "fa-info", "Tool info")
end

if registry["fairsharing"]
tags << create_tag("https://fairsharing.org/FAIRsharing.#{registry["fairsharing"]}", "fa-database", "Standards/Databases")
end
if registry["fairsharing"]
tags << create_tag("https://fairsharing.org/FAIRsharing.#{registry["fairsharing"]}", "fa-database", "Standards/Databases")
end

if registry["fairsharing-coll"]
tags << create_tag("https://fairsharing.org/#{registry["fairsharing-coll"]}", "fa-database", "Standards/Databases")
end
if registry["fairsharing-coll"]
tags << create_tag("https://fairsharing.org/#{registry["fairsharing-coll"]}", "fa-database", "Standards/Databases")
end

if registry["tess"]
tags << create_tag("https://tess.elixir-europe.org/search?q=#{registry["tess"]}", "fa-graduation-cap", "Training")
if registry["tess"]
tags << create_tag("https://tess.elixir-europe.org/search?q=#{registry["tess"]}", "fa-graduation-cap", "Training")
end
end

tags
end

Expand Down
2 changes: 1 addition & 1 deletion lib/elixir-toolkit-theme-plugins/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Jekyll
class Ett
VERSION = '0.1.5'
VERSION = '0.1.6'
end
end

0 comments on commit c4abf65

Please sign in to comment.