diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2021-08-06 11:58:16 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2021-08-06 11:58:16 -0700 |
commit | 99885b458ad505ebb63b3e7cf5b1bae3dd2a459e (patch) | |
tree | de3fbb3e42b0bb7f6e447d2e13ac3f92a8bb90b2 /python/fatcat_web/templates/entity_macros.html | |
parent | 950d3f08bd439aed92d01dbc3cca9747570aa82c (diff) | |
parent | 56e4ce2d8347cdfedd492d54fde080772f3d8725 (diff) | |
download | fatcat-99885b458ad505ebb63b3e7cf5b1bae3dd2a459e.tar.gz fatcat-99885b458ad505ebb63b3e7cf5b1bae3dd2a459e.zip |
Merge branch 'bnewbold-refs-apis'
Diffstat (limited to 'python/fatcat_web/templates/entity_macros.html')
-rw-r--r-- | python/fatcat_web/templates/entity_macros.html | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/python/fatcat_web/templates/entity_macros.html b/python/fatcat_web/templates/entity_macros.html index 50f45753..6b565f69 100644 --- a/python/fatcat_web/templates/entity_macros.html +++ b/python/fatcat_web/templates/entity_macros.html @@ -387,3 +387,112 @@ yellow </table> {%- endmacro %} + +{# this is useful for things like showing lists of releases in tables #} +{% macro release_summary(release) %} + <b><a href="/release/{{ release.ident }}">{{ release.title }}</a></b> + {% if release.release_type not in ["article-journal", "paper-conference"] %} + <b>[{{ release.release_type or "unknown-type" }}]</b> + {% endif %} + {% if release.contribs %}<br>{% endif %} + {% for contrib in release.contribs[:8] %} + {% if contrib.creator %} + <a href="/contib/{{ contrib.creator.ident }}" style="color: black;">{{ contrib.creator.display_name }}</a> + {% else %} + {{ contrib.raw_name }} + {%- endif %} + {%- if not loop.last %}, {% endif %} + {% endfor %} + {% if release.contribs | length > 8 %} <i>(+ more)</i> {%endif %} + {% if release.release_year or release.container or (release.extra and release.extra.container_name) %}<br>{% endif %} + {% if release.release_year %} + {% if release.release_date %} + <span title="{{ release.release_date }}">{{ release.release_year }}</span> + {% else %} + {{ release.release_year }} + {% endif %} + + {% endif %} + {% if release.container %} + <a href="/container/{{ release.container.ident }}" style="color: black;"><i>{{ release.container.name }}</i></a> + {% elif release.extra and release.extra.container_name %} + <i>{{ release.extra.container_name }}</i> + {% endif %} + + {% if release.release_stage == "submitted" %} + <b style="color: brown; text-transform: uppercase;">pre-print</b> + {% elif release.release_stage and release.release_stage != "published" %} + <b style="color: brown; text-transform: uppercase;">{{ release.release_stage }} version</b> + {% elif not release.release_stage %} + <b style="color: brown; text-transform: uppercase;">unpublished</b> + {% endif %} +<br> + {% if release.version %} + <span style="color:green">version:{{ release.version }}</span> + {% endif %} + {% if release.number %} + <span style="color:green">number:{{ release.number }}</span> + {% endif %} + {% if release.ext_ids.doi %} + <a href="https://doi.org/{{ release.ext_ids.doi }}" style="color:green;">doi:{{ release.ext_ids.doi }}</a> + {% endif %} + {# TODO: links #} + {% if release.ext_ids.arxiv %} + <a href="#" style="color:green;">arXiv:{{ release.ext_ids.arxiv }}</a> + {% endif %} + {% if release.ext_ids.pmcid %} + <a href="#" style="color:green;">pmcid:{{ release.ext_ids.pmcid }}</a> + {% endif %} + {% if release.ext_ids.pmid %} + <a href="#" style="color:green;">pmid:{{ release.ext_ids.pmid }}</a> + {% endif %} + {% if release.ext_ids.dblp %} + <a href="#" style="color:green;">dblp:{{ release.ext_ids.dblp }}</a> + {% endif %} +{% endmacro %} + +{# similar to the release_summary above, but for CSL-JSON #} +{% macro csl_summary(csl) %} + <b>{{ csl.title }}</b> + {% if csl.title and csl.author %}<br>{% endif %} + {% if csl.author %} + {% for author in csl.author[:8] %} + {% if author.literal %} + {{ author.literal }} + {% elif author.raw_name %} + {{ author.raw_name }} + {% elif author.family and author.given %} + {{ author.given }} {{ author.family }} + {% elif author.family %} + {{ author.family }} + {% elif author.name %} + {# DEPRECATED: was used by refs code path for a while. Delete in, eg, year 2022 #} + {{ author.name }} + {% endif %} + {%- if not loop.last %}, {% endif %} + {% endfor %} + {% if csl.author | length > 8 %} <i>(+ more)</i> {%endif %} + {% endif %} + + {% if csl.issued or csl["container-title"] %}<br>{% endif %} + {% if csl.issued and csl.issued is mapping %} + {% if csl.issued['date-parts'] %} + {{ csl.issued['date-parts'][0][0] }} + {% elif csl.issued.raw %} + {{ csl.issued.raw }} + {% endif %} + {% endif %} + {% if csl["container-title"] %} + <i>{{ csl["container-title"] }}</i> + {% endif %} + <br> + {% if csl.volume %} + <span style="color:green">volume:{{ csl.volume}}</span> + {% endif %} + {% if csl.DOI %} + <a href="https://doi.org/{{ csl.DOI }}" style="color:green;">doi:{{ csl.DOI }}</a> + {% endif %} + {% if csl.URL %} + <a href="{{ csl.URL }}" style="color:green;">url:{{ csl.URL }}</a> + {% endif %} +{% endmacro %} |