summaryrefslogtreecommitdiffstats
path: root/fatcat_scholar/templates
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2021-01-21 19:25:09 -0800
committerBryan Newbold <bnewbold@archive.org>2021-01-21 19:36:21 -0800
commit05cd1bb7bdcefe8ec596e572baafb9da9a8838b2 (patch)
tree5c49a54bf594e5d0008264984e12e1d1a881c1fe /fatcat_scholar/templates
parent5096b0b7407aadfb97093615696f951829dc3506 (diff)
downloadfatcat-scholar-05cd1bb7bdcefe8ec596e572baafb9da9a8838b2.tar.gz
fatcat-scholar-05cd1bb7bdcefe8ec596e572baafb9da9a8838b2.zip
refactor DOI domain lookup into python code; expand table
Diffstat (limited to 'fatcat_scholar/templates')
-rw-r--r--fatcat_scholar/templates/search_macros.html34
1 files changed, 5 insertions, 29 deletions
diff --git a/fatcat_scholar/templates/search_macros.html b/fatcat_scholar/templates/search_macros.html
index f580cee..25ba7f5 100644
--- a/fatcat_scholar/templates/search_macros.html
+++ b/fatcat_scholar/templates/search_macros.html
@@ -99,40 +99,16 @@
</a>
{% endmacro %}
-{% macro doi_access_button(biblio, is_oa=False) %}
- {% if biblio.doi %}
- {% set publisher = "" or (biblio.publisher and biblio.publisher.lower()) %}
- {% set container_name = "" or (biblio.container_name and biblio.container_name.lower()) %}
- <a target="_blank" rel="external noopener noreferrer" href="https://doi.org/{{ biblio.doi }}">
+{% macro doi_access_button(paper, is_oa=False) %}
+ {% if paper.biblio and paper.biblio.doi %}
+ <a target="_blank" rel="external noopener noreferrer" href="https://doi.org/{{ paper.biblio.doi }}">
<button class="ui left aligned compact blue labeled icon button serp-button">
{% if is_oa %}
<i class="unlock alternate icon" style="background-color: #fb971f;"></i>
{% else %}
<i class="external alternate icon"></i>
{% endif %}
- {# TODO: detect prefix? JSTOR, biorxiv, medrxiv, zenodo, figshare, dryad, etc #}
- {# helpful: https://gist.github.com/TomDemeranville/8699224 #}
- {% if biblio.doi_prefix == "10.6084" %}
- figshare.com
- {% elif biblio.doi_prefix == "10.5281" %}
- zenodo.org
- {% elif biblio.doi_prefix == "10.1371" %}
- plos.org
- {% elif biblio.doi_prefix == "10.1101" and "biorxiv" in container_name %}
- biorxiv.org
- {% elif biblio.doi_prefix == "10.1101" and "medrxiv" in container_name %}
- medrxiv.org
- {% elif biblio.doi_prefix == "10.1016" and "elsevier" in publisher %}
- elsevier.com
- {% elif biblio.doi_prefix in ["10.1186", "10.1007"] and "springer" in publisher %}
- springer.com
- {% elif biblio.doi_prefix in ["10.1042", "10.1111", "10.1177"] and "sage" in publisher %}
- sagepub.com
- {% elif biblio.doi_prefix in ["10.1080"] and "taylor" in publisher %}
- tandfonline.com
- {% else %}
- Publisher / doi.org
- {% endif %}
+ {{ paper._obj.biblio.doi_link_domain("Publisher / doi.org") }}
</button>
</a>
{% endif %}
@@ -453,7 +429,7 @@
{% endif %}
{# publisher / repository #}
- {{ doi_access_button(paper.biblio, is_oa=("oa" in paper.tags)) }}
+ {{ doi_access_button(paper, is_oa=("oa" in paper.tags)) }}
{# trusted platform fulltext links #}
{{ platform_access_button(paper.biblio) }}