From d8af94b7212b7825296117c661f04bfe4129bc99 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Tue, 28 Dec 2021 12:39:26 +0100 Subject: [doc] engine-table: stop sorting by Disabled It's only the default value for disabled it's not that important, since users can easily toggle it anytime in the engine preferences. --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/conf.py') diff --git a/docs/conf.py b/docs/conf.py index 628687b6a..d4fc50735 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -54,7 +54,7 @@ jinja_filters = { 'sort_engines': lambda engines: sorted( engines, - key=lambda engine: (engine[1].disabled, engine[1].about.get('language', ''), engine[0]) + key=lambda engine: (engine[1].about.get('language', ''), engine[0]) ) } -- cgit v1.2.3 From 02e9bdf7550b5f5545bd842b24b71680960dd7a7 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Tue, 28 Dec 2021 12:51:29 +0100 Subject: [doc] engine tables: show engines in all categories Previously the documentation grouped the engines by their first category so e.g. YouTube and Invidious were only shown in the in the videos section but not in the music section. This commit fixes this by iterating over searx.engines.categories, which also has the added benefit that the sections are now in the same order as the tabs in the user interface. --- docs/conf.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'docs/conf.py') diff --git a/docs/conf.py b/docs/conf.py index d4fc50735..1b78ece60 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -40,6 +40,7 @@ exclude_patterns = ['build-templates/*.rst'] import searx.engines import searx.plugins searx.engines.load_engines(searx.settings['engines']) + jinja_contexts = { 'searx': { 'engines': searx.engines.engines, @@ -48,13 +49,14 @@ jinja_contexts = { 'node': os.getenv('NODE_MINIMUM_VERSION') }, 'enabled_engine_count': sum(not x.disabled for x in searx.engines.engines.values()), + 'categories': searx.engines.categories, }, } jinja_filters = { 'sort_engines': lambda engines: sorted( engines, - key=lambda engine: (engine[1].about.get('language', ''), engine[0]) + key=lambda engine: (engine.about.get('language', ''), engine.name) ) } -- cgit v1.2.3 From 8e9ad1ccc296c220d61f12926c94d98baa83e3ca Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Wed, 22 Dec 2021 15:51:26 +0100 Subject: [enh] introduce categories_as_tabs Previously all categories were displayed as search engine tabs. This commit changes that so that only the categories listed under categories_as_tabs in settings.yml are displayed. This lets us introduce more categories without cluttering up the UI. Categories not displayed as tabs can still be searched with !bangs. --- docs/conf.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'docs/conf.py') diff --git a/docs/conf.py b/docs/conf.py index 1b78ece60..da989e62e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -50,14 +50,11 @@ jinja_contexts = { }, 'enabled_engine_count': sum(not x.disabled for x in searx.engines.engines.values()), 'categories': searx.engines.categories, + 'categories_as_tabs': {c: searx.engines.categories[c] for c in searx.settings['categories_as_tabs']}, }, } jinja_filters = { - 'sort_engines': - lambda engines: sorted( - engines, - key=lambda engine: (engine.about.get('language', ''), engine.name) - ) + 'group_engines_in_tab': searx.engines.group_engines_in_tab, } # Let the Jinja template in configured_engines.rst access documented_modules -- cgit v1.2.3 From 1e195f5b95d4c59105249d66f5d170d40139a461 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Mon, 3 Jan 2022 07:24:20 +0100 Subject: [mod] move group_engines_in_tab to searx.webutils --- docs/conf.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'docs/conf.py') diff --git a/docs/conf.py b/docs/conf.py index da989e62e..62b541f2f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -39,6 +39,7 @@ exclude_patterns = ['build-templates/*.rst'] import searx.engines import searx.plugins +import searx.webutils searx.engines.load_engines(searx.settings['engines']) jinja_contexts = { @@ -54,7 +55,7 @@ jinja_contexts = { }, } jinja_filters = { - 'group_engines_in_tab': searx.engines.group_engines_in_tab, + 'group_engines_in_tab': searx.webutils.group_engines_in_tab, } # Let the Jinja template in configured_engines.rst access documented_modules -- cgit v1.2.3