diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2022-07-24 12:06:49 +0200 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarit.de> | 2023-04-08 11:10:14 +0200 |
commit | f117f969d85566c4a9df6c8a41ec441756b1bfa8 (patch) | |
tree | e69ebf3ed7a48672a202e35521908a715b2ae77e /searx/webutils.py | |
parent | bbb2af7d94cf1e1ea61e5984c7f63cd5de643861 (diff) | |
download | searxng-f117f969d85566c4a9df6c8a41ec441756b1bfa8.tar.gz searxng-f117f969d85566c4a9df6c8a41ec441756b1bfa8.zip |
[mod] in the preference page, show !bang of subgrouping categories
The names of the subgrouping categories in the preference page are translated,
to use this categories the user needs to know by which !bang the category can be
selected. Related to "Make 'non tab category' bangs discoverable" in [#690].
Related:
- [#690] https://github.com/searxng/searxng/issues/690
- https://github.com/searxng/searxng/issues/1604
- https://github.com/searxng/searxng/pull/1545
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/webutils.py')
-rw-r--r-- | searx/webutils.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/searx/webutils.py b/searx/webutils.py index 4b11a15af..470833291 100644 --- a/searx/webutils.py +++ b/searx/webutils.py @@ -242,4 +242,9 @@ def group_engines_in_tab(engines: Iterable[Engine]) -> List[Tuple[str, Iterable[ subgroups = itertools.groupby(sorted(engines, key=get_subgroup), get_subgroup) sorted_groups = sorted(((name, list(engines)) for name, engines in subgroups), key=group_sort_key) - return [(groupname, sorted(engines, key=engine_sort_key)) for groupname, engines in sorted_groups] + ret_val = [] + for groupname, engines in sorted_groups: + group_bang = '!' + groupname.replace(' ', '_') if groupname != NO_SUBGROUPING else '' + ret_val.append((groupname, group_bang, sorted(engines, key=engine_sort_key))) + + return ret_val |