From 8e6013a96483f9c60128030c50ff82d84f77082a Mon Sep 17 00:00:00 2001 From: zzossig Date: Thu, 6 Feb 2020 11:18:23 +0900 Subject: [PATCH] search logic changed to use .Permalink --- archetypes/publication.md | 12 ++--- assets/js/fuzzysort.min.js | 14 +++--- exampleSite/config/_default/config.toml | 13 ++++- layouts/_default/list.json.json | 22 -------- layouts/_default/list.searchindex.json | 26 ++++++++++ layouts/_default/single.searchindex.json | 7 +++ layouts/_default/taxonomy.searchindex.json | 7 +++ layouts/_default/terms.searchindex.json | 7 +++ layouts/index.json | 19 +++---- layouts/partials/head/scripts.html | 50 ++----------------- layouts/partials/publication/pub-toolbar.html | 34 ++++++------- layouts/partials/script/pub-list-script.html | 7 +-- 12 files changed, 99 insertions(+), 119 deletions(-) delete mode 100644 layouts/_default/list.json.json create mode 100644 layouts/_default/list.searchindex.json create mode 100644 layouts/_default/single.searchindex.json create mode 100644 layouts/_default/taxonomy.searchindex.json create mode 100644 layouts/_default/terms.searchindex.json diff --git a/archetypes/publication.md b/archetypes/publication.md index 669effa..8311f55 100644 --- a/archetypes/publication.md +++ b/archetypes/publication.md @@ -1,6 +1,6 @@ ---- -title: "{{ replace .Name "-" " " | title }}" -date: {{ .Date }} -description: -type: publication ---- +--- +title: "{{ replace .Name "-" " " | title }}" +date: {{ .Date }} +description: +type: publication +--- diff --git a/assets/js/fuzzysort.min.js b/assets/js/fuzzysort.min.js index ce07a85..e8229ce 100644 --- a/assets/js/fuzzysort.min.js +++ b/assets/js/fuzzysort.min.js @@ -1,8 +1,8 @@ -/** - * Minified by jsDelivr using UglifyJS v3.4.4. - * Original file: /npm/fuzzysort@1.1.4/fuzzysort.js - * - * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files - */ -!function(e,r){"function"==typeof define&&define.amd?define([],r):"object"==typeof module&&module.exports?module.exports=r():e.fuzzysort=r()}(this,function(){var P="undefined"!=typeof require&&"undefined"==typeof window,n=new Map,o=new Map,j=[];j.total=0;var m=[],T=[];function r(){n.clear(),o.clear(),m=[],T=[]}function N(e){for(var r=-9007199254740991,n=e.length-1;0<=n;--n){var o=e[n];if(null!==o){var t=o.score;r>1]=i[e],n=1+(e<<1)}for(var t=e-1>>1;0>1)i[e]=i[t];i[e]=r}return e.add=function(e){var r=a;i[a++]=e;for(var n=r-1>>1;0>1)i[r]=i[n];i[r]=e},e.poll=function(){if(0!==a){var e=i[0];return i[0]=i[--a],r(),e}},e.peek=function(e){if(0!==a)return i[0]},e.replaceTop=function(e){i[0]=e,r()},e},k=t();return function e(A){var L={single:function(e,r,n){return e?(D(e)||(e=L.getPreparedSearch(e)),r?(D(r)||(r=L.getPrepared(r)),((n&&void 0!==n.allowTypo?n.allowTypo:!A||void 0===A.allowTypo||A.allowTypo)?L.algorithm:L.algorithmNoTypo)(e,r,e[0])):null):null},go:function(e,r,n){if(!e)return j;var o=(e=L.prepareSearch(e))[0],t=n&&n.threshold||A&&A.threshold||-9007199254740991,i=n&&n.limit||A&&A.limit||9007199254740991,a=(n&&void 0!==n.allowTypo?n.allowTypo:!A||void 0===A.allowTypo||A.allowTypo)?L.algorithm:L.algorithmNoTypo,l=0,f=0,u=r.length;if(n&&n.keys)for(var s=n.scoreFn||N,p=n.keys,d=p.length,c=u-1;0<=c;--c){for(var g=r[c],v=new Array(d),h=d-1;0<=h;--h)(y=S(g,x=p[h]))?(D(y)||(y=L.getPrepared(y)),v[h]=a(e,y,o)):v[h]=null;v.obj=g;var w=s(v);null!==w&&(wk.peek().score&&k.replaceTop(v))))}else if(n&&n.key){var x=n.key;for(c=u-1;0<=c;--c)(y=S(g=r[c],x))&&(D(y)||(y=L.getPrepared(y)),null!==(m=a(e,y,o))&&(m.scorek.peek().score&&k.replaceTop(m)))))}else for(c=u-1;0<=c;--c){var y,m;(y=r[c])&&(D(y)||(y=L.getPrepared(y)),null!==(m=a(e,y,o))&&(m.scorek.peek().score&&k.replaceTop(m)))))}if(0===l)return j;var T=new Array(l);for(c=l-1;0<=c;--c)T[c]=k.poll();return T.total=l+f,T},goAsync:function(I,B,_){var C=!1,e=new Promise(function(c,g){if(!I)return c(j);var v=(I=L.prepareSearch(I))[0],h=t(),w=B.length-1,x=_&&_.threshold||A&&A.threshold||-9007199254740991,y=_&&_.limit||A&&A.limit||9007199254740991,m=(_&&void 0!==_.allowTypo?_.allowTypo:!A||void 0===A.allowTypo||A.allowTypo)?L.algorithm:L.algorithmNoTypo,T=0,k=0;function b(){if(C)return g("canceled");var e=Date.now();if(_&&_.keys)for(var r=_.scoreFn||N,n=_.keys,o=n.length;0<=w;--w){for(var t=B[w],i=new Array(o),a=o-1;0<=a;--a)(u=S(t,f=n[a]))?(D(u)||(u=L.getPrepared(u)),i[a]=m(I,u,v)):i[a]=null;i.obj=t;var l=r(i);if(null!==l&&!(lh.peek().score&&h.replaceTop(i)),w%1e3==0&&10<=Date.now()-e))return void(P?setImmediate(b):setTimeout(b))}else if(_&&_.key){for(var f=_.key;0<=w;--w)if((u=S(t=B[w],f))&&(D(u)||(u=L.getPrepared(u)),null!==(s=m(I,u,v))&&!(s.scoreh.peek().score&&h.replaceTop(s)),w%1e3==0&&10<=Date.now()-e)))return void(P?setImmediate(b):setTimeout(b))}else for(;0<=w;--w){var u,s;if((u=B[w])&&(D(u)||(u=L.getPrepared(u)),null!==(s=m(I,u,v))&&!(s.scoreh.peek().score&&h.replaceTop(s)),w%1e3==0&&10<=Date.now()-e)))return void(P?setImmediate(b):setTimeout(b))}if(0===T)return c(j);for(var p=new Array(T),d=T-1;0<=d;--d)p[d]=h.poll();p.total=T+k,c(p)}P?setImmediate(b):b()});return e.cancel=function(){C=!0},e},highlight:function(e,r,n){if(null===e)return null;void 0===r&&(r=""),void 0===n&&(n="");for(var o="",t=0,i=!1,a=e.target,l=a.length,f=e.indexes,u=0;u>1]=i[e],n=1+(e<<1)}for(var t=e-1>>1;0>1)i[e]=i[t];i[e]=r}return e.add=function(e){var r=a;i[a++]=e;for(var n=r-1>>1;0>1)i[r]=i[n];i[r]=e},e.poll=function(){if(0!==a){var e=i[0];return i[0]=i[--a],r(),e}},e.peek=function(e){if(0!==a)return i[0]},e.replaceTop=function(e){i[0]=e,r()},e},k=t();return function e(A){var L={single:function(e,r,n){return e?(D(e)||(e=L.getPreparedSearch(e)),r?(D(r)||(r=L.getPrepared(r)),((n&&void 0!==n.allowTypo?n.allowTypo:!A||void 0===A.allowTypo||A.allowTypo)?L.algorithm:L.algorithmNoTypo)(e,r,e[0])):null):null},go:function(e,r,n){if(!e)return j;var o=(e=L.prepareSearch(e))[0],t=n&&n.threshold||A&&A.threshold||-9007199254740991,i=n&&n.limit||A&&A.limit||9007199254740991,a=(n&&void 0!==n.allowTypo?n.allowTypo:!A||void 0===A.allowTypo||A.allowTypo)?L.algorithm:L.algorithmNoTypo,l=0,f=0,u=r.length;if(n&&n.keys)for(var s=n.scoreFn||N,p=n.keys,d=p.length,c=u-1;0<=c;--c){for(var g=r[c],v=new Array(d),h=d-1;0<=h;--h)(y=S(g,x=p[h]))?(D(y)||(y=L.getPrepared(y)),v[h]=a(e,y,o)):v[h]=null;v.obj=g;var w=s(v);null!==w&&(wk.peek().score&&k.replaceTop(v))))}else if(n&&n.key){var x=n.key;for(c=u-1;0<=c;--c)(y=S(g=r[c],x))&&(D(y)||(y=L.getPrepared(y)),null!==(m=a(e,y,o))&&(m.scorek.peek().score&&k.replaceTop(m)))))}else for(c=u-1;0<=c;--c){var y,m;(y=r[c])&&(D(y)||(y=L.getPrepared(y)),null!==(m=a(e,y,o))&&(m.scorek.peek().score&&k.replaceTop(m)))))}if(0===l)return j;var T=new Array(l);for(c=l-1;0<=c;--c)T[c]=k.poll();return T.total=l+f,T},goAsync:function(I,B,_){var C=!1,e=new Promise(function(c,g){if(!I)return c(j);var v=(I=L.prepareSearch(I))[0],h=t(),w=B.length-1,x=_&&_.threshold||A&&A.threshold||-9007199254740991,y=_&&_.limit||A&&A.limit||9007199254740991,m=(_&&void 0!==_.allowTypo?_.allowTypo:!A||void 0===A.allowTypo||A.allowTypo)?L.algorithm:L.algorithmNoTypo,T=0,k=0;function b(){if(C)return g("canceled");var e=Date.now();if(_&&_.keys)for(var r=_.scoreFn||N,n=_.keys,o=n.length;0<=w;--w){for(var t=B[w],i=new Array(o),a=o-1;0<=a;--a)(u=S(t,f=n[a]))?(D(u)||(u=L.getPrepared(u)),i[a]=m(I,u,v)):i[a]=null;i.obj=t;var l=r(i);if(null!==l&&!(lh.peek().score&&h.replaceTop(i)),w%1e3==0&&10<=Date.now()-e))return void(P?setImmediate(b):setTimeout(b))}else if(_&&_.key){for(var f=_.key;0<=w;--w)if((u=S(t=B[w],f))&&(D(u)||(u=L.getPrepared(u)),null!==(s=m(I,u,v))&&!(s.scoreh.peek().score&&h.replaceTop(s)),w%1e3==0&&10<=Date.now()-e)))return void(P?setImmediate(b):setTimeout(b))}else for(;0<=w;--w){var u,s;if((u=B[w])&&(D(u)||(u=L.getPrepared(u)),null!==(s=m(I,u,v))&&!(s.scoreh.peek().score&&h.replaceTop(s)),w%1e3==0&&10<=Date.now()-e)))return void(P?setImmediate(b):setTimeout(b))}if(0===T)return c(j);for(var p=new Array(T),d=T-1;0<=d;--d)p[d]=h.poll();p.total=T+k,c(p)}P?setImmediate(b):b()});return e.cancel=function(){C=!0},e},highlight:function(e,r,n){if(null===e)return null;void 0===r&&(r=""),void 0===n&&(n="");for(var o="",t=0,i=!1,a=e.target,l=a.length,f=e.indexes,u=0;u - - - {{ i18n "showcase-overview" }} - - {{ range (.Site.GetPage "section" .Type).Pages }} - {{ $active := false }} - {{ $active = or $active (eq .Name $current.Title) }} - {{ $active = or $active (eq (lower .Permalink) (lower $current.Title)) }} - {{ $active = or $active (eq (lower .Permalink) (lower $current.Type)) }} - - {{ i18n (lower .Title) | default .Title }} - - {{ end }} +{{ $current := . }} + \ No newline at end of file diff --git a/layouts/partials/script/pub-list-script.html b/layouts/partials/script/pub-list-script.html index b3e64c3..9ef6f81 100644 --- a/layouts/partials/script/pub-list-script.html +++ b/layouts/partials/script/pub-list-script.html @@ -6,8 +6,6 @@