diff --git a/searx/templates/oscar/macros.html b/searx/templates/oscar/macros.html index 571242860..1cf46074f 100644 --- a/searx/templates/oscar/macros.html +++ b/searx/templates/oscar/macros.html @@ -19,9 +19,9 @@ {% macro result_sub_header(result, id) -%} - {% if result.publishedDate %}{% 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 %} + {%- if result.publishedDate %}{% 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 %} @@ -32,11 +32,11 @@ {{ engine }} {%- endfor -%} {%- if result.url -%} - {% if result.cached_url %} + {%- if result.cached_url -%} {{ result_link(result.cached_url, icon('link') + _('cached'), "text-info", id) }} - {% elif not result.is_onion %} + {%- elif not result.is_onion -%} {{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info", id) }} - {% endif %} + {%- endif -%} {%- endif -%} {%- if proxify -%} {{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info", id) }} @@ -49,73 +49,73 @@ {% macro result_footer_nocache(result) -%} -
+ {{- "" -}}{{ result.content|safe }}
{% endif -%} -{{ result.content|safe }}
{% endif -%} +{{ result.content|safe }}
{% endif -%} diff --git a/searx/templates/oscar/result_templates/files.html b/searx/templates/oscar/result_templates/files.html index 5e3894e0a..e2fec6f63 100644 --- a/searx/templates/oscar/result_templates/files.html +++ b/searx/templates/oscar/result_templates/files.html @@ -1,55 +1,55 @@ -{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer_nocache, result_footer_nocache_rtl, icon with context %} - -{{ result_header(result, favicons) }} -{{ result_sub_header(result) }} - -{% if result.embedded %} - • - {% if result.mtype == 'audio' %}{{ icon('music') }} - {% elif result.mtype == 'video' %} {{ icon('film') }} - {% endif %} {{ _('show media') }} -{% endif %} - -{% if result.embedded %} -{{ result.abstract|safe }}
{% endif %} - -{% if result.img_src %} -{{ result.content|safe }}
{% endif %} -{{ result.content|safe }}
{% endif %} -{% 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 }} |
{{ result.abstract|safe }}
{% endif -%} + +{%- if result.img_src -%} +{{ result.content|safe }}
{% endif -%} +{{ result.content|safe }}
{% endif -%} +{%- 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 result.address.name %}
+ {%- if result.address.name -%}
{{ result.address.name }}
- {% endif %}
- {% if result.address.road %}
+ {%- endif -%}
+ {%- if result.address.road -%}
- {% if result.address.house_number %}{{ result.address.house_number }}, {% endif %}
- {{ result.address.road }}
+ {%- if result.address.house_number %}{{ result.address.house_number }}, {% endif -%}
+ {{- result.address.road -}}
- {% endif %}
- {% if result.address.locality %}
+ {%- endif -%}
+ {%- if result.address.locality -%}
{{ result.address.locality }}
- {% if result.address.postcode %}, {{ result.address.postcode }}{% endif %}
+ {%- if result.address.postcode %}, {{ result.address.postcode }}{% endif -%}
- {% endif %}
- {% if result.address.country %}
+ {%- endif -%}
+ {%- if result.address.country -%}
{{ result.address.country }}
- {% endif %}
+ {%- endif -%}
{{ result.content|safe }}
{% endif %} +{%- if result.content %}{{ result.content|safe }}
{% endif -%}{{ icon('transfer') }} {{ _('Seeder') }} {{ result.seed }} • {{ _('Leecher') }} {{ result.leech }}{% endif %}
-{% if result.filesize %}
{{ icon('floppy-disk') }} {{ _('Filesize') }}
+{%- if result.seed is defined %}
{{ icon('transfer') }} {{ _('Seeder') }} {{ result.seed }} • {{ _('Leecher') }} {{ result.leech }}{% endif -%}
+{%- if result.filesize %}
{{ icon('floppy-disk') }} {{ _('Filesize') -}}
- {% if result.filesize < 1024 %}{{ result.filesize }} {{ _('Bytes') }}
- {% elif result.filesize < 1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024) }} {{ _('kiB') }}
- {% elif result.filesize < 1024*1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024/1024) }} {{ _('MiB') }}
- {% elif result.filesize < 1024*1024*1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024/1024/1024) }} {{ _('GiB') }}
- {% else %}{{ '{0:0.2f}'.format(result.filesize/1024/1024/1024/1024) }} {{ _('TiB') }}{% endif %}
- {% endif %}
-{% if result.files %}
{{ icon('file') }} {{ _('Number of Files') }} {{ result.files }}{% endif %}
+ {%- if result.filesize < 1024 %}{{ result.filesize }} {{ _('Bytes') -}}
+ {%- elif result.filesize < 1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024) }} {{ _('kiB') -}}
+ {%- elif result.filesize < 1024*1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024/1024) }} {{ _('MiB') -}}
+ {%- elif result.filesize < 1024*1024*1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024/1024/1024) }} {{ _('GiB') -}}
+ {%- else %}{{ '{0:0.2f}'.format(result.filesize/1024/1024/1024/1024) }} {{ _('TiB') }}{% endif -%}
+ {% endif -%}
+{%- if result.files %}
{{ icon('file') }} {{ _('Number of Files') }} {{ result.files }}{% endif -%}
-{% if result.content %}
{{ result.content|safe }}{% endif %}
+{%- if result.content %}
{{ result.content|safe }}{% endif -%}
{{ _('Author') }}: {{ result.author }}
{% endif %} - {% if result.length %}{{ _('Length') }}: {{ result.length }}
{% endif %} - {% if result.content %}{{ result.content|safe }}
{% endif %} -{{ _('Author') }}: {{ result.author }}
{% endif -%} + {%- if result.length %}{{ _('Length') }}: {{ result.length }}
{% endif -%} + {%- if result.content %}{{ result.content|safe }}
{% endif -%} +