[doc] introduce about.language and sort engines by it

This commit is contained in:
Martin Fischer 2021-12-21 09:39:03 +01:00
parent 3c0f01aed7
commit e28c6bda35
8 changed files with 19 additions and 1 deletions

View File

@ -43,6 +43,9 @@ Explanation of the :ref:`general engine configuration` shown in the table
- ``!{{mod.shortcut}}``
- {{mod.__name__}}
- {{(mod.disabled and "y") or ""}}
{%- if mod.about and mod.about.language %}
({{mod.about.language | upper}})
{%- endif %}
- {{mod.timeout}}
- {{mod.weight or 1 }}
{% if mod.engine_type == 'online' %}

View File

@ -50,7 +50,11 @@ jinja_contexts = {
},
}
jinja_filters = {
'sort_engines': lambda engines: sorted(engines, key=lambda engine: (engine[1].disabled, engine[0]))
'sort_engines':
lambda engines: sorted(
engines,
key=lambda engine: (engine[1].disabled, engine[1].about.get('language', ''), engine[0])
)
}
# usage:: lorem :patch:`f373169` ipsum

View File

@ -16,6 +16,7 @@ about = {
"use_official_api": False,
"require_api_key": False,
"results": 'HTML',
"language": 'de',
}
categories = ['general']

View File

@ -18,6 +18,7 @@ about = {
"use_official_api": False,
"require_api_key": False,
"results": 'HTML',
"language": 'fr',
}
# engine dependent config

View File

@ -14,6 +14,7 @@ about = {
"use_official_api": True,
"require_api_key": False,
"results": 'JSON',
"language": "de",
}
categories = ['videos']

View File

@ -22,6 +22,7 @@ about = {
"use_official_api": False,
"require_api_key": False,
"results": "HTML",
"language": "cz",
}
base_url = 'https://search.seznam.cz/'

View File

@ -18,6 +18,7 @@ about = {
"use_official_api": False,
"require_api_key": False,
"results": 'HTML',
"language": 'pl',
}
categories = ['general']

View File

@ -352,6 +352,9 @@ engines:
use_official_api: false
require_api_key: false
results: HTML
# We don't set language: de here because media.ccc.de is not just
# for a German audience. It contains many English videos and many
# German videos have English subtitles.
- name: ccengine
engine: ccengine
@ -1573,6 +1576,7 @@ engines:
use_official_api: false
require_api_key: false
results: HTML
language: ko
- name: rubygems
shortcut: rbg
@ -1649,6 +1653,7 @@ engines:
use_official_api: false
require_api_key: false
results: HTML
language: de
- name: słownik języka polskiego
engine: sjp
@ -1676,6 +1681,7 @@ engines:
use_official_api: false
require_api_key: false
results: HTML
language: fr
- name: brave
shortcut: brave