mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Fixed error when initializing search
This commit is contained in:
parent
c5143e890f
commit
87d8855dfe
@ -17,7 +17,7 @@ The translations can be changed in `theme/partials/language.html`:
|
||||
"footer.next": "Nächste Seite",
|
||||
"meta.comments": "Kommentare",
|
||||
"meta.source": "Quellcode",
|
||||
"search.languages": "de",
|
||||
"search.language": "de",
|
||||
"search.placeholder": "Suche",
|
||||
"search.result.placeholder": "Suchbegriff eingeben",
|
||||
"search.result.none": "Keine Suchergebnisse",
|
||||
|
@ -30,7 +30,7 @@
|
||||
"footer.next": "Nächste Seite",
|
||||
"meta.comments": "Kommentare",
|
||||
"meta.source": "Quellcode",
|
||||
"search.languages": "de",
|
||||
"search.language": "de",
|
||||
"search.placeholder": "Suche",
|
||||
"search.result.placeholder": "Suchbegriff eingeben",
|
||||
"search.result.none": "Keine Suchergebnisse",
|
||||
|
File diff suppressed because one or more lines are too long
@ -25,7 +25,7 @@
|
||||
{% for key in [
|
||||
"clipboard.copy",
|
||||
"clipboard.copied",
|
||||
"search.languages",
|
||||
"search.language",
|
||||
"search.result.none",
|
||||
"search.result.one",
|
||||
"search.result.other",
|
||||
@ -167,8 +167,9 @@
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% block scripts %}
|
||||
<script src="{{ base_url }}/assets/javascripts/application-946997f430.js"></script>
|
||||
{% set languages = lang.t("search.languages").split(",") %}
|
||||
<script src="{{ base_url }}/assets/javascripts/application-84693e5e49.js"></script>
|
||||
{% if lang.t("search.language") != "en" %}
|
||||
{% set languages = lang.t("search.language").split(",") %}
|
||||
{% if languages | length and languages[0] != "" %}
|
||||
{% set path = base_url + "/assets/javascripts/lunr" %}
|
||||
<script src="{{ path }}/lunr.stemmer.support.js"></script>
|
||||
@ -184,6 +185,7 @@
|
||||
<script src="{{ path }}/lunr.multi.js"></script>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<script>app.initialize({version:"{{ mkdocs_version }}",url:{base:"{{ base_url }}"}})</script>
|
||||
{% for path in extra_javascript %}
|
||||
<script src="{{ path }}"></script>
|
||||
|
@ -1,6 +1,6 @@
|
||||
{% import "partials/language/" + config.theme.language + ".html" as lang %}
|
||||
{% macro t(key) %}{{ {
|
||||
"search.languages": (
|
||||
"search.language": (
|
||||
config.extra.search | default({})
|
||||
).language | default(config.theme.language, true),
|
||||
"search.tokenizer": (
|
||||
|
@ -117,7 +117,7 @@ export default class Result {
|
||||
lunr.tokenizer.separator = tokenizer
|
||||
|
||||
/* Load search languages */
|
||||
this.lang_ = translate("search.languages").split(",")
|
||||
this.lang_ = translate("search.language").split(",")
|
||||
.filter(Boolean)
|
||||
.map(lang => lang.trim())
|
||||
}
|
||||
@ -180,7 +180,7 @@ export default class Result {
|
||||
)
|
||||
|
||||
/* Set up alternate search languages */
|
||||
if (lang.length === 1) {
|
||||
if (lang.length === 1 && lang[0] !== "en") {
|
||||
this.use(lunr[lang[0]])
|
||||
} else if (lang.length > 1) {
|
||||
this.use(lunr.multiLanguage(...lang))
|
||||
|
@ -63,7 +63,7 @@
|
||||
{% for key in [
|
||||
"clipboard.copy",
|
||||
"clipboard.copied",
|
||||
"search.languages",
|
||||
"search.language",
|
||||
"search.result.none",
|
||||
"search.result.one",
|
||||
"search.result.other",
|
||||
@ -303,7 +303,8 @@
|
||||
<script src="{{ base_url }}/assets/javascripts/application.js"></script>
|
||||
|
||||
<!-- Load additional languages for search -->
|
||||
{% set languages = lang.t("search.languages").split(",") %}
|
||||
{% if lang.t("search.language") != "en" %}
|
||||
{% set languages = lang.t("search.language").split(",") %}
|
||||
{% if languages | length and languages[0] != "" %}
|
||||
{% set path = base_url + "/assets/javascripts/lunr" %}
|
||||
<script src="{{ path }}/lunr.stemmer.support.js"></script>
|
||||
@ -319,6 +320,7 @@
|
||||
<script src="{{ path }}/lunr.multi.js"></script>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<!-- Initialize application -->
|
||||
<script>
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
<!-- Re-export translations -->
|
||||
{% macro t(key) %}{{ {
|
||||
"search.languages": (
|
||||
"search.language": (
|
||||
config.extra.search | default({})
|
||||
).language | default(config.theme.language, true),
|
||||
"search.tokenizer": (
|
||||
|
Loading…
Reference in New Issue
Block a user