{% macro fatcat_bits(entity, entity_type, expand="", editgroup=None) -%} {% if entity.state == None and editgroup %}
{% if editgroup.changelog_index %} Accepted Edit Version

This is the version of the entity as of a specific point in time: {% elif editgroup.submitted %} Submitted Edit Version

This is a version of the entity that has been submitted for approval as part of: {% else %} Edit In Progress

This is a version of the entity that has not yet been submitted for approval. Part of: {% endif %} editgroup_{{ editgroup.editgroup_id }}

{% elif entity.state == None and entity.ident == None %}
Revision

This is a specific, static metadata record, not necessarily linked to any current entity in the catalog.

{% elif entity.state == "wip" %}
Work In Progress

This entity has not been "accepted" into the official database yet.

{% endif %}
Catalog Record {% if entity.state and entity.state != "active" %}
State: {{ entity.state }} {% endif %} {% if entity.revision %}
Revision: {{ entity.revision }} {% endif %}
API URL: JSON
{% if entity.ident %}
Edit Metadata View History
{% endif %} {%- endmacro %} {% macro extra_metadata(extra) -%} {% for (key, value) in extra.items()|sort %} {% if key in ("ia", "crossref", "datacite", "kbart", "arxiv", "jstor", "pubmed") and value is mapping and value %} {% for (inner_key, inner_value) in value.items()|sort %}
{{ key }}.{{ inner_key }} {{ inner_value }} {% endfor %} {% elif key in ("urls", "webarchive_urls") and value and value is iterable and value is not string and value[0] is string %}
{{ key }} {% for u in value %} {{ u }}
{% endfor %}
{% else %}
{{ key }} {% if value != None %}{{ value }}{% endif %} {% endif %} {% endfor %}
{%- endmacro %} {% macro release_list(releases) -%} {% for release in releases %}
{% if release.release_date %}{{ release.release_date }}{% elif release.release_year %}{{ release.release_year }}{% else %}unknown{% endif %} {{ release.title }}
{{ release.release_stage or "unknown status" }} | {{ release.release_type or "unknown type" }} {% if release.version %} | {{ release.version }}{% endif %} {% if release.license_slug %} | {{ release.license_slug }}{% endif %} {% if release.ext_ids.doi %}
doi:{{ release.ext_ids.doi }} {% endif %} {% endfor %}
{%- endmacro %} {% macro url_list(urls) -%} {% for url in urls %}
{{ url.rel }} {% if url.url.count('/') >= 3 and url.rel != "dweb" %} {{ '/'.join(url.url.split('/')[0:2]) }}/{{ ''.join(url.url.split('/')[2]) }}/{{ '/'.join(url.url.split('/')[3:]) }} {% else %} {{ url.url }} {% endif %} {% endfor %}
{%- endmacro %} {% macro lookup_form(entity_type, key, example, lookup_key, lookup_value, lookup_error) -%} {%- endmacro %} {% macro release_search_result_row(paper) -%}

