Merge pull request #2327 from return42/ui-pref-add-bang
[mod] in the preference page, show !bang of subgrouping categories
This commit is contained in:
		
						commit
						71bd091f6b
					
				| @ -6,49 +6,66 @@ Configured Engines | |||||||
| 
 | 
 | ||||||
| .. sidebar:: Further reading .. | .. sidebar:: Further reading .. | ||||||
| 
 | 
 | ||||||
|  |    - :ref:`settings categories_as_tabs` | ||||||
|    - :ref:`engines-dev` |    - :ref:`engines-dev` | ||||||
|    - :ref:`settings engine` |    - :ref:`settings engine` | ||||||
| 
 |    - :ref:`general engine configuration` | ||||||
| Explanation of the :ref:`general engine configuration` shown in the table |  | ||||||
| :ref:`configured engines`. |  | ||||||
| 
 | 
 | ||||||
| .. jinja:: searx | .. jinja:: searx | ||||||
| 
 | 
 | ||||||
|    SearXNG supports {{engines | length}} search engines (of which {{enabled_engine_count}} are enabled by default). |    SearXNG supports {{engines | length}} search engines of which | ||||||
|  |    {{enabled_engine_count}} are enabled by default. | ||||||
|  | 
 | ||||||
|  |    Engines can be assigned to multiple :ref:`categories <engine categories>`. | ||||||
|  |    The UI displays the tabs that are configured in :ref:`categories_as_tabs | ||||||
|  |    <settings categories_as_tabs>`.  In addition to these UI categories (also | ||||||
|  |    called *tabs*), engines can be queried by their name or the categories they | ||||||
|  |    belong to, by using a :ref:`\!bing syntax <search-syntax>`. | ||||||
|  | 
 | ||||||
|  | .. contents:: Contents | ||||||
|  |    :depth: 2 | ||||||
|  |    :local: | ||||||
|  |    :backlinks: entry | ||||||
|  | 
 | ||||||
|  | .. jinja:: searx | ||||||
| 
 | 
 | ||||||
|    {% for category, engines in categories_as_tabs.items() %} |    {% for category, engines in categories_as_tabs.items() %} | ||||||
| 
 | 
 | ||||||
|    {{category}} search engines |    tab ``!{{category.replace(' ', '_')}}`` | ||||||
|    --------------------------------------- |    --------------------------------------- | ||||||
| 
 | 
 | ||||||
|    {% for group, engines in engines | group_engines_in_tab %} |    {% for group, group_bang, engines in engines | group_engines_in_tab %} | ||||||
| 
 | 
 | ||||||
|    {% if loop.length > 1 %} |    {% if loop.length > 1 %} | ||||||
|    {{group}} |    {% if group_bang %}group ``{{group_bang}}``{% else %}{{group}}{% endif %} | ||||||
|    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||
|    {% endif %} |    {% endif %} | ||||||
| 
 | 
 | ||||||
|    .. flat-table:: |    .. flat-table:: | ||||||
|       :header-rows: 2 |       :header-rows: 2 | ||||||
|       :stub-columns: 1 |       :stub-columns: 1 | ||||||
|  |       :widths: 10 1 10 1 1 1 1 1 1 1 | ||||||
| 
 | 
 | ||||||
|       * - :cspan:`5` Engines configured by default (in :ref:`settings.yml <engine settings>`) |       * - :cspan:`5` Engines configured by default (in :ref:`settings.yml <engine settings>`) | ||||||
|         - :cspan:`3` :ref:`Supported features <engine file>` |         - :cspan:`3` :ref:`Supported features <engine file>` | ||||||
| 
 | 
 | ||||||
|       * - Name |       * - Name | ||||||
|         - Shortcut |         - !bang | ||||||
|         - Module |         - Module | ||||||
|         - Disabled |         - Disabled | ||||||
|         - Timeout |         - Timeout | ||||||
|         - Weight |         - Weight | ||||||
|         - Paging |         - Paging | ||||||
|         - Language, Region |         - Locale | ||||||
|         - Safe search |         - Safe search | ||||||
|         - Time range |         - Time range | ||||||
| 
 | 
 | ||||||
