From 9ac9c8c4f50acd801bfc39107c94d17ee9bee72b Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Thu, 21 Aug 2025 17:57:58 +0200 Subject: [mod] typification of SearXNG: add new result type Code This patch adds a new result type: Code - Python class: searx/result_types/code.py - Jinja template: searx/templates/simple/result_templates/code.html - CSS (less) client/simple/src/less/result_types/code.less Signed-of-by: Markus Heiser --- docs/conf.py | 1 + docs/dev/result_types/main/code.rst | 7 +++++++ docs/dev/result_types/main_result.rst | 2 +- docs/dev/templates.rst | 27 --------------------------- 4 files changed, 9 insertions(+), 28 deletions(-) create mode 100644 docs/dev/result_types/main/code.rst (limited to 'docs') diff --git a/docs/conf.py b/docs/conf.py index a7221e48b..2d730f58c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -150,6 +150,7 @@ intersphinx_mapping = { "linuxdoc" : ("https://return42.github.io/linuxdoc/", None), "sphinx" : ("https://www.sphinx-doc.org/en/master/", None), "valkey": ('https://valkey-py.readthedocs.io/en/stable/', None), + "pygments": ("https://pygments.org/", None), } issues_github_path = "searxng/searxng" diff --git a/docs/dev/result_types/main/code.rst b/docs/dev/result_types/main/code.rst new file mode 100644 index 000000000..399cbd26e --- /dev/null +++ b/docs/dev/result_types/main/code.rst @@ -0,0 +1,7 @@ +.. _result_types.code: + +============ +Code Results +============ + +.. automodule:: searx.result_types.code diff --git a/docs/dev/result_types/main_result.rst b/docs/dev/result_types/main_result.rst index a76ed5e88..f072ea757 100644 --- a/docs/dev/result_types/main_result.rst +++ b/docs/dev/result_types/main_result.rst @@ -15,6 +15,7 @@ following types have been implemented so far .. main/mainresult main/keyvalue + main/code The :ref:`LegacyResult ` is used internally for the results that have not yet been typed. The templates can be used as orientation until the @@ -27,6 +28,5 @@ final typing is complete. - :ref:`template map` - :ref:`template paper` - :ref:`template packages` -- :ref:`template code` - :ref:`template files` - :ref:`template products` diff --git a/docs/dev/templates.rst b/docs/dev/templates.rst index 3633eb2ef..e2fa879c8 100644 --- a/docs/dev/templates.rst +++ b/docs/dev/templates.rst @@ -469,33 +469,6 @@ links : :py:class:`dict` Additional links in the form of ``{'link_name': 'http://example.com'}`` -.. _template code: - -``code.html`` -------------- - -Displays result fields from: - -- :ref:`macro result_header` and -- :ref:`macro result_sub_header` - -Additional fields used in the :origin:`code.html -`: - -content : :py:class:`str` - Description of the code fragment. - -codelines : ``[line1, line2, ...]`` - Lines of the code fragment. - -code_language : :py:class:`str` - Name of the code language, the value is passed to - :py:obj:`pygments.lexers.get_lexer_by_name`. - -repository : :py:class:`str` - URL of the repository of the code fragment. - - .. _template files: ``files.html`` -- cgit v1.2.3