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.shortcut}}``
- {{mod.__name__}} - {{mod.__name__}}
- {{(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' %}

View File

@ -50,7 +50,11 @@ jinja_contexts = {
}, },
} }
jinja_filters = { 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 # usage:: lorem :patch:`f373169` ipsum

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -352,6 +352,9 @@ engines:
use_official_api: false use_official_api: false
require_api_key: false require_api_key: false
results: HTML 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 - name: ccengine
engine: ccengine engine: ccengine
@ -1573,6 +1576,7 @@ engines:
use_official_api: false use_official_api: false
require_api_key: false require_api_key: false
results: HTML results: HTML
language: ko
- name: rubygems - name: rubygems
shortcut: rbg shortcut: rbg
@ -1649,6 +1653,7 @@ engines:
use_official_api: false use_official_api: false
require_api_key: false require_api_key: false
results: HTML results: HTML
language: de
- name: słownik języka polskiego - name: słownik języka polskiego
engine: sjp engine: sjp
@ -1676,6 +1681,7 @@ engines:
use_official_api: false use_official_api: false
require_api_key: false require_api_key: false
results: HTML results: HTML
language: fr
- name: brave - name: brave
shortcut: brave shortcut: brave