From 73e8d51006389076b85b16f88c29485a4cfcb4dd Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 29 Jun 2020 20:14:58 -0700 Subject: fix SIM highlight HTML escapes Thanks to Merlijn for finding the broken examples in QA. --- fatcat_scholar/templates/search_macros.html | 10 +++++++--- 1 file 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 %}
- {% 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>", "")|replace("</em>", "") }}  ...  + {% endfor %} + {% endautoescape %}
{% elif paper.abstracts %}
-- cgit v1.2.3