1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
From: Dmitry Shachnev <mitya57@debian.org>
Date: Sat, 1 Dec 2018 12:51:11 +0300
Subject: Disable non-English search support
The lunr-languages library is unmaintained and incompatible with the
latest version of lunr, which we are going to use.
---
docs/user-guide/configuration.md | 44 ---------------------------------
mkdocs/contrib/search/prebuild-index.js | 14 -----------
mkdocs/tests/search_tests.py | 2 ++
3 files changed, 2 insertions(+), 58 deletions(-)
diff --git a/docs/user-guide/configuration.md b/docs/user-guide/configuration.md
index 4f9f7a2..84c5f38 100644
--- a/docs/user-guide/configuration.md
+++ b/docs/user-guide/configuration.md
@@ -503,47 +503,6 @@ plugins:
**default**: `'[\s\-]+'`
-##### **lang**
-
-A list of languages to use when building the search index as identified by their
-[ISO 639-1] language codes. With [Lunr Languages], the following languages are
-supported:
-
-* `da`: Danish
-* `du`: Dutch
-* `en`: English
-* `fi`: Finnish
-* `fr`: French
-* `de`: German
-* `hu`: Hungarian
-* `it`: Italian
-* `jp`: Japanese
-* `no`: Norwegian
-* `pt`: Portuguese
-* `ro`: Romanian
-* `ru`: Russian
-* `es`: Spanish
-* `sv`: Swedish
-* `th`: Thai
-* `tr`: Turkish
-
-You may [contribute additional languages].
-
-!!! Warning
-
- While search does support using multiple languages together, it is best not
- to add additional languages unless you really need them. Each additional
- language adds significant bandwidth requirements and uses more browser
- resources. Generally it is best to keep each instance of MkDocs to a single
- language.
-
-!!! Note
-
- Lunr Languages does not currently include support for Chinese or other Asian
- languages. However, some users have reported decent results using Japanese.
-
-**default**: `['en']`
-
##### **prebuild_index**
Optionally generates a pre-built index of all pages, which provides some
@@ -577,7 +536,4 @@ You may [contribute additional languages].
[extra_css]: #extra_css
[Plugins]: plugins.md
[lunr.js]: https://lunrjs.com/
-[ISO 639-1]: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
-[Lunr Languages]: https://github.com/MihaiValentin/lunr-languages#lunr-languages-----
-[contribute additional languages]: https://github.com/MihaiValentin/lunr-languages/blob/master/CONTRIBUTING.md
[Node.js]: https://nodejs.org/
diff --git a/mkdocs/contrib/search/prebuild-index.js b/mkdocs/contrib/search/prebuild-index.js
index ae26da4..a23a033 100644
--- a/mkdocs/contrib/search/prebuild-index.js
+++ b/mkdocs/contrib/search/prebuild-index.js
@@ -15,20 +15,6 @@ stdin.on('end', function () {
lang = ['en'];
if (data.config) {
- if (data.config.lang && data.config.lang.length) {
- lang = data.config.lang;
- if (lang.length > 1 || lang[0] !== "en") {
- require('./lunr-language/lunr.stemmer.support')(lunr);
- if (lang.length > 1) {
- require('./lunr-language/lunr.multi')(lunr);
- }
- for (var i=0; i < lang.length; i++) {
- if (lang[i] != 'en') {
- require('./lunr-language/lunr.' + lang[i])(lunr);
- }
- }
- }
- }
if (data.config.separator && data.config.separator.length) {
lunr.tokenizer.separator = new RegExp(data.config.separator);
}
diff --git a/mkdocs/tests/search_tests.py b/mkdocs/tests/search_tests.py
index 8441e61..f868db1 100644
--- a/mkdocs/tests/search_tests.py
+++ b/mkdocs/tests/search_tests.py
@@ -36,6 +36,7 @@ class SearchConfigTests(unittest.TestCase):
value = option.validate(['en'])
self.assertEqual(['en'], value)
+ @unittest.expectedFailure
def test_lang_multi_list(self):
option = search.LangOption()
value = option.validate(['en', 'es', 'fr'])
@@ -68,6 +69,7 @@ class SearchPluginTests(unittest.TestCase):
self.assertEqual(errors, [])
self.assertEqual(warnings, [])
+ @unittest.expectedFailure
def test_plugin_config_lang(self):
expected = {
'lang': ['es'],
|