{% if paper.title %} {{ paper.title[:512] }} {% if paper.title|length > 512 %}...{% endif %} {% else %} [blank] {% endif %} {# release type suffix #} {% if paper.release_type in ("article-journal", "paper-conference") %} {# pass #} {% elif not paper.release_type %} [unknown] {% else %} [{{ paper.release_type }}] {% endif %} {# show original_title #} {% if paper.original_title and paper.title != paper.original_title %}
{{ paper.original_title[:512] }} {% if paper.original_title|length > 512 %}...{% endif %} {% endif %}

   {% if paper.preservation == "bright" %} {% if paper.best_pdf_url %} bright archive {% else %} bright archive {% endif %} {% elif paper.preservation == "dark" %} dark archive {% else %} no archive {% endif %}
{# ### AUTHOR ROW #} {% if paper.contrib_names %}
{{ ", ".join(paper.contrib_names[:12]) }} {% if paper.contrib_names|length > 12 %}(+{{ paper.contrib_names|length - 12 }} others){% endif %}
{% endif %} {# ### JOURNAL ROW #} {% if paper.release_year %} {{ paper.release_year }} {% endif %} {% if paper.release_year and paper.container_name %} | {% endif %} {% if paper.container_name %} {% if paper.container_id %} {{ paper.container_name }} {% else %} {{ paper.container_name }} {% endif %} {% if paper.container_is_oa %}{% endif %} {% endif %} {% if paper.release_stage == "submitted" %} pre-print {% elif paper.release_stage and paper.release_stage != "published" %} {{ paper.release_stage }} version {% elif not paper.release_stage %} unpublished {% endif %} {% if paper.withdrawn_status %} {{ paper.withdrawn_status }} {% endif %} {# ### IDENTIFIERS #} {% if paper.doi or paper.pmcid or paper.pmid or paper.arxiv_id or paper.jstor_id or paper.doaj_id or paper.dblp_id %}
{% endif %} {% if paper.doi %} doi:{{ paper.doi }}   {% endif %} {% if paper.pmcid %} pmcid:{{ paper.pmcid }}   {% elif paper.pmid %} pmid:{{ paper.pmid }}   {% endif %} {% if paper.arxiv_id %} arXiv:{{ paper.arxiv_id }}   {% endif %} {% if paper.jstor_id %} jstor:{{ paper.jstor_id }}   {% endif %} {% if paper.doaj_id %} doaj:{{ paper.doaj_id }}   {% endif %} {% if paper.dblp_id %} dblp:{{ paper.dblp_id }}   {% endif %} {# WIP: elastic release work grouping searches
and 5 other versions of the same work! #}
{% endmacro %} {% macro container_search_result_row(entity) -%}

{{ entity['name'] }} {% if entity.is_oa %}{% endif %}

{% if entity.publisher %}
{{ entity.publisher }}
{% endif %} {% if entity.issnl %} issn:{{ entity.issnl }} {% endif %} {% if entity.container_type %}  {{ entity.container_type }} {% endif %}
{% endmacro %} {% macro progress_color(frac) -%} {% if frac >= 1 %} green {% elif frac > 0.95 %} olive {% elif frac < 0.5 %} red {% else %} yellow {% endif %} {%- endmacro %} {% macro preservation_bar(stats, extra_class="") -%} {% set frac_bright = stats.bright/stats.total %} {% set frac_dark = stats.dark/stats.total %} {% set frac_none = stats.none/stats.total %}
{# {{ (frac_bright*100)|int }}% #}
{# {{ (frac_dark*100)|int }}% #}
{% if stats.shadows_only %} {% set frac_shadows_only = stats.shadows_only/stats.total %}
{# {{ (frac_shadows_only*100)|int }}% #}
{% endif %}
{# {{ (frac_none*100)|int }}% #}
{%- endmacro %} {% macro preservation_table(stats) -%} {% set frac_bright = stats.bright/stats.total %} {% set frac_dark = stats.dark/stats.total %} {% set frac_none = stats.none/stats.total %}
{{ "{:,}".format(stats.bright) }} {{ (frac_bright*100)|round(2,method='ceil') }}% preserved and publicly accessible (bright)
{{ "{:,}".format(stats.dark) }} {{ (frac_dark*100)|round(2,method='ceil') }}% preserved but not publicly accessible (dark) {% if stats.shadows_only %} {% set frac_shadows_only = stats.shadows_only/stats.total %}
{{ "{:,}".format(stats.shadows_only) }} {{ (frac_shadows_only*100)|round(2,method='ceil') }}% only independently preserved in "shadow" libraries {% endif %}
{{ "{:,}".format(stats.none) }} {{ (frac_none*100)|round(2,method='ceil') }}% no known independent preservation
{%- endmacro %} {% macro preservation_small_table(stats) -%} {% set frac_bright = stats.bright/stats.total %} {% set frac_dark = stats.dark/stats.total %} {% set frac_none = stats.none/stats.total %}
{{ "{:,}".format(stats.bright) }} preserved and accessble (bright)
{{ "{:,}".format(stats.dark) }} preserved, inaccessible (dark) {% if stats.shadows_only %} {% set frac_shadows_only = stats.shadows_only/stats.total %}
{{ "{:,}".format(stats.shadows_only) }} shadow library only {% endif %}
{{ "{:,}".format(stats.none) }} no known preservation
{%- endmacro %} {# this is useful for things like showing lists of releases in tables #} {% macro release_summary(release) %} {{ release.title }} {% if release.release_type not in ["article-journal", "conference-paper"] %} [{{ release.release_type or "unknown-type" }}] {% endif %} {% if release.contribs %}
{% endif %} {% for contrib in release.contribs[:8] %} {% if contrib.creator %} {{ contrib.creator.display_name }} {% else %} {{ contrib.raw_name }} {%- endif %} {%- if not loop.last %}, {% endif %} {% endfor %} {% if release.contribs | length > 8 %} (+ more) {%endif %} {% if release.release_year or release.container or (release.extra and release.extra.container_name) %}
{% endif %} {% if release.release_year %}{{ release.release_year }}  {% endif %} {% if release.container %} {{ release.container.name }} {% elif release.extra and release.extra.container_name %} {{ release.extra.container_name }} {% endif %} {% if release.release_stage == "submitted" %}  pre-print {% elif release.release_stage and release.release_stage != "published" %}  {{ release.release_stage }} version {% elif not release.release_stage %}  unpublished {% endif %}
{% if release.version %} version:{{ release.version }}  {% endif %} {% if release.number %} number:{{ release.number }}  {% endif %} {% if release.ext_ids.doi %} doi:{{ release.ext_ids.doi }}  {% endif %} {# TODO: links #} {% if release.ext_ids.arxiv %} arXiv:{{ release.ext_ids.arxiv }}  {% endif %} {% if release.ext_ids.pmcid %} pmcid:{{ release.ext_ids.pmcid }}  {% endif %} {% if release.ext_ids.pmid %} pmid:{{ release.ext_ids.pmid }}  {% endif %} {% if release.ext_ids.dblp %} dblp:{{ release.ext_ids.dblp }}  {% endif %} {% endmacro %} {# similar to the release_summary above, but for CSL-JSON #} {% macro csl_summary(csl) %} {{ csl.title }} {% if csl.title and csl.author %}
{% endif %} {% if csl.author %} {% for author in csl.author[:8] %} {# TODO: other name variants? #} {{ author.name }} {%- if not loop.last %}, {% endif %} {% endfor %} {% if csl.author | length > 8 %} (+ more) {%endif %} {% endif %} {% if csl.issued or csl["container-title"] %}
{% endif %} {% if csl.issued and csl.issued.raw %}{{ csl.issued.raw }}  {% endif %} {% if csl["container-title"] %} {{ csl["container-title"] }} {% endif %}
{% if csl.volume %} volume:{{ csl.volume}}  {% endif %} {% if csl.DOI %} doi:{{ csl.DOI }}  {% endif %} {% if csl.URL %} url:{{ csl.URL }}  {% endif %} {% endmacro %}