|       {% for mod in engines %} |       {% for mod in engines %} | ||||||
| 
 | 
 | ||||||
|       * - `{{mod.name}} <{{mod.about and mod.about.website}}>`_ |       * - `{{mod.name}} <{{mod.about and mod.about.website}}>`_ | ||||||
|  |           {%- if mod.about and  mod.about.language %} | ||||||
|  |           ({{mod.about.language | upper}}) | ||||||
|  |           {%- endif %} | ||||||
|         - ``!{{mod.shortcut}}`` |         - ``!{{mod.shortcut}}`` | ||||||
|         - {%- if 'searx.engines.' + mod.__name__ in documented_modules %} |         - {%- if 'searx.engines.' + mod.__name__ in documented_modules %} | ||||||
|           :py:mod:`~searx.engines.{{mod.__name__}}` |           :py:mod:`~searx.engines.{{mod.__name__}}` | ||||||
| @ -56,9 +73,6 @@ Explanation of the :ref:`general engine configuration` shown in the table | |||||||
|           :origin:`{{mod.__name__}} <searx/engines/{{mod.__name__}}.py>` |           :origin:`{{mod.__name__}} <searx/engines/{{mod.__name__}}.py>` | ||||||
|           {%- endif %} |           {%- endif %} | ||||||
|         - {{(mod.disabled and "y") or ""}} |         - {{(mod.disabled and "y") or ""}} | ||||||
|           {%- if mod.about and  mod.about.language %} |  | ||||||
|           ({{mod.about.language | upper}}) |  | ||||||
|           {%- endif %} |  | ||||||
|         - {{mod.timeout}} |         - {{mod.timeout}} | ||||||
|         - {{mod.weight or 1 }} |         - {{mod.weight or 1 }} | ||||||
|         {% if mod.engine_type == 'online' %} |         {% if mod.engine_type == 'online' %} | ||||||
|  | |||||||
| @ -30,7 +30,7 @@ nach dem Begriff **paris** gesucht. | |||||||
| 
 | 
 | ||||||
| ## `:` Sprache auswählen | ## `:` Sprache auswählen | ||||||
| 
 | 
 | ||||||
| Um einen Sprachfilter auszuwählen, verwenden Sie das Präfix`:`.  Um ein | Um einen Sprachfilter auszuwählen, verwenden Sie das Präfix `:`.  Um ein | ||||||
| einfaches Beispiel zu geben: | einfaches Beispiel zu geben: | ||||||
| 
 | 
 | ||||||
