From 653432a70740a5920e8ac3ce02114d82dd5f8a05 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 3 Dec 2019 20:53:24 -0800 Subject: improve previous commit (JATS abstract hack) --- python/fatcat_web/entity_helpers.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'python/fatcat_web') diff --git a/python/fatcat_web/entity_helpers.py b/python/fatcat_web/entity_helpers.py index ab45c6e2..af0fea83 100644 --- a/python/fatcat_web/entity_helpers.py +++ b/python/fatcat_web/entity_helpers.py @@ -78,10 +78,12 @@ def enrich_release_entity(entity): 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('', '') + for tag in ('p', 'jats', 'jats:p'): + entity.abstracts[0].content = entity.abstracts[0].content.replace('<{}>'.format(tag), '') + entity.abstracts[0].content = entity.abstracts[0].content.replace(''.format(tag), '') + # ugh, double encoding happens + entity.abstracts[0].content = entity.abstracts[0].content.replace('</{}>'.format(tag), '') + entity.abstracts[0].content = entity.abstracts[0].content.replace('<{}>'.format(tag), '') return entity def enrich_work_entity(entity): -- cgit v1.2.3