From fa7fef7d873b49c763b93406735f62ca38efba68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=B3genes=20Oliveira?= Date: Thu, 6 Apr 2023 15:41:25 -0300 Subject: [PATCH] Provide template for results in file category This is used, for instance, by the recoll engine. --- .../simple/result_templates/files.html | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 searx/templates/simple/result_templates/files.html diff --git a/searx/templates/simple/result_templates/files.html b/searx/templates/simple/result_templates/files.html new file mode 100644 index 000000000..4b0147ec7 --- /dev/null +++ b/searx/templates/simple/result_templates/files.html @@ -0,0 +1,56 @@ +{% from 'simple/macros.html' import result_header, result_sub_header, result_sub_footer, result_footer, result_link with context %} +{% from 'simple/icons.html' import icon_small %} + +{{- result_header(result, favicons, image_proxify) -}} +{{- result_sub_header(result) -}} + +{%- if result.embedded -%} + +{%- endif -%} + +{%- if result.embedded -%} +
+ {{- result.embedded|safe -}} +
+{%- endif -%} + +{%- if result.abstract %}

{{ result.abstract|safe }}

{% endif -%} + +{%- if result.img_src -%} +
+
+{{ result.title|striptags }} +{%- if result.content %}

{{ result.content|safe }}

{% endif -%} +
+
+{%- else -%} +{%- if result.content %}

{{ result.content|safe }}

{% endif -%} +{%- endif -%} + + +{%- if result.author %}{% endif -%} + +{%- if result.filename %}{% endif -%} + +{%- if result.size %} +{%- endif -%} + +{%- if result.time %}{% endif -%} + +{%- if result.mtype %}{% endif -%} +
{{ _('Author') }}{{ result.author|safe }}
{{ _('Filename') }}{{ result.filename|safe }}
{{ _('Filesize') }} + {%- if result.size < 1024 %}{{ result.size }} {{ _('Bytes') -}} + {%- elif result.size < 1024*1024 %}{{ '{0:0.2f}'.format(result.size/1024) }} {{ _('kiB') -}} + {%- elif result.size < 1024*1024*1024 %}{{ '{0:0.2f}'.format(result.size/1024/1024) }} {{ _('MiB') -}} + {%- elif result.size < 1024*1024*1024*1024 %}{{ '{0:0.2f}'.format(result.size/1024/1024/1024) }} {{ _('GiB') -}} + {%- else %}{{ '{0:0.2f}'.format(result.size/1024/1024/1024/1024) }} {{ _('TiB') }}{% endif -%} +
{{ _('Date') }}{{ result.time|safe }}
{{ _('Type') }}{{ result.mtype|safe }}/{{ result.subtype|safe }}
+ +{%- if rtl -%} +{{ result_sub_footer(result) }} +{%- else -%} +{{ result_footer(result) }} +{%- endif -%}