diff --git a/searx/templates/oscar/macros.html b/searx/templates/oscar/macros.html index 809c9f595..58f966997 100644 --- a/searx/templates/oscar/macros.html +++ b/searx/templates/oscar/macros.html @@ -8,34 +8,34 @@ {{ favicon }} {%- endmacro %} -{%- macro result_link(url, title, classes='') -%} -{{ title }} +{%- macro result_link(url, title, classes='', id='') -%} +{{ title }} {%- endmacro -%} -{% macro result_header(result, favicons) -%} -

{% if result.engine~".png" in favicons %}{{ draw_favicon(result.engine) }} {% endif %}{% if result.url %}{{ result_link(result.url, result.title|safe) }}{% else %}{{ result.title|safe}}{% endif %}

+{% macro result_header(result, favicons, id) -%} +

{% if result.engine~".png" in favicons %}{{ draw_favicon(result.engine) }} {% endif %}{% if result.url %}{{ result_link(result.url, result.title|safe, id=id) }}{% else %}{{ result.title|safe}}{% endif %}

{%- endmacro %} -{% macro result_sub_header(result) -%} +{% macro result_sub_header(result, id) -%} {% if result.publishedDate %}{% endif %} - {% if result.magnetlink %} • {{ result_link(result.magnetlink, icon('magnet') + _('magnet link'), "magnetlink") }}{% endif %} - {% if result.torrentfile %} • {{ result_link(result.torrentfile, icon('download-alt') + _('torrent file'), "torrentfile") }}{% endif %} + {% if result.magnetlink %} • {{ result_link(result.magnetlink, icon('magnet') + _('magnet link'), "magnetlink", id) }}{% endif %} + {% if result.torrentfile %} • {{ result_link(result.torrentfile, icon('download-alt') + _('torrent file'), "torrentfile", id) }}{% endif %} {%- endmacro %} -{% macro result_footer(result) -%} +{% macro result_footer(result, id) -%}
{{- "" -}}
{%- for engine in result.engines -%} {{ engine }} {%- endfor -%} {%- if result.url -%} - {{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info") }} + {{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info", id) }} {%- endif -%} {%- if proxify -%} - {{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info") }} + {{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info", id) }} {%- endif -%}
{%- if result.pretty_url -%} @@ -44,16 +44,16 @@ {%- endmacro %} -{% macro result_footer_rtl(result) -%} +{% macro result_footer_rtl(result, id) -%}
{{- "" -}} {% for engine in result.engines -%} {{ engine }} {%- endfor %} {%- if result.url -%} - {{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info") }} + {{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info", id) }} {%- endif -%} {% if proxify -%} - {{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info") }} + {{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info", id) }} {%- endif %} {%- if result.pretty_url -%} diff --git a/searx/templates/oscar/result_templates/code.html b/searx/templates/oscar/result_templates/code.html index a1c18a6b7..c7d93e2b3 100644 --- a/searx/templates/oscar/result_templates/code.html +++ b/searx/templates/oscar/result_templates/code.html @@ -1,11 +1,11 @@ -{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %} +{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon with context%} {{ result_header(result, favicons) }} {{ result_sub_header(result) }} {% if result.content %}

{{ result.content|safe }}

{% endif %} -{% if result.repository %}

{{ icon('file') }} {{ result.repository }}

{% endif %} +{% if result.repository %}

{{ icon('file') }} {{ result.repository }}

{% endif %}
{{ result.codelines|code_highlighter(result.code_language)|safe }} diff --git a/searx/templates/oscar/result_templates/default.html b/searx/templates/oscar/result_templates/default.html index 57365f34e..bc71d190d 100644 --- a/searx/templates/oscar/result_templates/default.html +++ b/searx/templates/oscar/result_templates/default.html @@ -1,10 +1,10 @@ {% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon with context %} -{{- result_header(result, favicons) -}} -{{- result_sub_header(result) -}} +{{- result_header(result, favicons, loop.index) -}} +{{- result_sub_header(result, loop.index) -}} {%- if result.embedded -%} - + {%- endif -%} {%- if result.embedded -%} @@ -25,7 +25,7 @@ {%- endif -%} {%- if rtl -%} -{{ result_footer_rtl(result) }} +{{ result_footer_rtl(result, loop.index) }} {%- else -%} -{{ result_footer(result) }} +{{ result_footer(result, loop.index) }} {%- endif -%} diff --git a/searx/templates/oscar/result_templates/images.html b/searx/templates/oscar/result_templates/images.html index d0a3b7b83..96cdd53bb 100644 --- a/searx/templates/oscar/result_templates/images.html +++ b/searx/templates/oscar/result_templates/images.html @@ -1,6 +1,6 @@ -{%- from 'oscar/macros.html' import draw_favicon -%} +{%- from 'oscar/macros.html' import draw_favicon with context -%} -{{- "" -}} +{{- "" -}} {{ result.title|striptags }}{{- "" -}}