Merge pull request #629 from not-my-profile/about-language

[doc] introduce about.language and sort engines by it
This commit is contained in:
Markus Heiser 2021-12-21 12:54:58 +01:00 committed by GitHub
commit 06435e08ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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