mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-11-28 01:10:58 +01: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",
|
"footer.next": "Nächste Seite",
|
||||||
"meta.comments": "Kommentare",
|
"meta.comments": "Kommentare",
|
||||||
"meta.source": "Quellcode",
|
"meta.source": "Quellcode",
|
||||||
"search.languages": "de",
|
"search.language": "de",
|
||||||
"search.placeholder": "Suche",
|
"search.placeholder": "Suche",
|
||||||
"search.result.placeholder": "Suchbegriff eingeben",
|
"search.result.placeholder": "Suchbegriff eingeben",
|
||||||
"search.result.none": "Keine Suchergebnisse",
|
"search.result.none": "Keine Suchergebnisse",
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
"footer.next": "Nächste Seite",
|
"footer.next": "Nächste Seite",
|
||||||
"meta.comments": "Kommentare",
|
"meta.comments": "Kommentare",
|
||||||
"meta.source": "Quellcode",
|
"meta.source": "Quellcode",
|
||||||
"search.languages": "de",
|
"search.language": "de",
|
||||||
"search.placeholder": "Suche",
|
"search.placeholder": "Suche",
|
||||||
"search.result.placeholder": "Suchbegriff eingeben",
|
"search.result.placeholder": "Suchbegriff eingeben",
|
||||||
"search.result.none": "Keine Suchergebnisse",
|
"search.result.none": "Keine Suchergebnisse",
|
||||||
|
File diff suppressed because one or more lines are too long
@ -25,7 +25,7 @@
|
|||||||
{% for key in [
|
{% for key in [
|
||||||
"clipboard.copy",
|
"clipboard.copy",
|
||||||
"clipboard.copied",
|
"clipboard.copied",
|
||||||
"search.languages",
|
"search.language",
|
||||||
"search.result.none",
|
"search.result.none",
|
||||||
"search.result.one",
|
"search.result.one",
|
||||||
"search.result.other",
|
"search.result.other",
|
||||||
@ -167,21 +167,23 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script src="{{ base_url }}/assets/javascripts/application-946997f430.js"></script>
|
<script src="{{ base_url }}/assets/javascripts/application-84693e5e49.js"></script>
|
||||||
{% set languages = lang.t("search.languages").split(",") %}
|
{% if lang.t("search.language") != "en" %}
|
||||||
{% if languages | length and languages[0] != "" %}
|
{% set languages = lang.t("search.language").split(",") %}
|
||||||
{% set path = base_url + "/assets/javascripts/lunr" %}
|
{% if languages | length and languages[0] != "" %}
|
||||||
<script src="{{ path }}/lunr.stemmer.support.js"></script>
|
{% set path = base_url + "/assets/javascripts/lunr" %}
|
||||||
{% for language in languages | map("trim") %}
|
<script src="{{ path }}/lunr.stemmer.support.js"></script>
|
||||||
{% if language != "en" %}
|
{% for language in languages | map("trim") %}
|
||||||
{% if language == "jp" %}
|
{% if language != "en" %}
|
||||||
<script src="{{ path }}/tinyseg.js"></script>
|
{% if language == "jp" %}
|
||||||
|
<script src="{{ path }}/tinyseg.js"></script>
|
||||||
|
{% endif %}
|
||||||
|
<script src="{{ path }}/lunr.{{ language }}.js"></script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<script src="{{ path }}/lunr.{{ language }}.js"></script>
|
{% endfor %}
|
||||||
|
{% if languages | length > 1 %}
|
||||||
|
<script src="{{ path }}/lunr.multi.js"></script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
|
||||||
{% if languages | length > 1 %}
|
|
||||||
<script src="{{ path }}/lunr.multi.js"></script>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<script>app.initialize({version:"{{ mkdocs_version }}",url:{base:"{{ base_url }}"}})</script>
|
<script>app.initialize({version:"{{ mkdocs_version }}",url:{base:"{{ base_url }}"}})</script>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{% import "partials/language/" + config.theme.language + ".html" as lang %}
|
{% import "partials/language/" + config.theme.language + ".html" as lang %}
|
||||||
{% macro t(key) %}{{ {
|
{% macro t(key) %}{{ {
|
||||||
"search.languages": (
|
"search.language": (
|
||||||
config.extra.search | default({})
|
config.extra.search | default({})
|
||||||
).language | default(config.theme.language, true),
|
).language | default(config.theme.language, true),
|
||||||
"search.tokenizer": (
|
"search.tokenizer": (
|
||||||
|
@ -117,7 +117,7 @@ export default class Result {
|
|||||||
lunr.tokenizer.separator = tokenizer
|
lunr.tokenizer.separator = tokenizer
|
||||||
|
|
||||||
/* Load search languages */
|
/* Load search languages */
|
||||||
this.lang_ = translate("search.languages").split(",")
|
this.lang_ = translate("search.language").split(",")
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
.map(lang => lang.trim())
|
.map(lang => lang.trim())
|
||||||
}
|
}
|
||||||
@ -180,7 +180,7 @@ export default class Result {
|
|||||||
)
|
)
|
||||||
|
|
||||||
/* Set up alternate search languages */
|
/* Set up alternate search languages */
|
||||||
if (lang.length === 1) {
|
if (lang.length === 1 && lang[0] !== "en") {
|
||||||
this.use(lunr[lang[0]])
|
this.use(lunr[lang[0]])
|
||||||
} else if (lang.length > 1) {
|
} else if (lang.length > 1) {
|
||||||
this.use(lunr.multiLanguage(...lang))
|
this.use(lunr.multiLanguage(...lang))
|
||||||
|
@ -63,7 +63,7 @@
|
|||||||
{% for key in [
|
{% for key in [
|
||||||
"clipboard.copy",
|
"clipboard.copy",
|
||||||
"clipboard.copied",
|
"clipboard.copied",
|
||||||
"search.languages",
|
"search.language",
|
||||||
"search.result.none",
|
"search.result.none",
|
||||||
"search.result.one",
|
"search.result.one",
|
||||||
"search.result.other",
|
"search.result.other",
|
||||||
@ -303,20 +303,22 @@
|
|||||||
<script src="{{ base_url }}/assets/javascripts/application.js"></script>
|
<script src="{{ base_url }}/assets/javascripts/application.js"></script>
|
||||||
|
|
||||||
<!-- Load additional languages for search -->
|
<!-- Load additional languages for search -->
|
||||||
{% set languages = lang.t("search.languages").split(",") %}
|
{% if lang.t("search.language") != "en" %}
|
||||||
{% if languages | length and languages[0] != "" %}
|
{% set languages = lang.t("search.language").split(",") %}
|
||||||
{% set path = base_url + "/assets/javascripts/lunr" %}
|
{% if languages | length and languages[0] != "" %}
|
||||||
<script src="{{ path }}/lunr.stemmer.support.js"></script>
|
{% set path = base_url + "/assets/javascripts/lunr" %}
|
||||||
{% for language in languages | map("trim") %}
|
<script src="{{ path }}/lunr.stemmer.support.js"></script>
|
||||||
{% if language != "en" %}
|
{% for language in languages | map("trim") %}
|
||||||
{% if language == "jp" %}
|
{% if language != "en" %}
|
||||||
<script src="{{ path }}/tinyseg.js"></script>
|
{% if language == "jp" %}
|
||||||
|
<script src="{{ path }}/tinyseg.js"></script>
|
||||||
|
{% endif %}
|
||||||
|
<script src="{{ path }}/lunr.{{ language }}.js"></script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<script src="{{ path }}/lunr.{{ language }}.js"></script>
|
{% endfor %}
|
||||||
|
{% if languages | length > 1 %}
|
||||||
|
<script src="{{ path }}/lunr.multi.js"></script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
|
||||||
{% if languages | length > 1 %}
|
|
||||||
<script src="{{ path }}/lunr.multi.js"></script>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
<!-- Re-export translations -->
|
<!-- Re-export translations -->
|
||||||
{% macro t(key) %}{{ {
|
{% macro t(key) %}{{ {
|
||||||
"search.languages": (
|
"search.language": (
|
||||||
config.extra.search | default({})
|
config.extra.search | default({})
|
||||||
).language | default(config.theme.language, true),
|
).language | default(config.theme.language, true),
|
||||||
"search.tokenizer": (
|
"search.tokenizer": (
|
||||||
|
Loading…
Reference in New Issue
Block a user