| - Wikipedia mit einer benutzerdefinierten Sprache durchsuchen | - Wikipedia mit einer benutzerdefinierten Sprache durchsuchen | ||||||
|  | |||||||
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								searx/static/themes/simple/css/searxng-rtl.min.css
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								searx/static/themes/simple/css/searxng-rtl.min.css
									
									
									
									
										vendored
									
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								searx/static/themes/simple/css/searxng.min.css
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								searx/static/themes/simple/css/searxng.min.css
									
									
									
									
										vendored
									
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| @ -113,8 +113,8 @@ | |||||||
|   --color-toolkit-engine-tooltip-background: #fff; |   --color-toolkit-engine-tooltip-background: #fff; | ||||||
|   --color-toolkit-loader-border: rgba(0, 0, 0, 0.2); |   --color-toolkit-loader-border: rgba(0, 0, 0, 0.2); | ||||||
|   --color-toolkit-loader-borderleft: rgba(255, 255, 255, 0); |   --color-toolkit-loader-borderleft: rgba(255, 255, 255, 0); | ||||||
|   --color-doc-code: #300; |   --color-doc-code: #003; | ||||||
|   --color-doc-code-background: #fdd; |   --color-doc-code-background: #ddeaff; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| .dark-themes() { | .dark-themes() { | ||||||
| @ -225,8 +225,8 @@ | |||||||
|   --color-toolkit-engine-tooltip-background: #222; |   --color-toolkit-engine-tooltip-background: #222; | ||||||
|   --color-toolkit-loader-border: rgba(255, 255, 255, 0.2); |   --color-toolkit-loader-border: rgba(255, 255, 255, 0.2); | ||||||
|   --color-toolkit-loader-borderleft: rgba(0, 0, 0, 0); |   --color-toolkit-loader-borderleft: rgba(0, 0, 0, 0); | ||||||
|   --color-doc-code: #fdd; |   --color-doc-code: #ddd; | ||||||
|   --color-doc-code-background: #300; |   --color-doc-code-background: #4d5a6f; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /// Dark Theme (autoswitch based on device pref) | /// Dark Theme (autoswitch based on device pref) | ||||||
|  | |||||||
| @ -1,9 +1,10 @@ | |||||||
| .info-page { | .info-page { | ||||||
|   code { |   code { | ||||||
|     font-family: monospace; |     font-family: monospace; | ||||||
|     color: var(--color-doc-code); |     .rounded-corners-tiny; | ||||||
|     background-color: var(--color-doc-code-background); |     background-color: var(--color-doc-code-background); | ||||||
|     padding: 2px 5px; |     color: var(--color-doc-code); | ||||||
|     .rounded-corners(5px); |     padding: 0.2rem; | ||||||
|  |     border: 0 none; | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | |||||||
| @ -72,6 +72,15 @@ | |||||||
|     font-size: 90%; |     font-size: 90%; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  |   .bang { | ||||||
|  |     .ltr-text-align-left(); | ||||||
|  |     .rounded-corners-tiny; | ||||||
|  |     background-color: var(--color-doc-code-background); | ||||||
|  |     color: var(--color-doc-code); | ||||||
|  |     padding: 0.2rem; | ||||||
|  |     border: 0 none; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|   table { |   table { | ||||||
|     border-collapse: collapse; |     border-collapse: collapse; | ||||||
|   } |   } | ||||||
| @ -114,6 +123,10 @@ | |||||||
|         .engine-description { |         .engine-description { | ||||||
|           margin-top: 0.5rem; |           margin-top: 0.5rem; | ||||||
|         } |         } | ||||||
|  | 
 | ||||||
|  |         .bang { | ||||||
|  |           margin: 0.3rem; | ||||||
|  |         } | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -32,7 +32,8 @@ | |||||||
|       {{ _('View error logs and submit a bug report') -}} |       {{ _('View error logs and submit a bug report') -}} | ||||||
|     </a> |     </a> | ||||||
|     {%- endif -%} |     {%- endif -%} | ||||||
| 
 |     <p><span class="right">{{ _("!bang for this engine") }}</span>{% for bang in [search_engine.name] + [search_engine.shortcut] %}<span class="bang"> {{ '!' + bang.replace(' ', '_') }}</span>{% endfor %}</p> | ||||||
|  |     <p><span class="right">{{ _("!bang for its categories") }}</span>{% for bang in search_engine.categories %}<span class="bang"> {{ '!' + bang.replace(' ', '_') }}</span>{% endfor %}</p> | ||||||
| </div> | </div> | ||||||
| {%- endif -%} | {%- endif -%} | ||||||
| {%- endmacro %} | {%- endmacro %} | ||||||
| @ -309,7 +310,7 @@ | |||||||
|       <tr>{{- "" -}} |       <tr>{{- "" -}} | ||||||
|         <th class="engine_checkbox">{{ _("Allow") }}</th>{{- "" -}} |         <th class="engine_checkbox">{{ _("Allow") }}</th>{{- "" -}} | ||||||
|         <th class="name">{{ _("Engine name") }}</th>{{- "" -}} |         <th class="name">{{ _("Engine name") }}</th>{{- "" -}} | ||||||
|         <th class="shortcut">{{ _("!bang") }}</th>{{- "" -}} |         <th class="shortcut">{{ _("Bang") }}</th>{{- "" -}} | ||||||
|         <th>{{ _("Supports selected language") }}</th>{{- "" -}} |         <th>{{ _("Supports selected language") }}</th>{{- "" -}} | ||||||
|         <th>{{ _("SafeSearch") }}</th>{{- "" -}} |         <th>{{ _("SafeSearch") }}</th>{{- "" -}} | ||||||
|         <th>{{ _("Time range") }}</th>{{- "" -}} |         <th>{{ _("Time range") }}</th>{{- "" -}} | ||||||
| @ -317,9 +318,12 @@ | |||||||
|         <th>{{ _("Max time") }}</th>{{- "" -}} |         <th>{{ _("Max time") }}</th>{{- "" -}} | ||||||
|         {%- if enable_metrics %}<th>{{ _("Reliability") }}</th>{% endif -%} |         {%- if enable_metrics %}<th>{{ _("Reliability") }}</th>{% endif -%} | ||||||
|       </tr> |       </tr> | ||||||
|       {% for group, engines in engines_by_category[categ] | group_engines_in_tab %} |       {% for group, group_bang, engines in engines_by_category[categ] | group_engines_in_tab %} | ||||||
|       {% if loop.length > 1 %} |       {% if loop.length > 1 %} | ||||||
|       <tr><th colspan="9" class="engine-group">{{_(group)}}</th></tr> |       <tr> | ||||||
|  |         <th class="engine-group" colspan="2">{{_(group)}}</th> | ||||||
|  |         <th class="engine-group" colspan="7">{% if group_bang %}<span class="bang">{{group_bang}}</span>{% endif %}</th> | ||||||
|  |       </tr>{{- "" -}} | ||||||
|       {% endif %} |       {% endif %} | ||||||
|       {% for search_engine in engines %} |       {% for search_engine in engines %} | ||||||
|       {% if not search_engine.private %} |       {% if not search_engine.private %} | ||||||
| @ -329,13 +333,13 @@ | |||||||
|         <th class="name" data-engine-name="{{ search_engine.name }}">{% if search_engine.enable_http %}{{ icon_big('warning', 'No HTTPS') }}{% endif -%} |         <th class="name" data-engine-name="{{ search_engine.name }}">{% if search_engine.enable_http %}{{ icon_big('warning', 'No HTTPS') }}{% endif -%} | ||||||
|           <label for="{{ engine_id }}"> |           <label for="{{ engine_id }}"> | ||||||
|             {{- search_engine.name -}} |             {{- search_engine.name -}} | ||||||
|             {%- if search_engine.about and search_engine.about.language -%} |             {%- if search_engine.about and search_engine.about.language %} | ||||||
|               ({{search_engine.about.language | upper}}) |               ({{search_engine.about.language | upper}}) | ||||||
|             {%- endif -%} |             {%- endif -%} | ||||||
|           </label> |           </label> | ||||||
|           {{- engine_about(search_engine) -}} |           {{- engine_about(search_engine) -}} | ||||||
|         </th>{{- "" -}} |         </th>{{- "" -}} | ||||||
|         <td class="shortcut">{{ shortcuts[search_engine.name] }}</td>{{- "" -}} |         <td class="shortcut"><span class="bang">{{ '!' + shortcuts[search_engine.name] }}</span></td>{{- "" -}} | ||||||
|         <td>{{ checkbox(None, supports[search_engine.name]['supports_selected_language'], true) }}</td>{{- "" -}} |         <td>{{ checkbox(None, supports[search_engine.name]['supports_selected_language'], true) }}</td>{{- "" -}} | ||||||
|         <td>{{ checkbox(None, supports[search_engine.name]['safesearch'], true) }}</td>{{- "" -}} |         <td>{{ checkbox(None, supports[search_engine.name]['safesearch'], true) }}</td>{{- "" -}} | ||||||
|         <td>{{ checkbox(None, supports[search_engine.name]['time_range_support'], true) }}</td>{{- "" -}} |         <td>{{ checkbox(None, supports[search_engine.name]['time_range_support'], true) }}</td>{{- "" -}} | ||||||
|  | |||||||
| @ -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) |     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) |     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 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user