diff options
author | Bryan Newbold <bnewbold@archive.org> | 2020-06-29 20:14:58 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2020-06-29 20:15:02 -0700 |
commit | 73e8d51006389076b85b16f88c29485a4cfcb4dd (patch) | |
tree | 8984272be5db29cf862afb74a2634027aa6ed003 /fatcat_scholar | |
parent | 14dcadd540fa4dff1db8aff80bda410c025edbdd (diff) | |
download | fatcat-scholar-73e8d51006389076b85b16f88c29485a4cfcb4dd.tar.gz fatcat-scholar-73e8d51006389076b85b16f88c29485a4cfcb4dd.zip |
fix SIM highlight HTML escapes
Thanks to Merlijn for finding the broken examples in QA.
Diffstat (limited to 'fatcat_scholar')
-rw-r--r-- | fatcat_scholar/templates/search_macros.html | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/fatcat_scholar/templates/search_macros.html b/fatcat_scholar/templates/search_macros.html index 59bf130..7ebbd32 100644 --- a/fatcat_scholar/templates/search_macros.html +++ b/fatcat_scholar/templates/search_macros.html @@ -103,9 +103,13 @@ {# ### ABSTRACT / QUERY HIGHLIGHT #} {% if paper._highlights %} <div style="padding-top: 0.5em; padding-bottom: 0.5em;" class="search_highlights"> - {% for highlight in paper._highlights %} - {{ highlight|safe }} ... - {% endfor %} + {# this highlight HTML escape hacking should not be necessary in ES 7.x with highlight escaping #} + {# but for now we manually escape, then de-escape the 'em' highlight tags #} + {% autoescape false %} + {% for highlight in paper._highlights %} + {{ highlight|e|replace("<em>", "<em>")|replace("</em>", "</em>") }} ... + {% endfor %} + {% endautoescape %} </div> {% elif paper.abstracts %} <div style="padding-top: 0.5em; padding-bottom: 0.5em;"> |