From 2b0dd96bd34a086b9bc4e008823b73bf4fcd8133 Mon Sep 17 00:00:00 2001 From: Alexandre Flament Date: Wed, 17 Mar 2021 09:22:05 +0100 Subject: [PATCH] [mod] oscar: remove space * reduce by 15% the uncompressed output (on average) * dos2unix searx/templates/oscar/result_templates/files.html --- searx/templates/oscar/macros.html | 102 ++++++++-------- .../oscar/result_templates/default.html | 12 +- .../oscar/result_templates/files.html | 110 +++++++++--------- .../templates/oscar/result_templates/map.html | 56 ++++----- .../oscar/result_templates/torrent.html | 30 ++--- .../oscar/result_templates/videos.html | 32 ++--- 6 files changed, 171 insertions(+), 171 deletions(-) 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) -%} -
+
{{- "" -}}
- {% for engine in result.engines %} + {%- for engine in result.engines -%} {{ engine }} - {% endfor %} - {% if proxify %} + {%- endfor -%} + {%- if proxify -%} {{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info") }} - {% endif %} -
+ {%- endif -%} +{{- "" -}} {%- endmacro %} {% macro result_footer_rtl(result, id) -%} -
{{- "" -}} - {% for engine in result.engines -%} +
+ {%- for engine in result.engines -%} {{ engine }} - {%- endfor %} + {%- 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 -%} + {%- if proxify -%} {{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info", id) }} - {%- endif %} + {%- endif -%} {%- if result.pretty_url -%} - {%- endif %} + {%- endif -%} {%- endmacro %} {% macro result_footer_nocache_rtl(result) -%}
- {% for engine in result.engines %} + {%- for engine in result.engines -%} {{ engine }} - {% endfor %} - {% if proxify %} + {%- endfor -%} + {%- if proxify -%} {{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info") }} - {% endif %} + {%- endif -%} {%- endmacro %} {% macro preferences_item_header(info, label, rtl, id) -%} - {% if rtl %} -
- - {{ info }} + {%- if rtl -%} +
{{- "" -}} + {{- "" -}} + {{ info }}{{- "" -}}
- {% else %} -
- + {%- else -%} +
{{- "" -}} + {{- "" -}}
- {% endif %} + {%- endif -%} {%- endmacro %} {% macro preferences_item_footer(info, label, rtl) -%} - {% if rtl %} -
+ {%- if rtl -%} +
{{- "" -}}
- {% else %} + {%- else -%}
- {{ info }} + {{ info }}{{- "" -}}
- {% endif %} + {%- endif -%} {%- endmacro %} {% macro custom_select_class(rtl) -%} @@ -123,24 +123,24 @@ custom-select{% if rtl %}-rtl{% endif %} {%- endmacro %} {% macro checkbox_toggle(id, blocked) -%} -
- - - -
+
{{- "" -}} + {{- "" -}} + {{- "" -}} + {{- "" -}} +
{{- "" -}} {%- endmacro %} {% macro support_toggle(supports) -%} - {% if supports %} + {%- if supports -%} - {{ _("supported") }} + {{- _("supported") -}} - {% else %} + {%- else -%} - {{ _("not supported") }} + {{- _("not supported") -}} - {% endif %} + {%- endif -%} {%- endmacro %} diff --git a/searx/templates/oscar/result_templates/default.html b/searx/templates/oscar/result_templates/default.html index bc71d190d..d743f928e 100644 --- a/searx/templates/oscar/result_templates/default.html +++ b/searx/templates/oscar/result_templates/default.html @@ -9,16 +9,16 @@ {%- if result.embedded -%}
- {{ result.embedded|safe }} + {{- result.embedded|safe -}}
{%- endif -%} {%- if result.img_src -%} -
-
- -{% if result.content %}

{{ result.content|safe }}

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

{{ result.content|safe }}

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

{{ 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 %} - -{% 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 %} - - -{% if rtl %} -{{ result_footer_nocache_rtl(result) }} -{% else %} -{{ result_footer_nocache(result) }} -{% endif %} +{% 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 -%} + +{%- 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 -%} + + +{%- if rtl -%} +{{ result_footer_nocache_rtl(result) }} +{%- else -%} +{{ result_footer_nocache(result) }} +{%- endif -%} diff --git a/searx/templates/oscar/result_templates/map.html b/searx/templates/oscar/result_templates/map.html index be34d65d0..9713452b3 100644 --- a/searx/templates/oscar/result_templates/map.html +++ b/searx/templates/oscar/result_templates/map.html @@ -1,15 +1,15 @@ {% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %} -{{ result_header(result, favicons, loop.index) }} -{{ result_sub_header(result, loop.index) }} +{{- result_header(result, favicons, loop.index) -}} +{{- result_sub_header(result, loop.index) -}} -{% if (result.latitude and result.longitude) or result.boundingbox %} +{%- if (result.latitude and result.longitude) or result.boundingbox -%} -{% endif %} +{%- endif -%} -{% if result.osm and (result.osm.type and result.osm.id) %} +{%- if result.osm and (result.osm.type and result.osm.id) -%} -{% endif %} +{%- endif -%} {# {% if (result.latitude and result.longitude) %} @@ -17,36 +17,36 @@
-{% if result.address %} +{%- if result.address -%}

- {% 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 -%}

-{% endif %} +{%- endif %} -{% if result.osm and (result.osm.type and result.osm.id) %} +{%- if result.osm and (result.osm.type and result.osm.id) -%}
Loading ...
-{% endif %} +{%- endif -%} {# {% if (result.latitude and result.longitude) %}
@@ -55,18 +55,18 @@
{% endif %} #} -{% if result.content %}

{{ result.content|safe }}

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

{{ result.content|safe }}

{% endif -%}
-{% if (result.latitude and result.longitude) or result.boundingbox %} +{%- if (result.latitude and result.longitude) or result.boundingbox -%}
-{% endif %} +{%- endif -%} -{% if rtl %} -{{ result_footer_rtl(result, loop.index) }} +{%- if rtl -%} +{{- result_footer_rtl(result, loop.index) -}} {% else %} -{{ result_footer(result, loop.index) }} -{% endif %} +{{- result_footer(result, loop.index) -}} +{%- endif -%} diff --git a/searx/templates/oscar/result_templates/torrent.html b/searx/templates/oscar/result_templates/torrent.html index 0bba61417..9f6671549 100644 --- a/searx/templates/oscar/result_templates/torrent.html +++ b/searx/templates/oscar/result_templates/torrent.html @@ -1,25 +1,25 @@ {% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %} -{{ result_header(result, favicons, loop.index) }} -{{ result_sub_header(result, loop.index) }} +{{- result_header(result, favicons, loop.index) -}} +{{- result_sub_header(result, loop.index) -}} -{% if result.seed is defined %}

{{ 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 -%}

-{% if rtl %} +{%- if rtl -%} {{ result_footer_rtl(result, loop.index) }} -{% else %} +{%- else -%} {{ result_footer(result, loop.index) }} -{% endif %} +{%- endif -%} diff --git a/searx/templates/oscar/result_templates/videos.html b/searx/templates/oscar/result_templates/videos.html index bf02a553a..ad17ffe33 100644 --- a/searx/templates/oscar/result_templates/videos.html +++ b/searx/templates/oscar/result_templates/videos.html @@ -1,29 +1,29 @@ {% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %} -{{ result_header(result, favicons, loop.index) }} -{{ result_sub_header(result, loop.index) }} +{{- result_header(result, favicons, loop.index) -}} +{{- result_sub_header(result, loop.index) -}} -{% if result.embedded %} +{%- if result.embedded -%} -{% endif %} +{%- endif -%} -{% if result.embedded %} +{%- if result.embedded -%}
- {{ result.embedded|safe }} + {{- result.embedded|safe -}}
-{% endif %} +{%- endif -%} -
-
+
{{- "" -}} +
{{- "" -}} - {% if result.author %}

{{ _('Author') }}: {{ result.author }}

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

{{ _('Length') }}: {{ result.length }}

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

{{ result.content|safe }}

{% endif %} -
+ {%- if result.author %}

{{ _('Author') }}: {{ result.author }}

{% endif -%} + {%- if result.length %}

{{ _('Length') }}: {{ result.length }}

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

{{ result.content|safe }}

{% endif -%} +
{{- "" -}}
-{% if rtl %} +{%- if rtl -%} {{ result_footer_rtl(result, loop.index) }} -{% else %} +{%- else -%} {{ result_footer(result, loop.index) }} -{% endif %} +{%- endif -%}