From 7186a379f335dd2731d5db79ab85abf3506cee88 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 15 Apr 2021 23:25:00 -0700 Subject: web: template macro to display release entry summary --- python/fatcat_web/templates/entity_macros.html | 52 ++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'python/fatcat_web/templates/entity_macros.html') diff --git a/python/fatcat_web/templates/entity_macros.html b/python/fatcat_web/templates/entity_macros.html index 50f45753..94770afb 100644 --- a/python/fatcat_web/templates/entity_macros.html +++ b/python/fatcat_web/templates/entity_macros.html @@ -387,3 +387,55 @@ yellow {%- 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 %} +
+ {% for contrib in release.contribs[:5] %} + {% if contrib.creator %} + {{ contrib.creator.display_name }} + {% else %} + {{ contrib.raw_name }} + {% endif %} + {% if not loop.last %}, {% endif %} + {% endfor %} + {% if release.contribs | length > 5 %}(+ more) {%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 != "published" %} +  {{ release.release_stage or "unpublished" }} + {% endif %} + +
+ {% if release.version %} + version:{{ release.release_year }}  + {% 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 %} -- cgit v1.2.3 From 61ed521cc40c1ee76692e9c4054e89fa63320600 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 24 Jun 2021 18:45:08 -0700 Subject: improvements to fuzzy refs view - fixes to release summary macro - show tab counts correctly by re-using generic entity get helper - table styling; 'prev' link - openlibrary access links - parse-and-match button for unmatched+unstructured refs --- python/fatcat_web/ref_routes.py | 12 +-- python/fatcat_web/templates/entity_macros.html | 17 ++-- .../templates/release_view_fuzzy_refs.html | 93 +++++++++++++++------- 3 files changed, 75 insertions(+), 47 deletions(-) (limited to 'python/fatcat_web/templates/entity_macros.html') diff --git a/python/fatcat_web/ref_routes.py b/python/fatcat_web/ref_routes.py index bd8ae550..e08aaf15 100644 --- a/python/fatcat_web/ref_routes.py +++ b/python/fatcat_web/ref_routes.py @@ -21,11 +21,7 @@ from fatcat_web.entity_helpers import * @app.route('/release//inbound-refs', methods=['GET']) def release_view_refs_inbound(ident): - # lookup release ident, ensure it exists - try: - release = api.get_release(ident) - except ApiException as ae: - abort(ae.status) + release = generic_get_entity("release", ident) offset = request.args.get('offset', '0') offset = max(0, int(offset)) if offset.isnumeric() else 0 @@ -38,11 +34,7 @@ def release_view_refs_inbound(ident): @app.route('/release//outbound-refs', methods=['GET']) def release_view_refs_outbound(ident): - # lookup release ident, ensure it exists - try: - release = api.get_release(ident) - except ApiException as ae: - abort(ae.status) + release = generic_get_entity("release", ident) offset = request.args.get('offset', '0') offset = max(0, int(offset)) if offset.isnumeric() else 0 diff --git a/python/fatcat_web/templates/entity_macros.html b/python/fatcat_web/templates/entity_macros.html index 94770afb..24d1b6d0 100644 --- a/python/fatcat_web/templates/entity_macros.html +++ b/python/fatcat_web/templates/entity_macros.html @@ -394,30 +394,29 @@ yellow {% 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[:5] %} {% if contrib.creator %} - {{ contrib.creator.display_name }} + {{ contrib.creator.display_name }} {% else %} {{ contrib.raw_name }} - {% endif %} - {% if not loop.last %}, {% endif %} + {%- endif %} + {%- if not loop.last %}, {% endif %} {% endfor %} - {% if release.contribs | length > 5 %}(+ more) {%endif %} -
+ {% if release.contribs | length > 5 %} (+ 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 }} + {{ release.container.name }} {% elif release.extra and release.extra.container_name %} {{ release.extra.container_name }} {% endif %} {% if release.release_stage != "published" %}  {{ release.release_stage or "unpublished" }} {% endif %} -
{% if release.version %} - version:{{ release.release_year }}  + version:{{ release.version }}  {% endif %} {% if release.number %} number:{{ release.number }}  diff --git a/python/fatcat_web/templates/release_view_fuzzy_refs.html b/python/fatcat_web/templates/release_view_fuzzy_refs.html index ee39d15b..7b286fd3 100644 --- a/python/fatcat_web/templates/release_view_fuzzy_refs.html +++ b/python/fatcat_web/templates/release_view_fuzzy_refs.html @@ -4,53 +4,90 @@ {% import "entity_macros.html" as entity_macros %} {% extends "entity_base.html" %} +{% macro pagination_row(hits) %} + + {% if hits.offset %} + « prev   + {% endif %} + Showing {{ hits.offset + 1 }} - {{ hits.offset + hits.count_returned }} of {{ hits.count_total}} references (in {{ hits.query_wall_time_ms }}ms) + {% if hits.count_total != hits.count_returned and hits.offset + hits.limit < hits.count_total %} +  next » + {% endif %} +{% endmacro %} + {% block entity_main %} {% if direction == "inbound" %} -

