{% macro tag_label(tag) -%} {% if tag == "oa" %} <span class="ui label basic orange small" title="Open Access">{% trans %}Open Access{% endtrans %}</span> {% elif tag == "jstor" %} <span class="ui label basic purple small" title="Preserved in JSTOR">JSTOR</span> {% elif tag == "scielo" %} <span class="ui label basic purple small" title="Hosted on SciELO platform">SciELO</span> {% elif tag == "ojs" %} <span class="ui label basic purple small" title="Hosted with Open Journal Systems">OJS</span> {% elif tag == "wordpress" %} <span class="ui label basic purple small" title="Hosted with Wordpress">Wordpress</span> {% elif tag == "road" %} {# skip for now; no curration? #} {# <span class="ui label basic orange small" title="ISSN Registry of Open Access Journals">ROAD</span> #} {% elif tag == "szczepanski" %} <span class="ui label basic orange small" title="Szcezepanski OA Journal List">Szczepanski</span> {% elif tag == "doaj" %} <span class="ui label basic orange small" title="Directory of Open Access Journals">DOAJ</span> {% elif tag == "multiple-versions" %} <span class="ui label basic blue small">{% trans %}Multiple Versions{% endtrans %}</span> {% elif tag.startswith("lang:") %} <span class="ui label basic black small" title="ISO Language Code">{{ tag }}</span> {% else %} {# disabling "other" tags for now #} {# <span class="ui label basic grey small">{{ _(tag) }}</span> #} {% endif %} {% endmacro %} {% macro external_identifiers(biblio) -%} {# NOTE: should be able to call with paper.biblio or any paper.release[] #} <span class="external-identifiers"> {% if biblio.doi %} <a target="_blank" rel="external noopener noreferrer" href="https://doi.org/{{ biblio.doi }}">doi:{{ biblio.doi }}</a> {% endif %} {% if biblio.pmid %} <a target="_blank" rel="external noopener" href="https://www.ncbi.nlm.nih.gov/pubmed/{{ biblio.pmid }}">pmid:{{ biblio.pmid }}</a> {% endif %} {% if biblio.pmcid %} <a target="_blank" rel="external noopener" href="https://pubmed.ncbi.nlm.nih.gov/{{ biblio.pmcid }}/">pmcid:{{ biblio.pmcid }}</a> {% endif %} {% if biblio.arxiv_id %} <a target="_blank" rel="external noopener" href="https://arxiv.org/abs/{{ biblio.arxiv_id }}">arXiv:{{ biblio.arxiv_id }}</a> {% endif %} {% if biblio.dblp_id %} <a target="_blank" rel="external noopener" href="https://dblp.org/rec/{{ biblio.dblp_id }}.html">dblp:{{ biblio.dblp_id }}</a> {% endif %} {% if biblio.doaj_id %} <a target="_blank" rel="external noopener" href="https://doaj.org/article/{{ biblio.doaj_id }}">doaj:{{ biblio.doaj_id }}</a> {% endif %} {% if biblio.release_ident or biblio.ident %} <a target="_blank" rel="external noopener" href="https://fatcat.wiki/release/{{ biblio.release_ident or biblio.ident }}">fatcat:{{ biblio.release_ident or biblio.ident }}</a> {% endif %} </span> {% endmacro %} {% macro ia_access_button(access, show_thumbnail=False, other_version=False) -%} {% if access.file_mimetype == "application/pdf" %} {% set access_alt = _('fulltext PDF download') %} {% elif access.access_type == "ia_sim" %} {% set access_alt = _('read fulltext microfilm') %} {% else %} {% set access_alt = _('fulltext access') %} {% endif %} {% if other_version %} {% set access_alt = access_alt + " [" + other_version + "]" %} {% endif %} <a target="_blank" rel="noopener" href="{{ access.access_url}}" title="{{ access_alt }}" {% if settings.ENABLE_GOATCOUNTER %}data-goatcounter-click="serp-fulltext" data-goatcounter-title="serp-fulltext"{% endif %}> <button class="ui simple right pointing dropdown compact black labeled icon button serp-button"> <i class="icon ia-icon"></i> {% if access.access_type == "wayback" %} {% trans %}Web Archive{% endtrans %} {% elif access.access_type == "ia_file" %} {% trans %}File Archive{% endtrans %} {% elif access.access_type == "ia_sim" %} {% trans %}Archive [Microfilm]{% endtrans %} {% else %} {% trans %}Other{% endtrans %} {% endif %} {% if access.file_mimetype == "application/pdf" or (access.file_mimetype == None and access.access_type == "wayback") %} {% trans %}[PDF]{% endtrans %} {% elif access.file_mimetype == "text/html" %} {% trans %}[HTML]{% endtrans %} {% elif access.file_mimetype == "text/xml" %} {% trans %}[XML]{% endtrans %} {% endif %} {% if other_version %} <span style="color: #f43e3e;">✱</span> {% endif %} {% if show_thumbnail and access.thumbnail_url %} <div class="menu fulltext-thumbnail"> <img src="{{ access.thumbnail_url }}" alt="{{ _('fulltext thumbnail') }}" loading="lazy"> </div> {% endif %} </button> </a> {% endmacro %} {% 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 %} {% set default_domain = _("Publisher / doi.org") %} {% if paper._obj and paper._obj.biblio %} {{ paper._obj.biblio.doi_link_domain(default_domain) }} {% else %} {{ default_domain }} {% endif %} </button> </a> {% endif %} {% endmacro %} {% macro platform_access_button(biblio) %} {# TODO: DOAJ #} {% if biblio.arxiv_id %} <a target="_blank" rel="external noopener" href="https://arxiv.org/abs/{{ biblio.arxiv_id }}" title="arxiv.org access"> <button class="ui compact blue labeled icon button serp-button"> <i class="file alternate outline icon"></i> arxiv.org </button> </a> {% elif biblio.pmcid %} <a target="_blank" rel="external noopener" href="https://www.ncbi.nlm.nih.gov/pmc/articles/{{ biblio.pmcid }}" title="pubmed link"> <button class="ui compact blue labeled icon button serp-button"> <i class="file alternate outline icon"></i> pubmed.gov </button> </a> {% endif %} {% endmacro %} {% macro journal_row(biblio, paper) -%} {# NOTE: should be able to call with paper.biblio or any paper.release[] #} {% if biblio.release_year %} <span title="{{ biblio.release_date or '' }}">{% trans year=biblio.release_year %}{{ year }}{% endtrans %}</span> {% endif %} {% if biblio.container_name %} <i {% if biblio.publisher %}title="{{ biblio.publisher }}"{% endif %}> {% if biblio.container_ident %} <a target="_blank" rel="noopener" href="https://fatcat.wiki/container/{{ biblio.container_ident }}" style="color: black;">{{ biblio.container_name }}</a> {% elif paper.doc_type == "sim_page" %} <a target="_blank" rel="noopener" href="https://archive.org/details/{{ paper.ia_sim.pub_collection }}" style="color: black;">{{ biblio.container_name }}</a> {% else %} {{ biblio.container_name }} {% endif %} </i> {% endif %} {% if biblio.release_stage == "submitted" %} <span class="release-stage" >pre-print</span> {% elif biblio.release_stage and biblio.release_stage != "published" %} <span class="release-stage">{{ biblio.release_stage }}</span> {% elif not biblio.release_stage %} <span class="release-stage">unpublished</span> {% endif %} {% if biblio.withdrawn_status %} <span class="release-stage" style="color: red;">{{ biblio.withdrawn_status }}</span> {% endif %} {% endmacro %} {% macro fulltext_search_result_row(paper, locale, debug_mode=False, expand=False) -%} <div class="ui stackable doubling grid"> <div class="thirteen wide column biblio-record"> <details class="title-dropdown" {% if expand %}open{% endif %}> <summary> {# ### TITLE ROW #} <h3 class="biblio-title"> {% if paper.doc_type == "work" %} <span class="link"> {% if paper.biblio.title %} {{ paper.biblio.title[:512] }} {% if paper.biblio.title|length > 512 %}...{% endif %} {% else %} [blank] {% endif %} </span> {# release type suffix #} <span class="release-type" > {% if paper.biblio.release_type in ("article-journal", "paper-conference") or paper.doc_type == "sim_page" %} {# pass #} {% elif paper.biblio.release_type in ("book", "chapter", "dataset") %} [{{ _(paper.biblio.release_type) }}] {% elif not paper.biblio.release_type %} [{{ _("unknown") }}] {% else %} [{{ _(paper.biblio.release_type) }}] {% endif %} </span> {# show inverse of title/original_title above #} {% if paper.biblio.original_title and paper.biblio.title != paper.biblio.original_title %} <br> <span class="original-title"> {{ paper.biblio.original_title[:512] }} {% if paper.biblio.original_title|length > 512 %}...{% endif %} </span> {% endif %} {% elif paper.doc_type == "sim_page" %} <span class="link"> {% trans page_num = paper.ia_sim.first_page, journal_name = paper.biblio.container_name, volume = paper.biblio.volume, issue = paper.biblio.issue %}Page {{ page_num }} of {{ journal_name }} Vol. {{ volume }}, Issue {{ issue }}{% endtrans %} </span> <span class="release-type">[{{ _("page") }}]</span> {% endif %} </h3> {# ### AUTHOR ROW #} {% if paper.biblio.contrib_names %} <div class="author-row"> {{ ", ".join(paper.biblio.contrib_names[:12]) }} {% if paper.biblio.contrib_names|length > 12 %}<i>(+{{ paper.biblio.contrib_names|length - 12 }} others)</i>{% endif %} </div> {% endif %} {# ### JOURNAL ROW #} {{ journal_row(paper.biblio, paper) }} </summary> <div class="dropdown-menu"> {# ### FULLTEXT ACCESS OPTIONS #} <h4 class="ui horizontal divider header"> {% trans %}Preserved Fulltext{% endtrans %} </h4> {% if paper.fulltext and paper.fulltext.access_url %} <div class="ui items"> <div class="item"> <div class="image"> <a target="_blank" rel="noopener" href="{{ paper.fulltext.access_url }}" title="{{ _('fulltext access') }}" {% if settings.ENABLE_GOATCOUNTER %}data-goatcounter-click="serp-fulltext" data-goatcounter-title="serp-fulltext"{% endif %}> {% if paper.fulltext.thumbnail_url %} <div class="ui serp card"> <img class="ui" src="{{ paper.fulltext.thumbnail_url }}" alt="fulltext thumbnail" loading="lazy"> </div> {% else %} <div class="ui serp card" style="box-shadow: none;"> <img src="/static/document-icon.svg" style="opacity: 0.6; width: 180px; height: 232px;" alt=""> </div> {% endif %} </a> </div> <div class="content"> <div class="header"> <a rel="noopener" href="{{ paper.fulltext.access_url }}" {% if settings.ENABLE_GOATCOUNTER %}data-goatcounter-click="serp-fulltext" data-goatcounter-title="serp-fulltext"{% endif %}> {% if paper.fulltext.access_type == "wayback" %} {% trans %}Web Archive Capture{% endtrans %} {% elif paper.fulltext.access_type == "ia_file" %} {% trans %}File Archive{% endtrans %} {% elif paper.fulltext.access_type == "ia_sim" %} {% trans %}Digitized Microfilm{% endtrans %} {% endif %} {% if paper.fulltext.file_mimetype == "application/pdf" or (paper.fulltext.file_mimetype == None and paper.fulltext.access_type == "wayback") %} PDF {% elif paper.fulltext.file_mimetype == "text/html" %} HTML {% elif paper.fulltext.file_mimetype == "text/xml" %} XML {% endif %} {% if paper.fulltext.size_bytes %} ({{ paper.fulltext.size_bytes|filesizeformat }}) {% endif %} </a> </div> <div class="meta"> <a rel="noopener" href="{{ paper.fulltext.access_url}}" {% if settings.ENABLE_GOATCOUNTER %}data-goatcounter-click="serp-fulltext" data-goatcounter-title="serp-fulltext"{% endif %}> {{ paper.fulltext.access_url }} </a> </div> <div class="description"> {% if paper.fulltext.access_type == "wayback" %} {% set original_url = '/'.join(paper.fulltext.access_url.split('/')[5:]) %} {% set capture_year = paper.fulltext.access_url.split('/')[4][:4] %} <p>{% trans %}A copy of this work was available on the public web and has been preserved in the Wayback Machine. The capture dates from {{ capture_year }}; you can also visit <a rel="external noopener" href="{{ original_url }}">the original URL</a>.{% endtrans %} {% elif paper.fulltext.access_type == "ia_file" %} <p>{% trans %}The Internet Archive has a preservation copy of this work in our general collections.{% endtrans %} {% elif paper.fulltext.access_type == "ia_sim" %} <p>{% trans %}The Internet Archive has digitized a microfilm copy of this work. It may be possible to borrow a copy for reading.{% endtrans %} {% endif %} {% if paper.fulltext.file_mimetype %} {% trans mimetype = ("<code>" + paper.fulltext.file_mimetype + "</code>")|safe %}The file type is {{ mimetype }}.{% endtrans %} {% endif %} {% if paper.fulltext.release_ident and (paper.biblio.release_ident != paper.fulltext.release_ident) %} {# Fulltext copy is different from biblio version! #} <p>{% trans %}Note that this fulltext copy is not of the "primary" version of this work. The version it corresponds to is:{% endtrans %} <div class="ui fitted divider"></div> {% for release in paper.releases if release.ident == paper.fulltext.release_ident %} {{ journal_row(release, paper) }} {{ external_identifiers(release) }} {% endfor %} <div class="ui fitted divider"></div> {% endif %} </div> <div class="extra"> {# currently, ia_sim access types are not linked to specific versions #} {% for access in paper.access if access.access_type != paper.fulltext.access_type and (access.release_ident == paper.fulltext.release_ident or access.release_ident == paper.biblio.release_ident or access.access_type == 'ia_sim') %} {% if loop.first %} <p>{% trans %}Additional access options for the primary version of this work:{% endtrans %} {% endif %} {{ ia_access_button(access )}} {% endfor %} </div> </div> </div> </div> {% else %} {# No fulltext case #} <p>{% trans %}We don't yet know of a public preservation copy of this work. You may be able to obtain a copy of this work to read from the publisher, platforms, or institutional libraries.{% endtrans %} {% if paper.doc_type == "work" %} {% set save_paper_now_url = "https://fatcat.wiki/release/" + paper.biblio.release_ident + "/save" %} <p>{% trans %}If you know of a legal, public version that we should archive, please let us know via <a rel="noopener" href="{{ save_paper_now_url }}">"Save Paper Now"</a>.{% endtrans %} {% endif %} {% endif %} {% if paper.releases|length > 1 %} {% for release in paper.releases if (release.ident != paper.biblio.release_ident and (not paper.fulltext or release.ident != paper.fulltext.release_ident)) %} {% if loop.first %} <h4 class="ui horizontal divider header"> {# <i class="tag icon"></i> #} Other Versions </h4> {% endif %} <div class="biblio-record"> {{ journal_row(release, paper) }} <br> {{ external_identifiers(release) }} <br> {% for access in paper.access if access.release_ident == release.ident %} {{ ia_access_button(access)}} {% endfor %} </div> {% if not loop.last %} <div class="ui divider"></div> {% endif %} {% endfor %} {% endif %} <div class="ui divider"></div> </div> </details> {# ### ABSTRACT / QUERY HIGHLIGHT #} {% if paper._highlights %} <div class="search-highlights"> {# this highlight HTML escape hacking should not be necessary in ES 7.x with highlight escaping #} {# but for now we manually escape, then de-escape the 'em' highlight tags #} {% autoescape false %} {% for highlight in paper._highlights[:3] %} {{ highlight|e|replace("<em>", "<em>")|replace("</em>", "</em>") }} ... {% endfor %} {% endautoescape %} </div> {% elif paper.abstracts %} <div class="search-highlights"> {% if paper.abstracts[0].body|length > 500 %} {{ paper.abstracts[0].body | truncate(500, False, '') }} <details style="display:inline;"> <summary>{% trans %}more »{% endtrans %}</summary> ... {{ paper.abstracts[0].body[480:] }} </details> {% else %} {{ paper.abstracts[0].body }} {% endif %} </div> {% endif %} {# ### IDENTIFIERS #} {{ external_identifiers(paper.biblio) }} <div class="tag-row"> {# ### TAGS #} {# colors to use: olive, brown, grey, pink, red, etc #} {# TODO: only show 'json' link if from cluster? #} {% if debug_mode %} <a target="_blank" rel="noopener" href="{{ settings.ELASTICSEARCH_PUBLIC_URL }}/{{ settings.ELASTICSEARCH_QUERY_FULLTEXT_INDEX }}/_doc/{{ paper.key }}"> <span class="ui label small" title="search document JSON debug link">json</span> </a> {% endif %} <a rel="noopener" href="{{ lang_prefix }}/help#tags" aria-label="{{ _('tag definitions') }}"> {% for tag in paper.tags|sort %} {# HACK: don't show "oa" tag if already obvious #} {% if tag != "oa" or ("doaj" not in paper.tags and "szczepanski" not in paper.tags) %} {{ tag_label(tag) }} {% endif %} {% endfor %} {% if paper.biblio.lang_code and paper.biblio.lang_code != (locale or 'en') %} {{ tag_label("lang:" + paper.biblio.lang_code) }} {% endif %} {% if (paper.access and paper.access|length > 1) or (paper.releases and paper.releases|length > 1) %} {{ tag_label('multiple-versions') }} {% endif %} </a> </div> </div> <div class="three wide left aligned column serp-right-col"> {# ### ACCESS LINKS #} {# archive links (if available) #} {% if paper.fulltext and paper.fulltext.access_url %} {% if (paper.fulltext.release_ident and paper.fulltext.release_ident != paper.biblio.release_ident) %} {% set other_version = _("not primary version") %} {% else %} {% set other_version = "" %} {% endif %} {{ ia_access_button(paper.fulltext, show_thumbnail=True, other_version=other_version) }} {% endif %} {# publisher / repository #} {{ doi_access_button(paper, is_oa=("oa" in paper.tags)) }} {# trusted platform fulltext links #} {{ platform_access_button(paper.biblio) }} {# ### COLLAPSED HITS #} {% if paper._collapsed_count and paper._collapsed_count > 0 %} <button class="ui basic compact blue labeled icon button serp-button" form="search_form" type="submit" name="collapse_key" value="{{ paper.collapse_key }}"> <i class="ui icon zoom-in"></i> {% trans trimmed count=paper._collapsed_count %} Same Issue ({{ count }}) {% endtrans %} </button> {% endif %} {# ### OTHER ACTIONS #} <div class="action-bar"> <details class="serp-action-menu"> <summary> <div class="circular ui icon compact basic button" title="{{ _('cite this work') }}"> <i class="quote left icon"></i> </div> </summary> <div class="citation-menu menu"> <b>{% trans %}Citation{% endtrans %}</b> <p>{{ paper._obj.biblio.citation_str("default") }} {% if paper.doc_type == "work" %} <div class="ui divider"></div> <ul class="ui horizontal list"> <li class="item"><a href="https://fatcat.wiki/release/{{ paper.biblio.release_ident }}/citeproc?style=modern-language-association" target="_blank" rel="noopener"><i class="external icon"></i>MLA</a></li> <li class="item"><a href="https://fatcat.wiki/release/{{ paper.biblio.release_ident }}/citeproc?style=elsevier-harvard" target="_blank" rel="noopener"><i class="external icon"></i>Harvard</a></li> <li class="item"><a href="https://fatcat.wiki/release/{{ paper.biblio.release_ident }}/citeproc?style=csl-json" target="_blank" rel="noopener"><i class="external icon"></i>CSL-JSON</a></li> <li class="item"><a href="https://fatcat.wiki/release/{{ paper.biblio.release_ident }}.bib" target="_blank" rel="noopener"><i class="external icon"></i>BibTeX</a></li> </ul> {% endif %} </div> </details> <a href="https://fatcat.wiki/release/{{ paper.biblio.release_ident }}" rel="noopener" title="{{ _('edit metadata on fatcat wiki') }}"> <div class="circular ui icon compact basic button"> <i class="edit icon"></i> </div> </a> <a href="{{ lang_prefix }}{% if paper.doc_type == "work" %}/work/{{ paper.work_ident }}{% else %}/search?q=key:{{ paper.key }}{% endif %}" rel="noopener" title="{{ _('permalink to this record') }}"> <div class="circular ui icon compact basic button"> <i class="linkify icon"></i> </div> </a> </div> </div> </div> {# final row close #} {% endmacro %} {% macro search_pagination(hits, locale) %} {% if hits.offset > 0 %} <button class="text-button" form="search_form" type="submit" name="offset" value="{{ hits.offset - hits.limit }}" style="float: left;" rel="prev"> <a>{% trans %}« Previous{% endtrans %}</a> </button> {% else %} <span style="color:rgba(0,0,0,0.55); float: left">{% trans %}« Previous{% endtrans %}</span> {% endif %} {% if hits.offset + hits.limit < hits.count_found %} <button class="text-button" form="search_form" type="submit" name="offset" value="{{ hits.offset + hits.limit }}" style="float: right;" rel="next"> <a>{% trans %}Next »{% endtrans %}</a> </button> {% else %} <span style="color:rgba(0,0,0,0.55); float: right;">{% trans %}Next »{% endtrans %}</span> {% endif %} <i style="padding-left: 0.5em; padding-right: 0.5em;"> {% trans trimmed start=babel_numbers.format_decimal(hits.offset + 1, locale=locale), end=babel_numbers.format_decimal([hits.offset + hits.limit, hits.count_found]|min, locale=locale), total=babel_numbers.format_decimal(hits.count_found, locale=locale) %} Showing results {{ start }} — {{ end }} out of {{ total }} results {% endtrans %} </i> {% endmacro %} {% macro query_option(options, selected) -%} <div> <label class="filter-label" for="{{ options.slug }}">{{ _(options.label) }}</label> <br> <div class="ui link list" style="margin-top: 0.3em;"> {% for opt in options.list %} <button class="text-button" form="search_form" type="submit" name="{{ options.slug }}" value="{{ opt.slug }}"> {% if selected == opt.slug or (not selected and opt.slug == options.default) %} <span style="font-weight: bold;"> {% else %} <span> {% endif %} {{ _(opt.label) }} </span> </button> <br> {% endfor %} </div> </div> <br> {% endmacro %} {% macro clear_query(query) -%} {% if query.filter_time or query.filter_type or query.filter_availability or query.sort_order %} <div> <a class="filter-label" href="{{ lang_prefix }}/search{% if query.q %}?q={{ query.q|urlencode }}{% endif %}" style="color: rgba(0,0,0,0.55); color: brown;">{% trans %}Clear Filters{% endtrans %}</a> </div> <br> {% endif %} {% endmacro %} {% macro query_hidden(options, selected) -%} {% if selected %} <input form="search_form" type="hidden" name="{{ options.slug }}" value="{{ selected }}"> {% endif %} {% endmacro %}