[docs] fix some typos in the description of result class Code (#5174)

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2025-09-03 14:53:01 +02:00 committed by GitHub
parent f24d85bc4b
commit f91c998aa0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,7 +1,7 @@
# SPDX-License-Identifier: AGPL-3.0-or-later # SPDX-License-Identifier: AGPL-3.0-or-later
"""Typification of the *code* results. Results of this type are rendered in """Typification of the *code* results. Results of this type are rendered in
the :origin:`code.html <searx/templates/simple/result_templates/code.html>` the :origin:`code.html <searx/templates/simple/result_templates/code.html>`
template. For highlighting the code passages, Pygments is used. template. For highlighting the code passages, Pygments_ is used.
.. _Pygments: https://pygments.org .. _Pygments: https://pygments.org
@ -44,20 +44,19 @@ def is_valid_language(code_language: str) -> bool:
@t.final @t.final
class Code(MainResult, kw_only=True): class Code(MainResult, kw_only=True):
"""Simple table view which maps *key* names (first col) to *values* """Result type suitable for displaying code passages."""
(second col)."""
template: str = "code.html" template: str = "code.html"
repository: str | None = None repository: str | None = None
"""A link related to a repository related to the *result*""" """A link related to a repository related to the *result*."""
codelines: list[tuple[int, str]] = [] codelines: list[tuple[int, str]] = []
"""A list of two digit tuples where the first item is the line number and """A list of two digit tuples where the first item is the line number and
the second item is the code line.""" the second item is the code line."""
hl_lines: set[int] = set() hl_lines: set[int] = set()
"""A list of line numbers to highlight""" """A list of line numbers to highlight."""
code_language: str = "<guess>" code_language: str = "<guess>"
"""Pygment's short name of the lexer, e.g. ``text`` for the """Pygment's short name of the lexer, e.g. ``text`` for the
@ -84,15 +83,13 @@ class Code(MainResult, kw_only=True):
its default is the filename.""" its default is the filename."""
strip_new_lines: bool = True strip_new_lines: bool = True
"""Strip leading and trailing newlines for each returned fragment. """Strip leading and trailing newlines for each returned fragment (default:
Single file might return multiple code fragments. ``True``). Single file might return multiple code fragments."""
"""
strip_whitespace: bool = False strip_whitespace: bool = False
"""Strip all leading and trailing whitespace for each returned fragment. """Strip all leading and trailing whitespace for each returned fragment
Single file might return multiple code fragments. Enabling this might break (default: ``False``). Single file might return multiple code fragments.
code indentation. Enabling this might break code indentation."""
"""
def __post_init__(self): def __post_init__(self):
super().__post_init__() super().__post_init__()