From 7597c6192dfe568d72fa26c9666b2a9a40b37a6f Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 20 May 2020 17:03:35 -0700 Subject: update search template for schema --- fatcat_scholar/templates/search_macros.html | 224 ++++++++++++---------------- 1 file changed, 95 insertions(+), 129 deletions(-) (limited to 'fatcat_scholar/templates/search_macros.html') diff --git a/fatcat_scholar/templates/search_macros.html b/fatcat_scholar/templates/search_macros.html index 16d4621..f2c452f 100644 --- a/fatcat_scholar/templates/search_macros.html +++ b/fatcat_scholar/templates/search_macros.html @@ -6,93 +6,90 @@ {# ### TITLE ROW #}
- {# "best URL" calculation #} - {% if paper.pmcid %} - - {% if lang_code != 'en' and lang_code == paper.lang and paper.original_title %} - {# show original title first instead of title if UI is in that language #} - {{ paper.original_title[:512] }} - {% if paper.original_title|length > 512 %}...{% endif %} - {% elif paper.title %} - {{ paper.title[:512] }} - {% if paper.title|length > 512 %}...{% endif %} + {% if paper.doc_type == "work" %} + {# "best URL" calculation #} + {% if paper.biblio.pmcid %} + + style="color: #2224c7;"> + {% 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 %} + [media?] + {% else %} + [{{ _(paper.biblio.release_type) }}] + {% endif %} + - {# release type suffix #} - - {% if paper.release_type in ("article-journal", "paper-conference") %} - {# pass #} - {% elif paper.release_type in ("book", "chapter", "dataset") %} - [{{ _(paper.release_type) }}] - {% elif not paper.release_type %} - [media?] - {% else %} - [{{ _(paper.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 %} - {# show inverse of title/original_title above #} - {% if lang_code != 'en' and lang_code == paper.lang and paper.title and paper.title != paper.original_title %} -
- - {{ paper.title[:512] }} {% if paper.title|length > 512 %}...{% endif %} - - {% elif paper.original_title and paper.title != paper.original_title %} -
- - {{ paper.original_title[:512] }} {% if paper.original_title|length > 512 %}...{% 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.contrib_names %} + {% if paper.biblio.contrib_names %}
- {{ ", ".join(paper.contrib_names[:12]) }} - {% if paper.contrib_names|length > 12 %}(+{{ paper.contrib_names|length - 12 }} others){% endif %} + {{ ", ".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.release_year %} - {{ paper.release_year }} + {% if paper.biblio.release_year %} + {{ paper.biblio.release_year }} {% endif %} - {% if paper.release_year and paper.container_name %} + {% if paper.biblio.release_year and paper.biblio.container_name %} {% endif %} - {% if paper.container_name %} + {% if paper.biblio.container_name %} - {% if paper.container_id %} - {{ paper.container_name }} + {% if paper.biblio.container_id %} + {{ paper.biblio.container_name }} + {% elif paper.doc_type == "sim_page" %} + {{ paper.biblio.container_name }} {% else %} - {{ paper.container_name }} + {{ paper.biblio.container_name }} {% endif %} {% if paper.container_is_oa %}{% endif %} {% endif %} - {% if paper.withdrawn_status %} - [{{ paper.withdrawn_status }}] + {% if paper.biblio.withdrawn_status %} + [{{ paper.biblio.withdrawn_status }}] {% endif %} - {% if paper.release_stage == "accepted" %} - [{{ paper.release_stage }}] - {% elif paper.release_stage and paper.release_stage != "published" %} - [{{ paper.release_stage }}] - {% elif not paper.release_stage %} + {% if paper.biblio.release_stage == "accepted" %} + [{{ paper.biblio.release_stage }}] + {% elif paper.biblio.release_stage and paper.biblio.release_stage != "published" %} + [{{ paper.biblio.release_stage }}] + {% elif not paper.biblio.release_stage %} [unpublished?] {% endif %} @@ -103,12 +100,12 @@ {{ highlight|safe }}  ...  {% endfor %} - {% elif paper.abstract %} + {% elif paper.abstracts %}
- {% if paper.abstract[0]|length > 500 %} - {{ paper.abstract[0][:500] }}... + {% if paper.abstracts[0].body|length > 500 %} + {{ paper.abstracts[0].body[:500] }}... {% else %} - {{ paper.abstract[0][:500] }}... + {{ paper.abstracts[0].body[:500] }}... {% endif %}
{% else %} @@ -116,92 +113,61 @@ {% endif %} {# ### IDENTIFIERS #} - {% if paper.doi %} - doi:{{ paper.doi }}   + {% if paper.biblio.doi %} + doi:{{ paper.biblio.doi }}   {% endif %} - {% if paper.pmid %} - pmid:{{ paper.pmid }}   + {% if paper.biblio.pmid %} + pmid:{{ paper.biblio.pmid }}   {% endif %} - {% if paper.pmcid %} - pmcid:{{ paper.pmcid }}   + {% if paper.biblio.pmcid %} + pmcid:{{ paper.pmcid }}   {% endif %} - {% if paper.arxiv_id %} - arXiv:{{ paper.arxiv_id }}   + {% if paper.biblio.arxiv_id %} + arXiv:{{ paper.biblio.arxiv_id }}   {% endif %} - {% if paper.fatcat_ident %} - fatcat:{{ paper.fatcat_ident}}   + {% if paper.biblio.fatcat_ident %} + fatcat:{{ paper.biblio.fatcat_ident}}   {% endif %} {# ### SOURCE TAGS #}
- {% if paper.cord19_uid or 'cord19' in paper.source_tags %} - - CORD-19 - - {% endif %} - {% if 'fatcat' in paper.source_tags %} - - fatcat - - {% endif %} - {% if 'who' in paper.source_tags %} - - WHO - - {% endif %} - {% if 'wanfang' in paper.source_tags %} - - Wanfang - - {% endif %} - {% if 'cnki' in paper.source_tags %} - - CNKI - - {% endif %} + {% for tag in paper.tags %} + {{ tag }} + {% endfor %} {# olive, brown, grey, pink, red, etc #}
-
- {% if paper.fulltext.thumbnail_url %} +
+ {% if paper.fulltext.access_url %} {# #} - + {% if paper.fulltext.thumbnail_url %}
- - + + - {# -
-
- #}
+ {% endif %} +
{# TODO: could have other hover info, like mimetype icon and file size? #} - - web.archive.org + + {% if paper.fulltext.access_type == "wayback" %} + web.archive.org + {% elif paper.fulltext.access_type in ["ia_sim", "ia_file"] %} + archive.org + {% endif %} + {% if paper.fulltext.file_mimetype == "application/pdf" %} + + {% elif paper.fulltext.access_type == "ia_sim" %} + + {% endif %} +
-
-
{% else %} {# No Fulltext #} {% endif %} -{# should we include these little links? - - {% if paper.fulltext.pdf_url %} - mirror - {% endif %} - {% if paper.fulltext.grobid_xml_url %} - xml - {% endif %} - -#}
{% endmacro %} -- cgit v1.2.3