summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;">