diff options
| author | Markus Heiser <markus.heiser@darmarit.de> | 2025-10-13 09:28:42 +0200 |
|---|---|---|
| committer | Markus Heiser <markus.heiser@darmarIT.de> | 2025-10-20 10:18:33 +0200 |
| commit | 937165853185ca16b0da6f72bc42bd1487ea0dcb (patch) | |
| tree | 70da1dce7cb51d0f59cd36392103e8f33318f379 /docs | |
| parent | ee6d4f322f4bda18759ffb99380a06923424695b (diff) | |
[mod] typification of SearXNG: add new result type File
This PR adds a new result type: File
Python class: searx/result_types/file.py
Jinja template: searx/templates/simple/result_templates/file.html
CSS (less) client/simple/src/less/result_types/file.less
Class 'File' (singular) replaces template 'files.html' (plural). The renaming
was carried out because there is only one file (singular) in a result. Not to be
confused with the category 'files' where in multiple results can exist.
As mentioned in issue [1], the class '.category-files' was removed from the CSS
and the stylesheet was adopted in result_types/file.less (there based on the
templates and no longer based on the category).
[1] https://github.com/searxng/searxng/issues/5198
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/dev/result_types/main/file.rst | 7 | ||||
| -rw-r--r-- | docs/dev/result_types/main_result.rst | 2 | ||||
| -rw-r--r-- | docs/dev/templates.rst | 34 |
3 files changed, 9 insertions, 34 deletions
diff --git a/docs/dev/result_types/main/file.rst b/docs/dev/result_types/main/file.rst new file mode 100644 index 000000000..3694cd905 --- /dev/null +++ b/docs/dev/result_types/main/file.rst @@ -0,0 +1,7 @@ +.. _result_types.file: + +============ +File Results +============ + +.. automodule:: searx.result_types.file diff --git a/docs/dev/result_types/main_result.rst b/docs/dev/result_types/main_result.rst index f3d09c011..eff56740c 100644 --- a/docs/dev/result_types/main_result.rst +++ b/docs/dev/result_types/main_result.rst @@ -17,6 +17,7 @@ following types have been implemented so far .. main/keyvalue main/code main/paper + main/file The :ref:`LegacyResult <LegacyResult>` is used internally for the results that have not yet been typed. The templates can be used as orientation until the @@ -28,5 +29,4 @@ final typing is complete. - :ref:`template torrent` - :ref:`template map` - :ref:`template packages` -- :ref:`template files` - :ref:`template products` diff --git a/docs/dev/templates.rst b/docs/dev/templates.rst index e2fa879c8..1995dac48 100644 --- a/docs/dev/templates.rst +++ b/docs/dev/templates.rst @@ -60,7 +60,7 @@ Fields used in the template :origin:`macro result_sub_header publishedDate : :py:obj:`datetime.datetime` The date on which the object was published. -length: :py:obj:`time.struct_time` +length: :py:obj:`datetime.timedelta` Playing duration in seconds. views: :py:class:`str` @@ -469,38 +469,6 @@ links : :py:class:`dict` Additional links in the form of ``{'link_name': 'http://example.com'}`` -.. _template files: - -``files.html`` --------------- - -Displays result fields from: - -- :ref:`macro result_header` and -- :ref:`macro result_sub_header` - -Additional fields used in the :origin:`code.html -<searx/templates/simple/result_templates/files.html>`: - -filename, size, time: :py:class:`str` - Filename, Filesize and Date of the file. - -mtype : ``audio`` | ``video`` | :py:class:`str` - Mimetype type of the file. - -subtype : :py:class:`str` - Mimetype / subtype of the file. - -abstract : :py:class:`str` - Abstract of the file. - -author : :py:class:`str` - Name of the author of the file - -embedded : :py:class:`str` - URL of an embedded media type (``audio`` or ``video``) / is collapsible. - - .. _template products: ``products.html`` |