From 13620af6f7bc6df13bcc16dc3088da692c820147 Mon Sep 17 00:00:00 2001 From: James Stevenson Date: Mon, 25 Nov 2024 13:26:00 -0500 Subject: [PATCH] fix: fix bioportal link generation and remove redundant links (#2655) * fix bioportal button render issues. remove custom liquid filter (unsupported by github actions deployment) * don't make redundant buttons when ontology already provides link --- _layouts/ontology_detail.html | 41 +++++++++++++++++++++++++++++--- _plugins/bioportal_identifier.rb | 28 ---------------------- 2 files changed, 38 insertions(+), 31 deletions(-) delete mode 100644 _plugins/bioportal_identifier.rb diff --git a/_layouts/ontology_detail.html b/_layouts/ontology_detail.html index 8bdc6d2f3..dc00f9666 100644 --- a/_layouts/ontology_detail.html +++ b/_layouts/ontology_detail.html @@ -70,9 +70,44 @@

OLS - - BioPortal - + {% assign skip_bioportal = false %} + {% for browser in page.browsers %} + {% if browser.label == "BioPortal" %} + {% assign skip_bioportal = true %} + {% endif %} + {% endfor %} + + {% unless skip_bioportal %} + {% assign bioportal_id = page.id | upcase %} + {% if bioportal_id == 'FBBT' %} + {% assign bioportal_id = 'FB-BT' %} + {% elsif bioportal_id == 'RO' %} + {% assign bioportal_id = 'OBOREL' %} + {% elsif bioportal_id == 'APOLLO_SV' %} + {% assign bioportal_id = 'APOLLO-SV' %} + {% elsif bioportal_id == 'TRANS' %} + {% assign bioportal_id = 'PTRANS' %} + {% elsif bioportal_id == 'WBLS' %} + {% assign bioportal_id = 'WB-LS' %} + {% elsif bioportal_id == 'FBDV' %} + {% assign bioportal_id = 'FB-DV' %} + {% elsif bioportal_id == 'WBBT' %} + {% assign bioportal_id = 'WB-BT' %} + {% elsif bioportal_id == 'WBPHENOTYPE' %} + {% assign bioportal_id = 'WB-PHENOTYPE' %} + {% elsif bioportal_id == 'TO' %} + {% assign bioportal_id = 'PTO' %} + {% elsif bioportal_id == 'FBCV' %} + {% assign bioportal_id = 'FB-CV' %} + {% elsif bioportal_id == 'MOD' %} + {% assign bioportal_id = 'PSIMOD' %} + {% elsif bioportal_id == 'PSO' %} + {% assign bioportal_id = 'PLANTSO' %} + {% endif %} + + BioPortal + + {% endunless %} {% for b in page.browsers %} {{b.label}} diff --git a/_plugins/bioportal_identifier.rb b/_plugins/bioportal_identifier.rb deleted file mode 100644 index 7c37d23e9..000000000 --- a/_plugins/bioportal_identifier.rb +++ /dev/null @@ -1,28 +0,0 @@ -module CustomFilter - def make_bioportal_id(obo_id) - return obo_id unless obo_id.is_a?(String) - - # ID requirements should be locked down moving forward, so additions to this table - # should be rare - special_cases = { - 'fbbt' => 'FB-BT', - 'ro' => 'OBOREL', - 'apollo_sv' => 'APOLLO-SV', - 'trans' => 'PTRANS', - 'wbls' => 'WB-LS', - 'fbdv' => 'FB-DV', - 'wbbt' => 'WB-BT', - 'wbphenotype' => 'WB-PHENOTYPE', - 'to' => 'PTO', - 'fbcv' => 'FB-CV', - 'mod' => 'PSIMOD', - 'pso' => 'PLANTSO' - } - - return special_cases[obo_id] if special_cases.key? obo_id - - obo_id == obo_id.downcase ? obo_id.upcase : obo_id - end -end - -Liquid::Template.register_filter(CustomFilter)