diff --git a/lib/elixir-toolkit-theme-plugins/tool_tag.rb b/lib/elixir-toolkit-theme-plugins/tool_tag.rb index 11e1ea7..a0f8b6b 100644 --- a/lib/elixir-toolkit-theme-plugins/tool_tag.rb +++ b/lib/elixir-toolkit-theme-plugins/tool_tag.rb @@ -17,20 +17,20 @@ def load_tools def render(context) tool = find_tool(context[@content.strip]) - if tool["registry"] - tags = create_tags(tool["registry"]) - end - %Q{
#{tool["description"]}
Website#{tags}" - data-bs-template="" - data-bs-html="true" - >#{ tool["name"] }} + tags = create_tags(tool) + %Q{#{"" % {name: tool["name"], description: tool["description"], tags: tags }}} end def find_tool(tool_id) @@ -40,25 +40,28 @@ def find_tool(tool_id) 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