From f34ac58752b3857468d01c79d7bc3409e8b03fe3 Mon Sep 17 00:00:00 2001 From: Dalf Date: Tue, 6 Aug 2019 11:41:16 +0200 Subject: [mod] tidy oscar HTML output --- searx/templates/oscar/infobox.html | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'searx/templates/oscar/infobox.html') diff --git a/searx/templates/oscar/infobox.html b/searx/templates/oscar/infobox.html index c98fb0e63..9f5e58d2b 100644 --- a/searx/templates/oscar/infobox.html +++ b/searx/templates/oscar/infobox.html @@ -1,34 +1,35 @@ {% from 'oscar/macros.html' import result_link with context %}
-
-

{{ infobox.infobox }}

+
{{- "" -}} +

{{ infobox.infobox }}

{{- "" -}}
{% if infobox.img_src %}{{ infobox.infobox }}{% endif %} - {% if infobox.content %}

{{ infobox.content }}

{% endif %} - {% if infobox.attributes %} + {% if infobox.content %}

{{ infobox.content }}

{% endif %} + + {% if infobox.attributes -%} - {% for attribute in infobox.attributes %} - + {% for attribute in infobox.attributes -%} + {{- "" -}} - {% if attribute.image %} + {%- if attribute.image -%} - {% else %} + {%- else -%} - {% endif %} + {%- endif -%} - {% endfor %} + {% endfor -%}
{{ attribute.label }}{{ attribute.image.alt }}{{ attribute.value }}
{% endif %} - {% if infobox.urls %} -
+ {% if infobox.urls -%} +
{{- "\n" -}} - {% for url in infobox.urls %} -

{{ result_link(url.url, url.title) }}

- {% endfor %} -
+ {%- for url in infobox.urls -%} +

{{ result_link(url.url, url.title) }}

+ {% endfor -%} + {{- "" -}}
{% endif %}
-- cgit v1.2.3 From 8bea927bb02e02754834d6f9692942f621bd21c5 Mon Sep 17 00:00:00 2001 From: Vipul Date: Sun, 22 Dec 2019 01:21:22 +0000 Subject: [Fix] oscar: no HTML escaping prior to output When results are fetched from any programming related documentation site (like git-scm.com, docs.python.org etc), content in Info box is shown as raw HTML code. This change addresses the issue by using "safe" filter feature provided by Django. See, - https://docs.djangoproject.com/en/3.0/ref/templates/builtins/#safe - Searx issue tracker (issue #1649), for more information. Resolves: #1649 --- searx/templates/oscar/infobox.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'searx/templates/oscar/infobox.html') diff --git a/searx/templates/oscar/infobox.html b/searx/templates/oscar/infobox.html index 9f5e58d2b..9802f11e2 100644 --- a/searx/templates/oscar/infobox.html +++ b/searx/templates/oscar/infobox.html @@ -6,7 +6,7 @@
{% if infobox.img_src %}{{ infobox.infobox }}{% endif %} - {% if infobox.content %}

{{ infobox.content }}

{% endif %} + {% if infobox.content %}

{{ infobox.content | safe }}

{% endif %} {% if infobox.attributes -%} -- cgit v1.2.3