mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-11-24 07:30:12 +01:00
Added support for multilingual search
This commit is contained in:
parent
9bb8ecc6b0
commit
974f07ccb4
@ -181,7 +181,7 @@ const load = task => {
|
|||||||
*/
|
*/
|
||||||
gulp.task("assets:images:build:ico", [
|
gulp.task("assets:images:build:ico", [
|
||||||
args.clean ? "assets:images:clean" : false
|
args.clean ? "assets:images:clean" : false
|
||||||
].filter(t => t),
|
].filter(Boolean),
|
||||||
load("assets/images/build/ico"))
|
load("assets/images/build/ico"))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -189,7 +189,7 @@ gulp.task("assets:images:build:ico", [
|
|||||||
*/
|
*/
|
||||||
gulp.task("assets:images:build:svg", [
|
gulp.task("assets:images:build:svg", [
|
||||||
args.clean ? "assets:images:clean" : false
|
args.clean ? "assets:images:clean" : false
|
||||||
].filter(t => t),
|
].filter(Boolean),
|
||||||
load("assets/images/build/svg"))
|
load("assets/images/build/svg"))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -221,7 +221,7 @@ gulp.task("assets:javascripts:build:application", [
|
|||||||
args.clean ? "assets:javascripts:clean" : false,
|
args.clean ? "assets:javascripts:clean" : false,
|
||||||
args.lint ? "assets:javascripts:lint" : false,
|
args.lint ? "assets:javascripts:lint" : false,
|
||||||
args.revision ? "assets:stylesheets:build" : false
|
args.revision ? "assets:stylesheets:build" : false
|
||||||
].filter(t => t),
|
].filter(Boolean),
|
||||||
load("assets/javascripts/build/application"))
|
load("assets/javascripts/build/application"))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -235,15 +235,24 @@ gulp.task("assets:javascripts:build:modernizr", [
|
|||||||
args.clean ? "assets:javascripts:clean" : false,
|
args.clean ? "assets:javascripts:clean" : false,
|
||||||
args.lint ? "assets:javascripts:lint" : false,
|
args.lint ? "assets:javascripts:lint" : false,
|
||||||
args.revision ? "assets:javascripts:build:application" : false
|
args.revision ? "assets:javascripts:build:application" : false
|
||||||
].filter(t => t),
|
].filter(Boolean),
|
||||||
load("assets/javascripts/build/modernizr"))
|
load("assets/javascripts/build/modernizr"))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Build application logic and Modernizr
|
* Build search language support files
|
||||||
|
*/
|
||||||
|
gulp.task("assets:javascripts:build:languages", [
|
||||||
|
args.clean ? "assets:javascripts:clean" : false
|
||||||
|
].filter(Boolean),
|
||||||
|
load("assets/javascripts/build/languages"))
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Build JavaScript
|
||||||
*/
|
*/
|
||||||
gulp.task("assets:javascripts:build", [
|
gulp.task("assets:javascripts:build", [
|
||||||
"assets:javascripts:build:application",
|
"assets:javascripts:build:application",
|
||||||
"assets:javascripts:build:modernizr"
|
"assets:javascripts:build:modernizr",
|
||||||
|
"assets:javascripts:build:languages"
|
||||||
])
|
])
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -274,7 +283,7 @@ gulp.task("assets:javascripts:lint",
|
|||||||
gulp.task("assets:stylesheets:build", [
|
gulp.task("assets:stylesheets:build", [
|
||||||
args.clean ? "assets:stylesheets:clean" : false,
|
args.clean ? "assets:stylesheets:clean" : false,
|
||||||
args.lint ? "assets:stylesheets:lint" : false
|
args.lint ? "assets:stylesheets:lint" : false
|
||||||
].filter(t => t),
|
].filter(Boolean),
|
||||||
load("assets/stylesheets/build"))
|
load("assets/stylesheets/build"))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -324,7 +333,7 @@ gulp.task("views:build", [
|
|||||||
args.revision ? "assets:images:build" : false,
|
args.revision ? "assets:images:build" : false,
|
||||||
args.revision ? "assets:stylesheets:build" : false,
|
args.revision ? "assets:stylesheets:build" : false,
|
||||||
args.revision ? "assets:javascripts:build" : false
|
args.revision ? "assets:javascripts:build" : false
|
||||||
].filter(t => t),
|
].filter(Boolean),
|
||||||
load("views/build"))
|
load("views/build"))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -29,6 +29,6 @@
|
|||||||
* as the imports just don't correctly work with flow. As a workaround we
|
* as the imports just don't correctly work with flow. As a workaround we
|
||||||
* export an object until this error is fixed.
|
* export an object until this error is fixed.
|
||||||
*/
|
*/
|
||||||
declare module "lunr" {
|
declare module "expose-loader?lunr!lunr" {
|
||||||
declare function exports(name: () => void): Object
|
declare function exports(name: () => void): Object
|
||||||
}
|
}
|
||||||
|
37
lib/tasks/assets/javascripts/build/languages.js
Normal file
37
lib/tasks/assets/javascripts/build/languages.js
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to
|
||||||
|
* deal in the Software without restriction, including without limitation the
|
||||||
|
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
* sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
* IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import gulpif from "gulp-if"
|
||||||
|
import path from "path"
|
||||||
|
import uglify from "gulp-uglify"
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* Task: build search language support files
|
||||||
|
* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
export default (gulp, config, args) => {
|
||||||
|
return () => {
|
||||||
|
return gulp.src("node_modules/lunr-languages/*.js")
|
||||||
|
.pipe(gulpif(args.optimize, uglify()))
|
||||||
|
.pipe(gulp.dest(`${config.assets.build}/javascripts/lunr`))
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
1
material/assets/javascripts/lunr/lunr.da.js
Normal file
1
material/assets/javascripts/lunr/lunr.da.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");e.da=function(){this.pipeline.reset(),this.pipeline.add(e.da.trimmer,e.da.stopWordFilter,e.da.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.da.stemmer))},e.da.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",e.da.trimmer=e.trimmerSupport.generateTrimmer(e.da.wordCharacters),e.Pipeline.registerFunction(e.da.trimmer,"trimmer-da"),e.da.stemmer=function(){var r=e.stemmerSupport.Among,i=e.stemmerSupport.SnowballProgram,n=new function(){function e(){var e,r=f.cursor+3;if(d=f.limit,0<=r&&r<=f.limit){for(a=r;;){if(e=f.cursor,f.in_grouping(w,97,248)){f.cursor=e;break}if(f.cursor=e,e>=f.limit)return;f.cursor++}for(;!f.out_grouping(w,97,248);){if(f.cursor>=f.limit)return;f.cursor++}(d=f.cursor)<a&&(d=a)}}function n(){var e,r;if(f.cursor>=d&&(r=f.limit_backward,f.limit_backward=d,f.ket=f.cursor,e=f.find_among_b(c,32),f.limit_backward=r,e))switch(f.bra=f.cursor,e){case 1:f.slice_del();break;case 2:f.in_grouping_b(p,97,229)&&f.slice_del()}}function t(){var e,r=f.limit-f.cursor;f.cursor>=d&&(e=f.limit_backward,f.limit_backward=d,f.ket=f.cursor,f.find_among_b(l,4)?(f.bra=f.cursor,f.limit_backward=e,f.cursor=f.limit-r,f.cursor>f.limit_backward&&(f.cursor--,f.bra=f.cursor,f.slice_del())):f.limit_backward=e)}function s(){var e,r,i,n=f.limit-f.cursor;if(f.ket=f.cursor,f.eq_s_b(2,"st")&&(f.bra=f.cursor,f.eq_s_b(2,"ig")&&f.slice_del()),f.cursor=f.limit-n,f.cursor>=d&&(r=f.limit_backward,f.limit_backward=d,f.ket=f.cursor,e=f.find_among_b(m,5),f.limit_backward=r,e))switch(f.bra=f.cursor,e){case 1:f.slice_del(),i=f.limit-f.cursor,t(),f.cursor=f.limit-i;break;case 2:f.slice_from("løs")}}function o(){var e;f.cursor>=d&&(e=f.limit_backward,f.limit_backward=d,f.ket=f.cursor,f.out_grouping_b(w,97,248)?(f.bra=f.cursor,u=f.slice_to(u),f.limit_backward=e,f.eq_v_b(u)&&f.slice_del()):f.limit_backward=e)}var a,d,u,c=[new r("hed",-1,1),new r("ethed",0,1),new r("ered",-1,1),new r("e",-1,1),new r("erede",3,1),new r("ende",3,1),new r("erende",5,1),new r("ene",3,1),new r("erne",3,1),new r("ere",3,1),new r("en",-1,1),new r("heden",10,1),new r("eren",10,1),new r("er",-1,1),new r("heder",13,1),new r("erer",13,1),new r("s",-1,2),new r("heds",16,1),new r("es",16,1),new r("endes",18,1),new r("erendes",19,1),new r("enes",18,1),new r("ernes",18,1),new r("eres",18,1),new r("ens",16,1),new r("hedens",24,1),new r("erens",24,1),new r("ers",16,1),new r("ets",16,1),new r("erets",28,1),new r("et",-1,1),new r("eret",30,1)],l=[new r("gd",-1,-1),new r("dt",-1,-1),new r("gt",-1,-1),new r("kt",-1,-1)],m=[new r("ig",-1,1),new r("lig",0,1),new r("elig",1,1),new r("els",-1,1),new r("løst",-1,2)],w=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,48,0,128],p=[239,254,42,3,0,0,0,0,0,0,0,0,0,0,0,0,16],f=new i;this.setCurrent=function(e){f.setCurrent(e)},this.getCurrent=function(){return f.getCurrent()},this.stem=function(){var r=f.cursor;return e(),f.limit_backward=r,f.cursor=f.limit,n(),f.cursor=f.limit,t(),f.cursor=f.limit,s(),f.cursor=f.limit,o(),!0}};return function(e){return"function"==typeof e.update?e.update(function(e){return n.setCurrent(e),n.stem(),n.getCurrent()}):(n.setCurrent(e),n.stem(),n.getCurrent())}}(),e.Pipeline.registerFunction(e.da.stemmer,"stemmer-da"),e.da.stopWordFilter=e.generateStopWordFilter("ad af alle alt anden at blev blive bliver da de dem den denne der deres det dette dig din disse dog du efter eller en end er et for fra ham han hans har havde have hende hendes her hos hun hvad hvis hvor i ikke ind jeg jer jo kunne man mange med meget men mig min mine mit mod ned noget nogle nu når og også om op os over på selv sig sin sine sit skal skulle som sådan thi til ud under var vi vil ville vor være været".split(" ")),e.Pipeline.registerFunction(e.da.stopWordFilter,"stopWordFilter-da")}});
|
1
material/assets/javascripts/lunr/lunr.de.js
Normal file
1
material/assets/javascripts/lunr/lunr.de.js
Normal file
File diff suppressed because one or more lines are too long
1
material/assets/javascripts/lunr/lunr.du.js
Normal file
1
material/assets/javascripts/lunr/lunr.du.js
Normal file
File diff suppressed because one or more lines are too long
1
material/assets/javascripts/lunr/lunr.es.js
Normal file
1
material/assets/javascripts/lunr/lunr.es.js
Normal file
File diff suppressed because one or more lines are too long
1
material/assets/javascripts/lunr/lunr.fi.js
Normal file
1
material/assets/javascripts/lunr/lunr.fi.js
Normal file
File diff suppressed because one or more lines are too long
1
material/assets/javascripts/lunr/lunr.fr.js
Normal file
1
material/assets/javascripts/lunr/lunr.fr.js
Normal file
File diff suppressed because one or more lines are too long
1
material/assets/javascripts/lunr/lunr.hu.js
Normal file
1
material/assets/javascripts/lunr/lunr.hu.js
Normal file
File diff suppressed because one or more lines are too long
1
material/assets/javascripts/lunr/lunr.it.js
Normal file
1
material/assets/javascripts/lunr/lunr.it.js
Normal file
File diff suppressed because one or more lines are too long
1
material/assets/javascripts/lunr/lunr.jp.js
Normal file
1
material/assets/javascripts/lunr/lunr.jp.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");var r="2"==e.version[0];e.jp=function(){this.pipeline.reset(),this.pipeline.add(e.jp.stopWordFilter,e.jp.stemmer),r?this.tokenizer=e.jp.tokenizer:(e.tokenizer&&(e.tokenizer=e.jp.tokenizer),this.tokenizerFn&&(this.tokenizerFn=e.jp.tokenizer))};var t=new e.TinySegmenter;e.jp.tokenizer=function(n){if(!arguments.length||null==n||void 0==n)return[];if(Array.isArray(n))return n.map(function(t){return r?new e.Token(t.toLowerCase()):t.toLowerCase()});for(var i=n.toString().toLowerCase().replace(/^\s+/,""),o=i.length-1;o>=0;o--)if(/\S/.test(i.charAt(o))){i=i.substring(0,o+1);break}return t.segment(i).filter(function(e){return!!e}).map(function(t){return r?new e.Token(t):t})},e.jp.stemmer=function(){return function(e){return e}}(),e.Pipeline.registerFunction(e.jp.stemmer,"stemmer-jp"),e.jp.wordCharacters="一二三四五六七八九十百千万億兆一-龠々〆ヵヶぁ-んァ-ヴーア-ン゙a-zA-Za-zA-Z0-90-9",e.jp.stopWordFilter=function(t){if(-1===e.jp.stopWordFilter.stopWords.indexOf(r?t.toString():t))return t},e.jp.stopWordFilter=e.generateStopWordFilter("これ それ あれ この その あの ここ そこ あそこ こちら どこ だれ なに なん 何 私 貴方 貴方方 我々 私達 あの人 あのかた 彼女 彼 です あります おります います は が の に を で え から まで より も どの と し それで しかし".split(" ")),e.Pipeline.registerFunction(e.jp.stopWordFilter,"stopWordFilter-jp")}});
|
1
material/assets/javascripts/lunr/lunr.multi.js
Normal file
1
material/assets/javascripts/lunr/lunr.multi.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
!function(e,i){"function"==typeof define&&define.amd?define(i):"object"==typeof exports?module.exports=i():i()(e.lunr)}(this,function(){return function(e){e.multiLanguage=function(){for(var i=Array.prototype.slice.call(arguments),t=i.join("-"),r="",n=[],s=[],p=0;p<i.length;++p)"en"==i[p]?(r+="\\w",n.unshift(e.stopWordFilter),n.push(e.stemmer),s.push(e.stemmer)):(r+=e[i[p]].wordCharacters,n.unshift(e[i[p]].stopWordFilter),n.push(e[i[p]].stemmer),s.push(e[i[p]].stemmer));var o=e.trimmerSupport.generateTrimmer(r);return e.Pipeline.registerFunction(o,"lunr-multi-trimmer-"+t),n.unshift(o),function(){this.pipeline.reset(),this.pipeline.add.apply(this.pipeline,n),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add.apply(this.searchPipeline,s))}}}});
|
1
material/assets/javascripts/lunr/lunr.no.js
Normal file
1
material/assets/javascripts/lunr/lunr.no.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");e.no=function(){this.pipeline.reset(),this.pipeline.add(e.no.trimmer,e.no.stopWordFilter,e.no.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.no.stemmer))},e.no.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",e.no.trimmer=e.trimmerSupport.generateTrimmer(e.no.wordCharacters),e.Pipeline.registerFunction(e.no.trimmer,"trimmer-no"),e.no.stemmer=function(){var r=e.stemmerSupport.Among,n=e.stemmerSupport.SnowballProgram,i=new function(){function e(){var e,r=w.cursor+3;if(a=w.limit,0<=r||r<=w.limit){for(s=r;;){if(e=w.cursor,w.in_grouping(d,97,248)){w.cursor=e;break}if(e>=w.limit)return;w.cursor=e+1}for(;!w.out_grouping(d,97,248);){if(w.cursor>=w.limit)return;w.cursor++}(a=w.cursor)<s&&(a=s)}}function i(){var e,r,n;if(w.cursor>=a&&(r=w.limit_backward,w.limit_backward=a,w.ket=w.cursor,e=w.find_among_b(m,29),w.limit_backward=r,e))switch(w.bra=w.cursor,e){case 1:w.slice_del();break;case 2:n=w.limit-w.cursor,w.in_grouping_b(c,98,122)?w.slice_del():(w.cursor=w.limit-n,w.eq_s_b(1,"k")&&w.out_grouping_b(d,97,248)&&w.slice_del());break;case 3:w.slice_from("er")}}function t(){var e,r=w.limit-w.cursor;w.cursor>=a&&(e=w.limit_backward,w.limit_backward=a,w.ket=w.cursor,w.find_among_b(u,2)?(w.bra=w.cursor,w.limit_backward=e,w.cursor=w.limit-r,w.cursor>w.limit_backward&&(w.cursor--,w.bra=w.cursor,w.slice_del())):w.limit_backward=e)}function o(){var e,r;w.cursor>=a&&(r=w.limit_backward,w.limit_backward=a,w.ket=w.cursor,(e=w.find_among_b(l,11))?(w.bra=w.cursor,w.limit_backward=r,1==e&&w.slice_del()):w.limit_backward=r)}var s,a,m=[new r("a",-1,1),new r("e",-1,1),new r("ede",1,1),new r("ande",1,1),new r("ende",1,1),new r("ane",1,1),new r("ene",1,1),new r("hetene",6,1),new r("erte",1,3),new r("en",-1,1),new r("heten",9,1),new r("ar",-1,1),new r("er",-1,1),new r("heter",12,1),new r("s",-1,2),new r("as",14,1),new r("es",14,1),new r("edes",16,1),new r("endes",16,1),new r("enes",16,1),new r("hetenes",19,1),new r("ens",14,1),new r("hetens",21,1),new r("ers",14,1),new r("ets",14,1),new r("et",-1,1),new r("het",25,1),new r("ert",-1,3),new r("ast",-1,1)],u=[new r("dt",-1,-1),new r("vt",-1,-1)],l=[new r("leg",-1,1),new r("eleg",0,1),new r("ig",-1,1),new r("eig",2,1),new r("lig",2,1),new r("elig",4,1),new r("els",-1,1),new r("lov",-1,1),new r("elov",7,1),new r("slov",7,1),new r("hetslov",9,1)],d=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,48,0,128],c=[119,125,149,1],w=new n;this.setCurrent=function(e){w.setCurrent(e)},this.getCurrent=function(){return w.getCurrent()},this.stem=function(){var r=w.cursor;return e(),w.limit_backward=r,w.cursor=w.limit,i(),w.cursor=w.limit,t(),w.cursor=w.limit,o(),!0}};return function(e){return"function"==typeof e.update?e.update(function(e){return i.setCurrent(e),i.stem(),i.getCurrent()}):(i.setCurrent(e),i.stem(),i.getCurrent())}}(),e.Pipeline.registerFunction(e.no.stemmer,"stemmer-no"),e.no.stopWordFilter=e.generateStopWordFilter("alle at av bare begge ble blei bli blir blitt både båe da de deg dei deim deira deires dem den denne der dere deres det dette di din disse ditt du dykk dykkar då eg ein eit eitt eller elles en enn er et ett etter for fordi fra før ha hadde han hans har hennar henne hennes her hjå ho hoe honom hoss hossen hun hva hvem hver hvilke hvilken hvis hvor hvordan hvorfor i ikke ikkje ikkje ingen ingi inkje inn inni ja jeg kan kom korleis korso kun kunne kva kvar kvarhelst kven kvi kvifor man mange me med medan meg meget mellom men mi min mine mitt mot mykje ned no noe noen noka noko nokon nokor nokre nå når og også om opp oss over på samme seg selv si si sia sidan siden sin sine sitt sjøl skal skulle slik so som som somme somt så sånn til um upp ut uten var vart varte ved vere verte vi vil ville vore vors vort vår være være vært å".split(" ")),e.Pipeline.registerFunction(e.no.stopWordFilter,"stopWordFilter-no")}});
|
1
material/assets/javascripts/lunr/lunr.pt.js
Normal file
1
material/assets/javascripts/lunr/lunr.pt.js
Normal file
File diff suppressed because one or more lines are too long
1
material/assets/javascripts/lunr/lunr.ro.js
Normal file
1
material/assets/javascripts/lunr/lunr.ro.js
Normal file
File diff suppressed because one or more lines are too long
1
material/assets/javascripts/lunr/lunr.ru.js
Normal file
1
material/assets/javascripts/lunr/lunr.ru.js
Normal file
File diff suppressed because one or more lines are too long
1
material/assets/javascripts/lunr/lunr.stemmer.support.js
Normal file
1
material/assets/javascripts/lunr/lunr.stemmer.support.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
!function(r,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():t()(r.lunr)}(this,function(){return function(r){r.stemmerSupport={Among:function(r,t,i,s){if(this.toCharArray=function(r){for(var t=r.length,i=new Array(t),s=0;s<t;s++)i[s]=r.charCodeAt(s);return i},!r&&""!=r||!t&&0!=t||!i)throw"Bad Among initialisation: s:"+r+", substring_i: "+t+", result: "+i;this.s_size=r.length,this.s=this.toCharArray(r),this.substring_i=t,this.result=i,this.method=s},SnowballProgram:function(){var r;return{bra:0,ket:0,limit:0,cursor:0,limit_backward:0,setCurrent:function(t){r=t,this.cursor=0,this.limit=t.length,this.limit_backward=0,this.bra=this.cursor,this.ket=this.limit},getCurrent:function(){var t=r;return r=null,t},in_grouping:function(t,i,s){if(this.cursor<this.limit){var e=r.charCodeAt(this.cursor);if(e<=s&&e>=i&&(e-=i,t[e>>3]&1<<(7&e)))return this.cursor++,!0}return!1},in_grouping_b:function(t,i,s){if(this.cursor>this.limit_backward){var e=r.charCodeAt(this.cursor-1);if(e<=s&&e>=i&&(e-=i,t[e>>3]&1<<(7&e)))return this.cursor--,!0}return!1},out_grouping:function(t,i,s){if(this.cursor<this.limit){var e=r.charCodeAt(this.cursor);if(e>s||e<i)return this.cursor++,!0;if(e-=i,!(t[e>>3]&1<<(7&e)))return this.cursor++,!0}return!1},out_grouping_b:function(t,i,s){if(this.cursor>this.limit_backward){var e=r.charCodeAt(this.cursor-1);if(e>s||e<i)return this.cursor--,!0;if(e-=i,!(t[e>>3]&1<<(7&e)))return this.cursor--,!0}return!1},eq_s:function(t,i){if(this.limit-this.cursor<t)return!1;for(var s=0;s<t;s++)if(r.charCodeAt(this.cursor+s)!=i.charCodeAt(s))return!1;return this.cursor+=t,!0},eq_s_b:function(t,i){if(this.cursor-this.limit_backward<t)return!1;for(var s=0;s<t;s++)if(r.charCodeAt(this.cursor-t+s)!=i.charCodeAt(s))return!1;return this.cursor-=t,!0},find_among:function(t,i){for(var s=0,e=i,n=this.cursor,u=this.limit,o=0,h=0,c=!1;;){for(var a=s+(e-s>>1),f=0,l=o<h?o:h,_=t[a],m=l;m<_.s_size;m++){if(n+l==u){f=-1;break}if(f=r.charCodeAt(n+l)-_.s[m])break;l++}if(f<0?(e=a,h=l):(s=a,o=l),e-s<=1){if(s>0||e==s||c)break;c=!0}}for(;;){if(o>=(_=t[s]).s_size){if(this.cursor=n+_.s_size,!_.method)return _.result;var b=_.method();if(this.cursor=n+_.s_size,b)return _.result}if((s=_.substring_i)<0)return 0}},find_among_b:function(t,i){for(var s=0,e=i,n=this.cursor,u=this.limit_backward,o=0,h=0,c=!1;;){for(var a=s+(e-s>>1),f=0,l=o<h?o:h,_=(m=t[a]).s_size-1-l;_>=0;_--){if(n-l==u){f=-1;break}if(f=r.charCodeAt(n-1-l)-m.s[_])break;l++}if(f<0?(e=a,h=l):(s=a,o=l),e-s<=1){if(s>0||e==s||c)break;c=!0}}for(;;){var m=t[s];if(o>=m.s_size){if(this.cursor=n-m.s_size,!m.method)return m.result;var b=m.method();if(this.cursor=n-m.s_size,b)return m.result}if((s=m.substring_i)<0)return 0}},replace_s:function(t,i,s){var e=s.length-(i-t),n=r.substring(0,t),u=r.substring(i);return r=n+s+u,this.limit+=e,this.cursor>=i?this.cursor+=e:this.cursor>t&&(this.cursor=t),e},slice_check:function(){if(this.bra<0||this.bra>this.ket||this.ket>this.limit||this.limit>r.length)throw"faulty slice operation"},slice_from:function(r){this.slice_check(),this.replace_s(this.bra,this.ket,r)},slice_del:function(){this.slice_from("")},insert:function(r,t,i){var s=this.replace_s(r,t,i);r<=this.bra&&(this.bra+=s),r<=this.ket&&(this.ket+=s)},slice_to:function(){return this.slice_check(),r.substring(this.bra,this.ket)},eq_v_b:function(r){return this.eq_s_b(r.length,r)}}}},r.trimmerSupport={generateTrimmer:function(r){var t=new RegExp("^[^"+r+"]+"),i=new RegExp("[^"+r+"]+$");return function(r){return"function"==typeof r.update?r.update(function(r){return r.replace(t,"").replace(i,"")}):r.replace(t,"").replace(i,"")}}}}});
|
1
material/assets/javascripts/lunr/lunr.sv.js
Normal file
1
material/assets/javascripts/lunr/lunr.sv.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");e.sv=function(){this.pipeline.reset(),this.pipeline.add(e.sv.trimmer,e.sv.stopWordFilter,e.sv.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.sv.stemmer))},e.sv.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",e.sv.trimmer=e.trimmerSupport.generateTrimmer(e.sv.wordCharacters),e.Pipeline.registerFunction(e.sv.trimmer,"trimmer-sv"),e.sv.stemmer=function(){var r=e.stemmerSupport.Among,n=e.stemmerSupport.SnowballProgram,t=new function(){function e(){var e,r=w.cursor+3;if(o=w.limit,0<=r||r<=w.limit){for(a=r;;){if(e=w.cursor,w.in_grouping(l,97,246)){w.cursor=e;break}if(w.cursor=e,w.cursor>=w.limit)return;w.cursor++}for(;!w.out_grouping(l,97,246);){if(w.cursor>=w.limit)return;w.cursor++}(o=w.cursor)<a&&(o=a)}}function t(){var e,r=w.limit_backward;if(w.cursor>=o&&(w.limit_backward=o,w.cursor=w.limit,w.ket=w.cursor,e=w.find_among_b(u,37),w.limit_backward=r,e))switch(w.bra=w.cursor,e){case 1:w.slice_del();break;case 2:w.in_grouping_b(d,98,121)&&w.slice_del()}}function i(){var e=w.limit_backward;w.cursor>=o&&(w.limit_backward=o,w.cursor=w.limit,w.find_among_b(c,7)&&(w.cursor=w.limit,w.ket=w.cursor,w.cursor>w.limit_backward&&(w.bra=--w.cursor,w.slice_del())),w.limit_backward=e)}function s(){var e,r;if(w.cursor>=o){if(r=w.limit_backward,w.limit_backward=o,w.cursor=w.limit,w.ket=w.cursor,e=w.find_among_b(m,5))switch(w.bra=w.cursor,e){case 1:w.slice_del();break;case 2:w.slice_from("lös");break;case 3:w.slice_from("full")}w.limit_backward=r}}var a,o,u=[new r("a",-1,1),new r("arna",0,1),new r("erna",0,1),new r("heterna",2,1),new r("orna",0,1),new r("ad",-1,1),new r("e",-1,1),new r("ade",6,1),new r("ande",6,1),new r("arne",6,1),new r("are",6,1),new r("aste",6,1),new r("en",-1,1),new r("anden",12,1),new r("aren",12,1),new r("heten",12,1),new r("ern",-1,1),new r("ar",-1,1),new r("er",-1,1),new r("heter",18,1),new r("or",-1,1),new r("s",-1,2),new r("as",21,1),new r("arnas",22,1),new r("ernas",22,1),new r("ornas",22,1),new r("es",21,1),new r("ades",26,1),new r("andes",26,1),new r("ens",21,1),new r("arens",29,1),new r("hetens",29,1),new r("erns",21,1),new r("at",-1,1),new r("andet",-1,1),new r("het",-1,1),new r("ast",-1,1)],c=[new r("dd",-1,-1),new r("gd",-1,-1),new r("nn",-1,-1),new r("dt",-1,-1),new r("gt",-1,-1),new r("kt",-1,-1),new r("tt",-1,-1)],m=[new r("ig",-1,1),new r("lig",0,1),new r("els",-1,1),new r("fullt",-1,3),new r("löst",-1,2)],l=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,24,0,32],d=[119,127,149],w=new n;this.setCurrent=function(e){w.setCurrent(e)},this.getCurrent=function(){return w.getCurrent()},this.stem=function(){var r=w.cursor;return e(),w.limit_backward=r,w.cursor=w.limit,t(),w.cursor=w.limit,i(),w.cursor=w.limit,s(),!0}};return function(e){return"function"==typeof e.update?e.update(function(e){return t.setCurrent(e),t.stem(),t.getCurrent()}):(t.setCurrent(e),t.stem(),t.getCurrent())}}(),e.Pipeline.registerFunction(e.sv.stemmer,"stemmer-sv"),e.sv.stopWordFilter=e.generateStopWordFilter("alla allt att av blev bli blir blivit de dem den denna deras dess dessa det detta dig din dina ditt du där då efter ej eller en er era ert ett från för ha hade han hans har henne hennes hon honom hur här i icke ingen inom inte jag ju kan kunde man med mellan men mig min mina mitt mot mycket ni nu när någon något några och om oss på samma sedan sig sin sina sitta själv skulle som så sådan sådana sådant till under upp ut utan vad var vara varför varit varje vars vart vem vi vid vilka vilkas vilken vilket vår våra vårt än är åt över".split(" ")),e.Pipeline.registerFunction(e.sv.stopWordFilter,"stopWordFilter-sv")}});
|
1
material/assets/javascripts/lunr/lunr.tr.js
Normal file
1
material/assets/javascripts/lunr/lunr.tr.js
Normal file
File diff suppressed because one or more lines are too long
1
material/assets/javascripts/lunr/tinyseg.js
Normal file
1
material/assets/javascripts/lunr/tinyseg.js
Normal file
File diff suppressed because one or more lines are too long
@ -149,7 +149,20 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script src="{{ base_url }}/assets/javascripts/application-06a3e72efd.js"></script>
|
<script src="{{ base_url }}/assets/javascripts/application-71e40776cb.js"></script>
|
||||||
|
{% set languages = lang.t('search.languages').split(",") %}
|
||||||
|
{% if languages | length and languages[0] != "" %}
|
||||||
|
{% set path = base_url + "/assets/javascripts/lunr" %}
|
||||||
|
<script src="{{ path }}/lunr.stemmer.support.js"></script>
|
||||||
|
{% for language in languages | map("trim") %}
|
||||||
|
{% if language != "en" %}
|
||||||
|
<script src="{{ path }}/lunr.{{ language }}.js"></script>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% if languages | length > 1 %}
|
||||||
|
<script src="{{ path }}/lunr.multi.js"></script>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
<script>app.initialize({url:{base:"{{ base_url }}"}})</script>
|
<script>app.initialize({url:{base:"{{ base_url }}"}})</script>
|
||||||
{% for path in extra_javascript %}
|
{% for path in extra_javascript %}
|
||||||
<script src="{{ path }}"></script>
|
<script src="{{ path }}"></script>
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
"footer.next": "Next",
|
"footer.next": "Next",
|
||||||
"meta.comments": "Comments",
|
"meta.comments": "Comments",
|
||||||
"meta.source": "Source",
|
"meta.source": "Source",
|
||||||
|
"search.languages": "",
|
||||||
"search.placeholder": "Search",
|
"search.placeholder": "Search",
|
||||||
"search.result.placeholder": "Type to start searching",
|
"search.result.placeholder": "Type to start searching",
|
||||||
"search.result.none": "No matching documents",
|
"search.result.none": "No matching documents",
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
</form>
|
</form>
|
||||||
<div class="md-search__output">
|
<div class="md-search__output">
|
||||||
<div class="md-search__scrollwrap" data-md-scrollfix>
|
<div class="md-search__scrollwrap" data-md-scrollfix>
|
||||||
<div class="md-search-result" data-md-component="result">
|
<div class="md-search-result" data-md-component="result" data-md-lang-search="{{ lang.t('search.languages') }}">
|
||||||
<div class="md-search-result__meta" data-md-lang-result-none="{{ lang.t('search.result.none') }}" data-md-lang-result-one="{{ lang.t('search.result.one') }}" data-md-lang-result-other="{{ lang.t('search.result.other') }}">
|
<div class="md-search-result__meta" data-md-lang-result-none="{{ lang.t('search.result.none') }}" data-md-lang-result-one="{{ lang.t('search.result.one') }}" data-md-lang-result-other="{{ lang.t('search.result.other') }}">
|
||||||
{{ lang.t('search.result.placeholder') }}
|
{{ lang.t('search.result.placeholder') }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -54,6 +54,7 @@
|
|||||||
"custom-event-polyfill": "^0.3.0",
|
"custom-event-polyfill": "^0.3.0",
|
||||||
"del": "^2.2.2",
|
"del": "^2.2.2",
|
||||||
"eslint": "^3.16.0",
|
"eslint": "^3.16.0",
|
||||||
|
"expose-loader": "^0.7.3",
|
||||||
"fastclick": "^1.0.6",
|
"fastclick": "^1.0.6",
|
||||||
"flow-bin": "^0.46.0",
|
"flow-bin": "^0.46.0",
|
||||||
"flow-jsdoc": "^0.3.0",
|
"flow-jsdoc": "^0.3.0",
|
||||||
@ -80,6 +81,7 @@
|
|||||||
"gulp-util": "^3.0.8",
|
"gulp-util": "^3.0.8",
|
||||||
"js-cookie": "^2.1.3",
|
"js-cookie": "^2.1.3",
|
||||||
"lunr": "^2.0.2",
|
"lunr": "^2.0.2",
|
||||||
|
"lunr-languages": "^1.0.0",
|
||||||
"material-design-color": "2.3.2",
|
"material-design-color": "2.3.2",
|
||||||
"material-shadows": "3.0.1",
|
"material-shadows": "3.0.1",
|
||||||
"modularscale-sass": "3.0.2",
|
"modularscale-sass": "3.0.2",
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import escape from "escape-string-regexp"
|
import escape from "escape-string-regexp"
|
||||||
import lunr from "lunr"
|
import lunr from "expose-loader?lunr!lunr"
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
* Class
|
* Class
|
||||||
@ -39,6 +39,7 @@ export default class Result {
|
|||||||
* @property {Object} docs_ - Indexed documents
|
* @property {Object} docs_ - Indexed documents
|
||||||
* @property {HTMLElement} meta_ - Search meta information
|
* @property {HTMLElement} meta_ - Search meta information
|
||||||
* @property {HTMLElement} list_ - Search result list
|
* @property {HTMLElement} list_ - Search result list
|
||||||
|
* @property {Array<string>} lang_ - Search languages
|
||||||
* @property {Object} message_ - Search result messages
|
* @property {Object} message_ - Search result messages
|
||||||
* @property {Object} index_ - Search index
|
* @property {Object} index_ - Search index
|
||||||
* @property {string} value_ - Last input value
|
* @property {string} value_ - Last input value
|
||||||
@ -69,6 +70,11 @@ export default class Result {
|
|||||||
one: this.meta_.dataset.mdLangResultOne,
|
one: this.meta_.dataset.mdLangResultOne,
|
||||||
other: this.meta_.dataset.mdLangResultOther
|
other: this.meta_.dataset.mdLangResultOther
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Load search languages */
|
||||||
|
this.lang_ = this.el_.dataset.mdLangSearch.split(",")
|
||||||
|
.filter(Boolean)
|
||||||
|
.map(lang => lang.trim())
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -134,8 +140,20 @@ export default class Result {
|
|||||||
}, new Map)
|
}, new Map)
|
||||||
|
|
||||||
/* eslint-disable no-invalid-this, lines-around-comment */
|
/* eslint-disable no-invalid-this, lines-around-comment */
|
||||||
const docs = this.docs_
|
const docs = this.docs_,
|
||||||
|
lang = this.lang_
|
||||||
|
|
||||||
|
/* Create index */
|
||||||
this.index_ = lunr(function() {
|
this.index_ = lunr(function() {
|
||||||
|
|
||||||
|
/* Set up stemmers for search languages */
|
||||||
|
if (lang.length === 1) {
|
||||||
|
this.use(lunr[lang[0]])
|
||||||
|
} else if (lang.length > 1) {
|
||||||
|
this.use(lunr.multiLanguage(...lang))
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Index fields */
|
||||||
this.field("title", { boost: 10 })
|
this.field("title", { boost: 10 })
|
||||||
this.field("text")
|
this.field("text")
|
||||||
this.ref("location")
|
this.ref("location")
|
||||||
|
@ -276,6 +276,23 @@
|
|||||||
<!-- Block: theme-related JavaScript -->
|
<!-- Block: theme-related JavaScript -->
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script src="{{ base_url }}/assets/javascripts/application.js"></script>
|
<script src="{{ base_url }}/assets/javascripts/application.js"></script>
|
||||||
|
|
||||||
|
<!-- Load additional languages for search -->
|
||||||
|
{% set languages = lang.t('search.languages').split(",") %}
|
||||||
|
{% if languages | length and languages[0] != "" %}
|
||||||
|
{% set path = base_url + "/assets/javascripts/lunr" %}
|
||||||
|
<script src="{{ path }}/lunr.stemmer.support.js"></script>
|
||||||
|
{% for language in languages | map("trim") %}
|
||||||
|
{% if language != "en" %}
|
||||||
|
<script src="{{ path }}/lunr.{{ language }}.js"></script>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% if languages | length > 1 %}
|
||||||
|
<script src="{{ path }}/lunr.multi.js"></script>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<!-- Initialize application -->
|
||||||
<script>
|
<script>
|
||||||
app.initialize({ url: { base: "{{ base_url }}", } });
|
app.initialize({ url: { base: "{{ base_url }}", } });
|
||||||
</script>
|
</script>
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
"footer.next": "Next",
|
"footer.next": "Next",
|
||||||
"meta.comments": "Comments",
|
"meta.comments": "Comments",
|
||||||
"meta.source": "Source",
|
"meta.source": "Source",
|
||||||
|
"search.languages": "",
|
||||||
"search.placeholder": "Search",
|
"search.placeholder": "Search",
|
||||||
"search.result.placeholder": "Type to start searching",
|
"search.result.placeholder": "Type to start searching",
|
||||||
"search.result.none": "No matching documents",
|
"search.result.none": "No matching documents",
|
||||||
|
@ -37,7 +37,8 @@
|
|||||||
</form>
|
</form>
|
||||||
<div class="md-search__output">
|
<div class="md-search__output">
|
||||||
<div class="md-search__scrollwrap" data-md-scrollfix>
|
<div class="md-search__scrollwrap" data-md-scrollfix>
|
||||||
<div class="md-search-result" data-md-component="result">
|
<div class="md-search-result" data-md-component="result"
|
||||||
|
data-md-lang-search="{{ lang.t('search.languages') }}">
|
||||||
<div class="md-search-result__meta"
|
<div class="md-search-result__meta"
|
||||||
data-md-lang-result-none="{{ lang.t('search.result.none') }}"
|
data-md-lang-result-none="{{ lang.t('search.result.none') }}"
|
||||||
data-md-lang-result-one="{{ lang.t('search.result.one') }}"
|
data-md-lang-result-one="{{ lang.t('search.result.one') }}"
|
||||||
|
Loading…
Reference in New Issue
Block a user