{% macro tag_label(tag) -%} {% if tag == "oa" %} OA {% elif tag == "jstor" %} JSTOR {% elif tag == "scielo" %} SciELO {% elif tag == "ojs" %} OJS {% elif tag == "wordpress" %} Wordpress {% elif tag == "road" %} {# skip for now; no curration? #} {# ROAD #} {% elif tag == "szczepanski" %} Szczepanski {% elif tag == "doaj" %} DOAJ {% elif tag.startswith("lang:") %} {{ tag }} {% else %} {{ _(tag) }} {% endif %} {% endmacro %} {% macro fulltext_search_result_row(paper, locale=None, debug_mode=False) -%}
{# ### TITLE ROW #}
{% if paper.doc_type == "work" %} {% if paper.biblio.title %} {{ paper.biblio.title[:512] }} {% if paper.biblio.title|length > 512 %}...{% endif %} {% else %} [blank] {% endif %} {# release type suffix #} {% 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 %} {# show inverse of title/original_title above #} {% if paper.biblio.original_title and paper.biblio.title != paper.biblio.original_title %}
{{ paper.biblio.original_title[:512] }} {% if paper.biblio.original_title|length > 512 %}...{% endif %} {% endif %} {% elif paper.doc_type == "sim_page" %} Page {{ paper.ia_sim.first_page }} of {{ paper.biblio.container_name }} (Vol. {{ paper.biblio.volume }}, Issue {{ paper.biblio.issue }}) {% endif %}
{# ### AUTHOR ROW #} {% if paper.biblio.contrib_names %}
{{ ", ".join(paper.biblio.contrib_names[:12]) }} {% if paper.biblio.contrib_names|length > 12 %}(+{{ paper.biblio.contrib_names|length - 12 }} others){% endif %}
{% endif %} {# ### JOURNAL ROW #} {% if paper.biblio.release_year %} {{ paper.biblio.release_year }} {% endif %} {% if paper.biblio.container_name %} {% if paper.biblio.container_ident %} {{ paper.biblio.container_name }} {% elif paper.doc_type == "sim_page" %} {{ paper.biblio.container_name }} {% else %} {{ paper.biblio.container_name }} {% endif %}   {% endif %} {% if paper.biblio.release_stage == "submitted" %} pre-print {% elif paper.biblio.release_stage and paper.biblio.release_stage != "published" %} {{ paper.biblio.release_stage }} version {% elif not paper.biblio.release_stage %} unpublished {% endif %} {% if paper.biblio.withdrawn_status %} {{ paper.biblio.withdrawn_status }} {% endif %} {# ### ABSTRACT / QUERY HIGHLIGHT #} {% if paper._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 %} {{ highlight|e|replace("<em>", "")|replace("</em>", "") }}  ...  {% endfor %} {% endautoescape %}
{% elif paper.abstracts %}
{% if paper.abstracts[0].body|length > 500 %} {{ paper.abstracts[0].body[:500] }}... {% else %} {{ paper.abstracts[0].body }} {% endif %}
{% else %}
{% endif %} {# ### IDENTIFIERS #} {% if paper.biblio.doi %} doi:{{ paper.biblio.doi }}   {% endif %} {% if paper.biblio.pmid %} pmid:{{ paper.biblio.pmid }}   {% endif %} {% if paper.biblio.pmcid %} pmcid:{{ paper.biblio.pmcid }}   {% endif %} {% if paper.biblio.arxiv_id %} arXiv:{{ paper.biblio.arxiv_id }}   {% endif %} {% if paper.biblio.release_ident %} fatcat:{{ paper.biblio.release_ident}}   {% endif %}
{# ### TAGS #} {# colors to use: olive, brown, grey, pink, red, etc #} {# TODO: remove doc for ES 7.x-style lack of type #} {# TODO: only show 'json' link if from cluster? #} {% if debug_mode %} json {% endif %} {% for tag in paper.tags|sort %} {{ tag_label(tag) }} {% endfor %} {% if paper.biblio.lang_code and paper.biblio.lang_code != (locale or 'en') %} {{ tag_label("lang:" + paper.biblio.lang_code) }} {% endif %} {# ### COLLAPSED HITS #} {% if paper._collapsed_count > 0 %} {% endif %}
{% if paper.fulltext and paper.fulltext.access_url %} {% if paper.fulltext.thumbnail_url %} {% else %} {% endif %} {% else %} {# No Fulltext #} {% endif %}
{% endmacro %} {% macro search_pagination(hits, top) %} {% if hits.offset > 0 %} {% else %} « Previous {% endif %} Showing results {{ hits.offset }} — {{ hits.offset + hits.limit }} out of {{ "{:,}".format(hits.count_found) }} results {% if hits.offset + hits.limit < hits.count_found %} {% endmacro %} {% macro query_option(options, selected) -%} {{ _(options.label) }}
{% endmacro %} {% macro query_hidden(options, selected) -%} {% if selected %} {% endif %} {% endmacro %}