aboutsummaryrefslogtreecommitdiffstats
path: root/fatcat_scholar/templates
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-06-29 20:14:58 -0700
committerBryan Newbold <bnewbold@archive.org>2020-06-29 20:15:02 -0700
commit73e8d51006389076b85b16f88c29485a4cfcb4dd (patch)
tree8984272be5db29cf862afb74a2634027aa6ed003 /fatcat_scholar/templates
parent14dcadd540fa4dff1db8aff80bda410c025edbdd (diff)
downloadfatcat-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/templates')
-rw-r--r--fatcat_scholar/templates/search_macros.html10
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 }} &nbsp;...&nbsp;
- {% 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("&lt;em&gt;", "<em>")|replace("&lt;/em&gt;", "</em>") }} &nbsp;...&nbsp;
+ {% endfor %}
+ {% endautoescape %}
</div>
{% elif paper.abstracts %}
<div style="padding-top: 0.5em; padding-bottom: 0.5em;">