aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_web
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-12-03 20:45:21 -0800
committerBryan Newbold <bnewbold@robocracy.org>2019-12-03 20:45:26 -0800
commit9eb548c9b325a8eeb800b4432ef78dfbfe02834a (patch)
tree24f9470e0be0073229d6be75ee8d806be65c57dc /python/fatcat_web
parentf1bf46cac6c59964c285f03bf93c2856eeb231ef (diff)
downloadfatcat-9eb548c9b325a8eeb800b4432ef78dfbfe02834a.tar.gz
fatcat-9eb548c9b325a8eeb800b4432ef78dfbfe02834a.zip
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.
Diffstat (limited to 'python/fatcat_web')
-rw-r--r--python/fatcat_web/entity_helpers.py8
1 files changed, 7 insertions, 1 deletions
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('<jats>', '')
+ entity.abstracts[0].content = entity.abstracts[0].content.replace('</jats>', '')
+ entity.abstracts[0].content = entity.abstracts[0].content.replace('<jats:p>', '')
+ entity.abstracts[0].content = entity.abstracts[0].content.replace('</jats:p>', '')
return entity
def enrich_work_entity(entity):