diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-12-03 20:53:24 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-12-03 20:53:24 -0800 |
commit | 653432a70740a5920e8ac3ce02114d82dd5f8a05 (patch) | |
tree | 5a2a6d7c479227d7d2919c08cdb83f7d9ee155f8 /python/fatcat_web | |
parent | 9eb548c9b325a8eeb800b4432ef78dfbfe02834a (diff) | |
download | fatcat-653432a70740a5920e8ac3ce02114d82dd5f8a05.tar.gz fatcat-653432a70740a5920e8ac3ce02114d82dd5f8a05.zip |
improve previous commit (JATS abstract hack)
Diffstat (limited to 'python/fatcat_web')
-rw-r--r-- | python/fatcat_web/entity_helpers.py | 10 |
1 files changed, 6 insertions, 4 deletions
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('<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>', '') + 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): |