1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-24 07:30:12 +01:00

Fixed #1755: custom search separator not set

This commit is contained in:
squidfunk 2020-06-13 11:14:31 +02:00
parent 02cd4ed1a6
commit 0eedfbb3f6
9 changed files with 18 additions and 16 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,10 +1,10 @@
{ {
"assets/javascripts/bundle.js": "assets/javascripts/bundle.594f2bf6.min.js", "assets/javascripts/bundle.js": "assets/javascripts/bundle.883417a8.min.js",
"assets/javascripts/bundle.js.map": "assets/javascripts/bundle.594f2bf6.min.js.map", "assets/javascripts/bundle.js.map": "assets/javascripts/bundle.883417a8.min.js.map",
"assets/javascripts/vendor.js": "assets/javascripts/vendor.de50e36d.min.js", "assets/javascripts/vendor.js": "assets/javascripts/vendor.de50e36d.min.js",
"assets/javascripts/vendor.js.map": "assets/javascripts/vendor.de50e36d.min.js.map", "assets/javascripts/vendor.js.map": "assets/javascripts/vendor.de50e36d.min.js.map",
"assets/javascripts/worker/search.js": "assets/javascripts/worker/search.c03f0417.min.js", "assets/javascripts/worker/search.js": "assets/javascripts/worker/search.7a2ea5ba.min.js",
"assets/javascripts/worker/search.js.map": "assets/javascripts/worker/search.c03f0417.min.js.map", "assets/javascripts/worker/search.js.map": "assets/javascripts/worker/search.7a2ea5ba.min.js.map",
"assets/stylesheets/main.css": "assets/stylesheets/main.b8fb47b5.min.css", "assets/stylesheets/main.css": "assets/stylesheets/main.b8fb47b5.min.css",
"assets/stylesheets/main.css.map": "assets/stylesheets/main.b8fb47b5.min.css.map", "assets/stylesheets/main.css.map": "assets/stylesheets/main.b8fb47b5.min.css.map",
"assets/stylesheets/palette.css": "assets/stylesheets/palette.36d1b78f.min.css", "assets/stylesheets/palette.css": "assets/stylesheets/palette.36d1b78f.min.css",

View File

@ -183,7 +183,7 @@
</div> </div>
{% block scripts %} {% block scripts %}
<script src="{{ 'assets/javascripts/vendor.de50e36d.min.js' | url }}"></script> <script src="{{ 'assets/javascripts/vendor.de50e36d.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.594f2bf6.min.js' | url }}"></script> <script src="{{ 'assets/javascripts/bundle.883417a8.min.js' | url }}"></script>
{%- set translations = {} -%} {%- set translations = {} -%}
{%- for key in [ {%- for key in [
"clipboard.copy", "clipboard.copy",
@ -207,7 +207,7 @@
base: "{{ base_url }}", base: "{{ base_url }}",
features: {{ config.theme.features | tojson }}, features: {{ config.theme.features | tojson }},
search: Object.assign({ search: Object.assign({
worker: "{{ 'assets/javascripts/worker/search.c03f0417.min.js' | url }}" worker: "{{ 'assets/javascripts/worker/search.7a2ea5ba.min.js' | url }}"
}, typeof search !== "undefined" && search) }, typeof search !== "undefined" && search)
}) })
</script> </script>

View File

@ -133,10 +133,12 @@ export class Search {
this.documents = setupSearchDocumentMap(docs) this.documents = setupSearchDocumentMap(docs)
this.highlight = setupSearchHighlighter(config) this.highlight = setupSearchHighlighter(config)
/* Set separator for tokenizer */
lunr.tokenizer.separator = new RegExp(config.separator)
/* If no index was given, create it */ /* If no index was given, create it */
if (typeof index === "undefined") { if (typeof index === "undefined") {
this.index = lunr(function() { this.index = lunr(function() {
pipeline = pipeline || ["trimmer", "stopWordFilter"]
/* Set up alternate search languages */ /* Set up alternate search languages */
if (config.lang.length === 1 && config.lang[0] !== "en") { if (config.lang.length === 1 && config.lang[0] !== "en") {
@ -147,12 +149,12 @@ export class Search {
/* Set up pipeline according to configuration */ /* Set up pipeline according to configuration */
this.pipeline.reset() this.pipeline.reset()
for (const fn of pipeline) for (const fn of pipeline!)
this.pipeline.add(lunr[fn]) this.pipeline.add(lunr[fn])
/* Set up search pipeline according to configuration */ /* Set up search pipeline according to configuration */
this.searchPipeline.reset() this.searchPipeline.reset()
for (const fn of pipeline) for (const fn of pipeline!)
this.searchPipeline.add(lunr[fn]) this.searchPipeline.add(lunr[fn])
/* Set up fields and reference */ /* Set up fields and reference */