aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_web
diff options
context:
space:
mode:
authorbnewbold <bnewbold@archive.org>2020-03-26 22:35:28 +0000
committerbnewbold <bnewbold@archive.org>2020-03-26 22:35:28 +0000
commitea241c0718407285774bff85e4b3b99aed0b9186 (patch)
treef28b9730adc570347ad48b17bb0482d1c9ced3c8 /python/fatcat_web
parentec82404f0d0ad6b92491a1cb90a823d421857348 (diff)
parentec15f162706da58c464b5c2b7b623920fcb96d7f (diff)
downloadfatcat-ea241c0718407285774bff85e4b3b99aed0b9186.tar.gz
fatcat-ea241c0718407285774bff85e4b3b99aed0b9186.zip
Merge branch 'bnewbold-citeproc-fixes' into 'master'
improve citeproc/CSL web interface See merge request webgroup/fatcat!36
Diffstat (limited to 'python/fatcat_web')
-rw-r--r--python/fatcat_web/entity_helpers.py7
-rw-r--r--python/fatcat_web/templates/release_view.html3
2 files changed, 7 insertions, 3 deletions
diff --git a/python/fatcat_web/entity_helpers.py b/python/fatcat_web/entity_helpers.py
index 591dda80..009f6160 100644
--- a/python/fatcat_web/entity_helpers.py
+++ b/python/fatcat_web/entity_helpers.py
@@ -74,8 +74,13 @@ def enrich_release_entity(entity):
ref.extra['unstructured'] = strip_extlink_xml(ref.extra['unstructured'])
# author list to display; ensure it's sorted by index (any othors with
# index=None go to end of list)
- authors = [c for c in entity.contribs if c.role in ('author', None)]
+ authors = [c for c in entity.contribs if
+ c.role in ('author', None) and
+ (c.surname or c.raw_name or (c.creator and c.creator.surname))
+ ]
entity._authors = sorted(authors, key=lambda c: (c.index == None and 99999999) or c.index)
+ # need authors, title for citeproc to work
+ entity._can_citeproc = bool(entity._authors) and bool(entity.title)
if entity.abstracts:
# hack to show plain text instead of latex abstracts
if 'latex' in entity.abstracts[0].mimetype:
diff --git a/python/fatcat_web/templates/release_view.html b/python/fatcat_web/templates/release_view.html
index 961b4759..d7c4e76e 100644
--- a/python/fatcat_web/templates/release_view.html
+++ b/python/fatcat_web/templates/release_view.html
@@ -388,8 +388,7 @@ accessible version.
<br>grouping other versions (eg, pre-print) and variants of this release
</div>
-{# this restriction, for CSL-JSON generation, rules out almost everything #}
-{% if release.contribs and release.contribs[0].creator_id %}
+{% if release._can_citeproc %}
<div class="ui segment attached accordion">
<div class="title" style="padding: 0px;">
<i class="dropdown icon"></i><b>Cite This Release</b>