mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-12-01 02:27:17 +01:00
Inlined regex escaping from dependency
This commit is contained in:
parent
13a4c9172d
commit
185147684c
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
material/assets/javascripts/modernizr.74668098.js
Normal file
1
material/assets/javascripts/modernizr.74668098.js
Normal file
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
@ -66,7 +66,7 @@
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block libs %}
|
||||
<script src="{{ 'assets/javascripts/modernizr.1f0bcf2b.js' | url }}"></script>
|
||||
<script src="{{ 'assets/javascripts/modernizr.74668098.js' | url }}"></script>
|
||||
{% endblock %}
|
||||
{% block fonts %}
|
||||
{% if font != false %}
|
||||
@ -190,7 +190,7 @@
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% block scripts %}
|
||||
<script src="{{ 'assets/javascripts/application.3ca04de7.js' | url }}"></script>
|
||||
<script src="{{ 'assets/javascripts/application.48c2c9de.js' | url }}"></script>
|
||||
{% if lang.t("search.language") != "en" %}
|
||||
{% set languages = lang.t("search.language").split(",") %}
|
||||
{% if languages | length and languages[0] != "" %}
|
||||
|
1388
package-lock.json
generated
1388
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -54,7 +54,6 @@
|
||||
"cssmin": "^0.4.3",
|
||||
"custom-event-polyfill": "^1.0.7",
|
||||
"customizr": "^1.2.1",
|
||||
"escape-string-regexp": "^1.0.5",
|
||||
"eslint": "^5.16.0",
|
||||
"event-hooks-webpack-plugin": "^2.1.1",
|
||||
"expose-loader": "^0.7.4",
|
||||
|
@ -20,13 +20,25 @@
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import escape from "escape-string-regexp"
|
||||
import lunr from "expose-loader?lunr!lunr"
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Functions
|
||||
* ------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Escape a regular expression string
|
||||
*
|
||||
* Taken from the package `escape-string-regexp`
|
||||
*
|
||||
* @param regex - Regular expresison string
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
const escapeRegex = regex => {
|
||||
return regex.replace(/[|\\{}()[\]^$+*?.-]/g, '\\$&');
|
||||
};
|
||||
|
||||
/**
|
||||
* Escape HTML strings
|
||||
*
|
||||
@ -291,7 +303,7 @@ export default class Result {
|
||||
}, new Map)
|
||||
|
||||
/* Assemble regular expressions for matching */
|
||||
const query = escape(this.value_.trim()).replace(
|
||||
const query = escapeRegex(this.value_.trim()).replace(
|
||||
new RegExp(lunr.tokenizer.separator, "img"), "|")
|
||||
const match =
|
||||
new RegExp(`(^|${lunr.tokenizer.separator})(${query})`, "img")
|
||||
|
Loading…
Reference in New Issue
Block a user