Inbound Matched References

- Other releases citing this one +

Referenced By

+ Citations to this release by other works. {% elif direction == "outbound" %} -

Outbound Matched References

- This release citing other releases -{% endif %} - -

Found {{ hits.count_total }} references in {{ hits.query_wall_time_ms }}ms. -{% if hits.count_total != hits.count_returned %} - Showing {{ hits.offset + 1 }} - {{ hits.offset + hits.count_returned }} - {% if hits.offset + hits.limit < hits.count_total %} -  next... - {% endif %} +

References

+ NOTE: currently batch computed and may include additional references sources, or be missing recent changes, compared to entity reference list. {% endif %} - +{% if enriched_refs %} +
+ + -{% for ref in enriched_refs %} - {% set release = ref.release %} - +{% if hits.count_total != hits.count_returned %} + + +{% endif %}
+ {{ pagination_row(hits) }} +
+{% for row in enriched_refs %} + {% set release = row.release %} +
+ {# TODO: ref_locator? #} {% if direction == "outbound" %} - {% if ref.ref.ref_key %} - [{{ ref.ref.ref_key }}] + {% if row.ref.ref_key %} + [{{ row.ref.ref_key }}]
{% endif %} {% endif %} -
{{ ref.ref.match_status }} - {% if ref.ref.match_provenance %} -
{{ ref.ref.match_provenance }} + {{ row.ref.match_status }}
+ {% if row.ref.match_provenance %} + via {{ row.ref.match_provenance }} {% endif %}
{% if release %} - {% entity_macros.release_summary(release) %} - {% elif ref.ref.target_unstructured %} - {{ ref.ref.target_unstructured }} + {{ entity_macros.release_summary(release) }} + {% elif row.ref.target_unstructured %} + {{ row.ref.target_unstructured }} {% else %} blank {% endif %} - - {% if ref.access %} - {{ ref.access[0].access_type.name }} - {% endif %} + + {% if row.access %} + {% for access in row.access %} + {{ access.access_type.name }}
+ {% endfor %} + {% elif row.ref.target_unstructured %} +
+ + + +
+ {% endif %} + + {# TODO: include these as access options instead #} + {% if row.ref.target_openlibrary_work %} + openlibrary.org + {% endif %} + {% if row.ref.target_url %} + web +
wayback (?) + {% endif %} {% endfor %}
+ {{ pagination_row(hits) }} +
+{% else %} +

None found +{% endif %} {% endblock %} -- cgit v1.2.3 From 1125eddcac0c9b2673dbfb1f62bb0fa9b1ab4054 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Fri, 23 Jul 2021 17:48:35 -0700 Subject: web: refactor refs table into separate refs_macros file --- python/fatcat_web/templates/entity_macros.html | 41 ++++++++++- python/fatcat_web/templates/refs_macros.html | 86 ++++++++++++++++++++++ .../templates/release_view_fuzzy_refs.html | 74 +------------------ 3 files changed, 127 insertions(+), 74 deletions(-) create mode 100644 python/fatcat_web/templates/refs_macros.html (limited to 'python/fatcat_web/templates/entity_macros.html') diff --git a/python/fatcat_web/templates/entity_macros.html b/python/fatcat_web/templates/entity_macros.html index 24d1b6d0..ac2b5a15 100644 --- a/python/fatcat_web/templates/entity_macros.html +++ b/python/fatcat_web/templates/entity_macros.html @@ -390,7 +390,7 @@ yellow {# this is useful for things like showing lists of releases in tables #} {% macro release_summary(release) %} -{{ release.title }} + {{ release.title }} {% if release.release_type not in ["article-journal", "conference-paper"] %} [{{ release.release_type or "unknown-type" }}] {% endif %} @@ -411,8 +411,13 @@ yellow {% elif release.extra and release.extra.container_name %} {{ release.extra.container_name }} {% endif %} - {% if release.release_stage != "published" %} -  {{ release.release_stage or "unpublished" }} + + {% 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 %} @@ -438,3 +443,33 @@ yellow 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[:5] %} + {# TODO: other name variants? #} + {{ author.name }} + {%- if not loop.last %}, {% endif %} + {% endfor %} + {% if csl.author | length > 5 %} (+ 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 %} diff --git a/python/fatcat_web/templates/refs_macros.html b/python/fatcat_web/templates/refs_macros.html new file mode 100644 index 00000000..405aca73 --- /dev/null +++ b/python/fatcat_web/templates/refs_macros.html @@ -0,0 +1,86 @@ +{% import "entity_macros.html" as entity_macros %} + +{% macro pagination_row(hits, direction) %} + + {% if hits.offset %} + « prev   + {% endif %} + Showing {{ hits.offset + 1 }} - {{ hits.offset + hits.count_returned }} of {{ hits.count_total}} references (in {{ hits.query_wall_time_ms }}ms) + {% if hits.count_total != hits.count_returned and hits.offset + hits.limit < hits.count_total %} +  next » + {% endif %} +{% endmacro %} + +{% macro refs_table(hits, direction) %} + + + + + +{% for row in hits.result_refs %} + {% set release = row.release %} + +{% if hits.count_total != hits.count_returned %} + + +{% endif %} +
+ {{ pagination_row(hits) }} +
+ {# TODO: ref_locator? #} + {% if direction == "out" %} + {% if row.ref.ref_key %} + [{{ row.ref.ref_key }}]
+ {% endif %} + {% endif %} + {{ row.ref.match_status }}
+ {% if row.ref.match_provenance %} + via {{ row.ref.match_provenance }} + {% endif %} +
+ {% if release %} + {{ entity_macros.release_summary(release) }} + {% elif row.ref.target_unstructured %} + {{ row.ref.target_unstructured }} + {% if row.ref.target_openlibrary_work %} +
openlibrary:{{ row.ref.target_openlibrary_work }}  + {% endif %} + {% elif row.ref.target_csl %} + {{ entity_macros.csl_summary(row.ref.target_csl) }} + {% else %} + blank + {% endif %} +
+ {% if row.access %} + {% for access in row.access %} + + {%- if access.access_type.name == "wayback" %} + web.archive.org + {%- elif access.access_type.name == "ia_file" -%} + archive.org + {%- else -%} + {{ access.access_type.name }} + {%- endif -%} + {%- if access.mimetype == "application/pdf" %} + [PDF] + {%- elif access.mimetype == "text/html" %} + [HTML] + {%- endif -%} + +
+ {% endfor %} + {% elif direction == "out" and row.ref.target_unstructured %} +
+ + + +
+ {% endif %} +{% endfor %} +
+ {{ pagination_row(hits) }} +
+{% endmacro %} + diff --git a/python/fatcat_web/templates/release_view_fuzzy_refs.html b/python/fatcat_web/templates/release_view_fuzzy_refs.html index 43860a31..ffca0bc9 100644 --- a/python/fatcat_web/templates/release_view_fuzzy_refs.html +++ b/python/fatcat_web/templates/release_view_fuzzy_refs.html @@ -1,19 +1,9 @@ {% set release = entity %} {% set entity_view = "refs-" + direction %} {% set entity_type = "release" %} -{% import "entity_macros.html" as entity_macros %} +{% import "refs_macros.html" as refs_macros %} {% extends "entity_base.html" %} -{% macro pagination_row(hits) %} - - {% if hits.offset %} - « prev   - {% endif %} - Showing {{ hits.offset + 1 }} - {{ hits.offset + hits.count_returned }} of {{ hits.count_total}} references (in {{ hits.query_wall_time_ms }}ms) - {% if hits.count_total != hits.count_returned and hits.offset + hits.limit < hits.count_total %} -  next » - {% endif %} -{% endmacro %} {% block entity_main %} @@ -25,66 +15,8 @@ NOTE: currently batch computed and may include additional references sources, or be missing recent changes, compared to entity reference list. {% endif %} -{% if enriched_refs %} - - - - -{% for row in enriched_refs %} - {% set release = row.release %} - -{% if hits.count_total != hits.count_returned %} - - -{% endif %} -
- {{ pagination_row(hits) }} -
- {# TODO: ref_locator? #} - {% if direction == "out" %} - {% if row.ref.ref_key %} - [{{ row.ref.ref_key }}]
- {% endif %} - {% endif %} - {{ row.ref.match_status }}
- {% if row.ref.match_provenance %} - via {{ row.ref.match_provenance }} - {% endif %} -
- {% if release %} - {{ entity_macros.release_summary(release) }} - {% elif row.ref.target_unstructured %} - {{ row.ref.target_unstructured }} - {% else %} - blank - {% endif %} - - {% if row.access %} - {% for access in row.access %} - {{ access.access_type.name }}
- {% endfor %} - {% elif row.ref.target_unstructured %} -
- - - -
- {% endif %} - - {# TODO: include these as access options instead #} - {% if row.ref.target_openlibrary_work %} - openlibrary.org - {% endif %} - {% if row.ref.target_url %} - web -
wayback (?) - {% endif %} -{% endfor %} -
- {{ pagination_row(hits) }} -
+{% if hits.result_refs %} + {{ refs_macros.refs_table(hits, direction) }} {% else %}

None found {% endif %} -- cgit v1.2.3 From d0ca0f9d70858218c5fc5625ca08c349ec06121c Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 27 Jul 2021 17:01:58 -0700 Subject: refs: show up to 8 authors in summary tables --- python/fatcat_web/templates/entity_macros.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'python/fatcat_web/templates/entity_macros.html') diff --git a/python/fatcat_web/templates/entity_macros.html b/python/fatcat_web/templates/entity_macros.html index ac2b5a15..37bb2d90 100644 --- a/python/fatcat_web/templates/entity_macros.html +++ b/python/fatcat_web/templates/entity_macros.html @@ -395,7 +395,7 @@ yellow [{{ release.release_type or "unknown-type" }}] {% endif %} {% if release.contribs %}
{% endif %} - {% for contrib in release.contribs[:5] %} + {% for contrib in release.contribs[:8] %} {% if contrib.creator %} {{ contrib.creator.display_name }} {% else %} @@ -403,7 +403,7 @@ yellow {%- endif %} {%- if not loop.last %}, {% endif %} {% endfor %} - {% if release.contribs | length > 5 %} (+ more) {%endif %} + {% 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 %} @@ -449,12 +449,12 @@ yellow {{ csl.title }} {% if csl.title and csl.author %}
{% endif %} {% if csl.author %} - {% for author in csl.author[:5] %} + {% for author in csl.author[:8] %} {# TODO: other name variants? #} {{ author.name }} {%- if not loop.last %}, {% endif %} {% endfor %} - {% if csl.author | length > 5 %} (+ more) {%endif %} + {% if csl.author | length > 8 %} (+ more) {%endif %} {% endif %} {% if csl.issued or csl["container-title"] %}
{% endif %} -- cgit v1.2.3 From fa2ba60834cf3cb3edea05af3c1830e6fc0d5bcc Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 27 Jul 2021 18:48:14 -0700 Subject: refs: several small improvements to web UI --- python/fatcat_web/templates/entity_macros.html | 11 +++- .../templates/openlibrary_view_fuzzy_refs.html | 6 +- python/fatcat_web/templates/refs_macros.html | 71 ++++++++++++++++------ .../templates/release_view_fuzzy_refs.html | 12 ++-- .../templates/wikipedia_view_fuzzy_refs.html | 6 +- 5 files changed, 71 insertions(+), 35 deletions(-) (limited to 'python/fatcat_web/templates/entity_macros.html') diff --git a/python/fatcat_web/templates/entity_macros.html b/python/fatcat_web/templates/entity_macros.html index 37bb2d90..562b99d3 100644 --- a/python/fatcat_web/templates/entity_macros.html +++ b/python/fatcat_web/templates/entity_macros.html @@ -391,7 +391,7 @@ yellow {# 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"] %} + {% if release.release_type not in ["article-journal", "paper-conference"] %} [{{ release.release_type or "unknown-type" }}] {% endif %} {% if release.contribs %}
{% endif %} @@ -405,7 +405,14 @@ yellow {% 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.release_year %} + {% if release.release_date %} + {{ release.release_year }} + {% else %} + {{ release.release_year }} + {% endif %} +   + {% endif %} {% if release.container %} {{ release.container.name }} {% elif release.extra and release.extra.container_name %} diff --git a/python/fatcat_web/templates/openlibrary_view_fuzzy_refs.html b/python/fatcat_web/templates/openlibrary_view_fuzzy_refs.html index 161a7b50..21bf76f2 100644 --- a/python/fatcat_web/templates/openlibrary_view_fuzzy_refs.html +++ b/python/fatcat_web/templates/openlibrary_view_fuzzy_refs.html @@ -19,11 +19,7 @@ Refernces from this book to other entities. {% endif %} -{% if hits.result_refs %} - {{ refs_macros.refs_table(hits, direction) }} -{% else %} -

None found -{% endif %} +{{ refs_macros.refs_table(hits, direction) }} {% endblock %} diff --git a/python/fatcat_web/templates/refs_macros.html b/python/fatcat_web/templates/refs_macros.html index ba4d18ad..3db47064 100644 --- a/python/fatcat_web/templates/refs_macros.html +++ b/python/fatcat_web/templates/refs_macros.html @@ -1,37 +1,67 @@ {% import "entity_macros.html" as entity_macros %} -{% macro pagination_row(hits, direction) %} - - {% if hits.offset %} +{% macro pagination_row(hits, with_links=False) %} + {% if with_links and hits.offset %} « prev   {% endif %} - Showing {{ hits.offset + 1 }} - {{ hits.offset + hits.count_returned }} of {{ hits.count_total}} references (in {{ hits.query_wall_time_ms }}ms) - {% if hits.count_total != hits.count_returned and hits.offset + hits.limit < hits.count_total %} + {% if hits.count_returned == 0 %} + Showing 0 references + {% else %} + Showing {{ hits.offset + 1 }} - {{ hits.offset + hits.count_returned }} of {{ hits.count_total}} references + {% endif %} + {% if with_links and hits.count_total != hits.count_returned and hits.offset + hits.limit < hits.count_total %}  next » {% endif %} {% endmacro %} {% macro refs_table(hits, direction) %} +

+
+ Fuzzy reference matching is a work in progress! +
+ Read more about quality, completeness, and caveats in the fatcat guide. +
+{% if hits.count_total == 0 %} + + -{% if hits.count_total != hits.count_returned %} - - -{% endif %} + +
- {{ pagination_row(hits) }} + {{ pagination_row(hits, with_links=False) }} + (in {{ hits.query_wall_time_ms }}ms)
+
+ + No References Found +
+{% endif %} {% for row in hits.result_refs %} {% set release = row.release %} -
+
{# TODO: ref_locator? #} {% if direction == "out" %} {% if row.ref.ref_key %} [{{ row.ref.ref_key }}]
{% endif %} {% endif %} - {{ row.ref.match_status }}
- {% if row.ref.match_provenance %} - via {{ row.ref.match_provenance }} + + {% if row.ref.match_status == "exact" %} + {% set match_icon = "linkify" %} + {% elif row.ref.match_status == "unmatched" %} + {% set match_icon = "question circle outline" %} + {% else %} + {% set match_icon = "magic" %} {% endif %} +
+ {% if row.ref.match_provenance and row.ref.match_provenance == "fatcat-pubmed" %} + {# this is a common case and making the column render wide #} + via pubmed + {% elif row.ref.match_provenance %} + via {{ row.ref.match_provenance }}
+ {% endif %} +
{% if release %} {{ entity_macros.release_summary(release) }} @@ -62,7 +92,7 @@ {% if row.access %} {% for access in row.access %} - + {%- if access.access_type.name == "wayback" %} web.archive.org {%- elif access.access_type.name == "ia_file" -%} @@ -83,18 +113,23 @@ {% endif %} {% endfor %}
- {{ pagination_row(hits) }} -
+
+ JSON +
+ {% if hits.count_returned != hits.count_total %} +
+ {{ pagination_row(hits, with_links=True) }} +
+ {% endif %} +
{% endmacro %} diff --git a/python/fatcat_web/templates/release_view_fuzzy_refs.html b/python/fatcat_web/templates/release_view_fuzzy_refs.html index ffca0bc9..8cba4f4e 100644 --- a/python/fatcat_web/templates/release_view_fuzzy_refs.html +++ b/python/fatcat_web/templates/release_view_fuzzy_refs.html @@ -13,13 +13,15 @@ {% elif direction == "out" %}

References

NOTE: currently batch computed and may include additional references sources, or be missing recent changes, compared to entity reference list. -{% endif %} -{% if hits.result_refs %} - {{ refs_macros.refs_table(hits, direction) }} -{% else %} -

None found + {% if hits.count_total == 0 and release.refs %} +

+

No fuzzy references found, but there are {{ release.refs|count }} legacy references +

+ {% endif %} {% endif %} +{{ refs_macros.refs_table(hits, direction) }} + {% endblock %} diff --git a/python/fatcat_web/templates/wikipedia_view_fuzzy_refs.html b/python/fatcat_web/templates/wikipedia_view_fuzzy_refs.html index 5b53d692..3e1453c1 100644 --- a/python/fatcat_web/templates/wikipedia_view_fuzzy_refs.html +++ b/python/fatcat_web/templates/wikipedia_view_fuzzy_refs.html @@ -17,11 +17,7 @@ Refernces from wikipedia article to other entities. {% endif %} -{% if hits.result_refs %} - {{ refs_macros.refs_table(hits, direction) }} -{% else %} -

None found -{% endif %} +{{ refs_macros.refs_table(hits, direction) }} {% endblock %} -- cgit v1.2.3 From 37b6e99eec3cbc668d6b51ed9e57b93f9a114d2a Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 3 Aug 2021 18:15:10 -0700 Subject: refs: web UI tweaks for iterated CSL schema --- python/fatcat_web/templates/entity_macros.html | 22 +++++++++++++++++++--- python/tests/files/elastic_refs_out_release.json | 10 +++++++--- 2 files changed, 26 insertions(+), 6 deletions(-) (limited to 'python/fatcat_web/templates/entity_macros.html') diff --git a/python/fatcat_web/templates/entity_macros.html b/python/fatcat_web/templates/entity_macros.html index 562b99d3..6b565f69 100644 --- a/python/fatcat_web/templates/entity_macros.html +++ b/python/fatcat_web/templates/entity_macros.html @@ -457,15 +457,31 @@ yellow {% if csl.title and csl.author %}
{% endif %} {% if csl.author %} {% for author in csl.author[:8] %} - {# TODO: other name variants? #} - {{ author.name }} + {% 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 %} (+ more) {%endif %} {% endif %} {% if csl.issued or csl["container-title"] %}
{% endif %} - {% if csl.issued and csl.issued.raw %}{{ csl.issued.raw }}  {% 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"] %} {{ csl["container-title"] }} {% endif %} diff --git a/python/tests/files/elastic_refs_out_release.json b/python/tests/files/elastic_refs_out_release.json index 5e25d80f..5a45acee 100644 --- a/python/tests/files/elastic_refs_out_release.json +++ b/python/tests/files/elastic_refs_out_release.json @@ -152,11 +152,13 @@ "accessed": {}, "author": [ { - "name": "Alatawi Eman" + "raw_name": "Alatawi Eman" } ], "container-title": "Symbolic Execution with Invariant Inlay: Evaluating the Potential. In 2018 25th Australasian Software Engineering Conference, ASWEC 2018.", - "issued": {} + "issued": { + "date-parts": [[2019]] + } } }, "sort": [ @@ -185,7 +187,9 @@ } ], "container-title": "Symbolic Path-Oriented Test Data Generation for Floating-Point Programs. In Sixth IEEE International Conference on Software Testing, Verification and Validation, ICST", - "issued": {} + "issued": { + "raw": "2000" + } } }, "sort": [ -- cgit v1.2.3