From 9eb548c9b325a8eeb800b4432ef78dfbfe02834a Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 3 Dec 2019 20:45:21 -0800 Subject: hack: remove enclosing JATS XML tags around abstracts The more complete fix is to actually render the JATS to HTML and display that. This is just to fix a nit with the most common case of XML tags in abstracts. --- python/fatcat_web/entity_helpers.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'python/fatcat_web/entity_helpers.py') diff --git a/python/fatcat_web/entity_helpers.py b/python/fatcat_web/entity_helpers.py index 043c67ca..ab45c6e2 100644 --- a/python/fatcat_web/entity_helpers.py +++ b/python/fatcat_web/entity_helpers.py @@ -72,10 +72,16 @@ def enrich_release_entity(entity): # index=None go to end of list) authors = [c for c in entity.contribs if c.role in ('author', None)] entity._authors = sorted(authors, key=lambda c: (c.index == None and 99999999) or c.index) - # hack to show plain text instead of latex abstracts if entity.abstracts: + # hack to show plain text instead of latex abstracts if 'latex' in entity.abstracts[0].mimetype: entity.abstracts.reverse() + # hack to (partially) clean up common JATS abstract display case + if entity.abstracts[0].mimetype == 'application/xml+jats': + entity.abstracts[0].content = entity.abstracts[0].content.replace('', '') + entity.abstracts[0].content = entity.abstracts[0].content.replace('', '') + entity.abstracts[0].content = entity.abstracts[0].content.replace('', '') + entity.abstracts[0].content = entity.abstracts[0].content.replace('', '') return entity def enrich_work_entity(entity): -- cgit v1.2.3