From dda0a0eab19457598b71f2b2b2f978b09d3f95c7 Mon Sep 17 00:00:00 2001 From: Alex Shpak Date: Mon, 15 Jul 2019 18:25:21 +0200 Subject: Start work on search feature with lunr --- README.md | 11 +++--- assets/book.scss | 18 ++++++++++ assets/search.js | 41 ++++++++++++++++++++++ exampleSite/config.toml | 12 ++++--- exampleSite/config.yaml | 8 ++--- ...rch.js_db9e329433ffca0798ed12c88043b3b3.content | 6 ++++ ...search.js_db9e329433ffca0798ed12c88043b3b3.json | 1 + ...k.scss_48b060fe05b0a273d182ef83c0605941.content | 2 +- ...book.scss_48b060fe05b0a273d182ef83c0605941.json | 2 +- layouts/404.html | 1 - layouts/docs/baseof.html | 1 - layouts/home.html | 1 - layouts/home.json | 10 ++++++ layouts/partials/docs/brand.html | 2 +- layouts/partials/docs/html-head.html | 9 +++-- layouts/partials/docs/menu-bundle.html | 15 ++++++++ layouts/partials/docs/menu-filetree.html | 4 +-- layouts/partials/docs/menu.html | 14 ++++++-- layouts/partials/docs/mobile-header.html | 4 +-- layouts/partials/docs/search.html | 2 ++ layouts/partials/docs/shared.html | 40 --------------------- layouts/partials/docs/title.html | 9 +++++ layouts/posts/baseof.html | 1 - static/lunr.min.js | 6 ++++ static/svg/search.svg | 1 + theme.toml | 2 +- 26 files changed, 148 insertions(+), 75 deletions(-) create mode 100644 assets/search.js create mode 100644 exampleSite/resources/_gen/assets/js/search.js_db9e329433ffca0798ed12c88043b3b3.content create mode 100644 exampleSite/resources/_gen/assets/js/search.js_db9e329433ffca0798ed12c88043b3b3.json create mode 100644 layouts/home.json create mode 100644 layouts/partials/docs/search.html delete mode 100644 layouts/partials/docs/shared.html create mode 100644 layouts/partials/docs/title.html create mode 100644 static/lunr.min.js create mode 100644 static/svg/search.svg diff --git a/README.md b/README.md index 93e6702..26ea2b5 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Hugo Book Theme [![Build Status](https://travis-ci.org/alex-shpak/hugo-book.svg?branch=master)](https://travis-ci.org/alex-shpak/hugo-book) -[![Hugo](https://img.shields.io/badge/hugo-0.48-blue.svg)](https://gohugo.io) +[![Hugo](https://img.shields.io/badge/hugo-0.55-blue.svg)](https://gohugo.io) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) ### [Hugo](https://gohugo.io) documentation theme as simple as plain book @@ -26,7 +26,7 @@ ## Requirements -- Hugo 0.48 or higher +- Hugo 0.55 or higher - Hugo extended version, read more [here](https://gohugo.io/news/0.48-relnotes/) ## Installation @@ -139,10 +139,6 @@ BookSection = 'docs' # (Optional) This value is duplicate of $link-color for making active link highlight in menu bundle mode # BookMenuBundleActiveLinkColor = '\#004ed0' -# (Optional, default false) Include JS scripts in pages. Disabled by default. -# - Keep side menu on same scroll position during navigation -BookEnableJS = true - # Set source repository location. # Used for 'Last Modified' and 'Edit this page' links. BookRepo = 'https://github.com/alex-shpak/hugo-book' @@ -156,6 +152,9 @@ BookEditPath = 'edit/master/exampleSite/content' # - In git information # - In blog posts BookDateFormat = 'Jan 2, 2006' + +# (Optional, default true) Enables or disables search function with lunr.js +BookSearch = true ``` ### Page Configuration diff --git a/assets/book.scss b/assets/book.scss index 9edc86a..8a94551 100644 --- a/assets/book.scss +++ b/assets/book.scss @@ -137,6 +137,23 @@ ul.pagination { display: none; } +.book-search { + border: 0; + border-bottom: $padding-1 solid $gray-200; + outline: none; + // padding: $padding-4 $padding-8 $padding-4 $padding-16+$padding-4; + padding: $padding-4 $padding-8 $padding-4 0; + margin-bottom: $padding-4; + width: 100%; + + // background: url("svg/search.svg") left center no-repeat; + // background-size: $padding-16; + + &:focus { + border-bottom-color: $body-font-color; + } +} + .book-toc { flex: 0 0 $toc-width; font-size: $font-size-12; @@ -211,6 +228,7 @@ aside nav, @media screen and (max-width: $sm-breakpoint) { .book-menu { margin-left: -$menu-width; + font-size: $font-size-base; } .book-header { diff --git a/assets/search.js b/assets/search.js new file mode 100644 index 0000000..84e522a --- /dev/null +++ b/assets/search.js @@ -0,0 +1,41 @@ +addEventListener("load", function() { + let input = document.querySelector("#book-search"); + let results = document.querySelector("#book-search-results"); + + Promise.all([ + loadScript("{{ "lunr.min.js" | relURL }}"), + loadScript("{{ "index.json" | relURL }}") + ]).then(enableLunr); + + function enableLunr() { + results.idx = lunr(function() { + this.ref('href') + this.field('title') + this.field('content') + + window.lunrData.forEach(function (page) { + this.add(page) + }, this) + }); + input.addEventListener("keyup", search); + } + + function search() { + if (input.value) { + var hits = results.idx.search(`${input.value}*`); + results.innerHTML = JSON.stringify(hits); + } else { + results.innerHTML = ''; + } + } + + function loadScript(src) { + return new Promise(function(resolve, reject) { + let script = document.createElement('script'); + script.src = src; + script.onload = () => resolve(script); + + document.head.append(script); + }); + } +}); diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 63e670b..edf5772 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -14,6 +14,9 @@ enableGitInfo = true # pygmentsStyle = 'monokailight' pygmentsCodeFences = true +[outputs] + home = ["HTML", "JSON"] + [params] # (Optional, default 6) Set how many table of contents levels to be showed on page. # Use false to hide ToC, note that 0 will default to 6 (https://gohugo.io/functions/default/) @@ -28,13 +31,9 @@ pygmentsCodeFences = true # You can also set value to '*' to render all sections to menu BookSection = 'docs' - # This value is duplicate of $link-color for making active link highlight in menu bundle mode + # (Optional) This value is duplicate of $link-color for making active link highlight in menu bundle mode # BookMenuBundleActiveLinkColor = '\#004ed0' - # Include JS scripts in pages. Disabled by default. - # - Keep side menu on same scroll position during navigation - BookEnableJS = true - # Set source repository location. # Used for 'Last Modified' and 'Edit this page' links. BookRepo = 'https://github.com/alex-shpak/hugo-book' @@ -48,3 +47,6 @@ pygmentsCodeFences = true # - In git information # - In blog posts BookDateFormat = 'Jan 2, 2006' + + # (Optional, default true) Enables or disables search function with lunr.js + BookSearch = true diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index 6d12d78..a11b186 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -28,12 +28,8 @@ params: # You can also set value to '*' to render all sections to menu BookSection: docs - # This value is duplicate of $link-color for making active link highlight in menu bundle mode - # BookMenuBundleActiveLinkColor: \#004ed0 - - # Include JS scripts in pages. Disabled by default. - # - Keep side menu on same scroll position during navigation - BookEnableJS: true + # (Optional) This value is duplicate of $link-color for making active link highlight in menu bundle mode + # BookMenuBundleActiveLinkColor: "\#004ed0" # Set source repository location. # Used for 'Last Modified' and 'Edit this page' links. diff --git a/exampleSite/resources/_gen/assets/js/search.js_db9e329433ffca0798ed12c88043b3b3.content b/exampleSite/resources/_gen/assets/js/search.js_db9e329433ffca0798ed12c88043b3b3.content new file mode 100644 index 0000000..9c34794 --- /dev/null +++ b/exampleSite/resources/_gen/assets/js/search.js_db9e329433ffca0798ed12c88043b3b3.content @@ -0,0 +1,6 @@ +addEventListener("load",function(){let input=document.querySelector("#book-search");let results=document.querySelector("#book-search-results");Promise.all([loadScript("/example/lunr.min.js"),loadScript("/example/index.json")]).then(enableLunr);function enableLunr(){results.idx=lunr(function(){this.ref('href') +this.field('title') +this.field('content') +window.lunrData.forEach(function(page){this.add(page)},this)});input.addEventListener("keyup",search);} +function search(){if(input.value){var hits=results.idx.search(`${input.value}*`);results.innerHTML=JSON.stringify(hits);}else{results.innerHTML='';}} +function loadScript(src){return new Promise(function(resolve,reject){let script=document.createElement('script');script.src=src;script.onload=()=>resolve(script);document.head.append(script);});}}); \ No newline at end of file diff --git a/exampleSite/resources/_gen/assets/js/search.js_db9e329433ffca0798ed12c88043b3b3.json b/exampleSite/resources/_gen/assets/js/search.js_db9e329433ffca0798ed12c88043b3b3.json new file mode 100644 index 0000000..0c68ef7 --- /dev/null +++ b/exampleSite/resources/_gen/assets/js/search.js_db9e329433ffca0798ed12c88043b3b3.json @@ -0,0 +1 @@ +{"Target":"search.min.f37565c4baa28364f7b8e1e53c35bdb0ab92f2215165bd3f083f3f4f1ae78c71.js","MediaType":"application/javascript","Data":{"Integrity":"sha256-83VlxLqig2T3uOHlPDW9sKuS8iFRZb0/CD8/TxrnjHE="}} \ No newline at end of file diff --git a/exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.content b/exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.content index c18add6..094e3ef 100644 --- a/exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.content +++ b/exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.content @@ -1 +1 @@ -/*!normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css*/html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}.flex{display:flex}.flex-auto{flex:1 1 auto}.flex-even{flex:1 1}.flex-wrap{flex-wrap:wrap}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.align-center{align-items:center}.mx-auto{margin:0 auto}.text-center{text-align:center}.markdown{line-height:1.6}.markdown h1,.markdown h2,.markdown h3,.markdown h4,.markdown h5{font-weight:400;line-height:1;margin-top:1.5em;margin-bottom:1rem}.markdown>:first-child{margin-top:0}.markdown b,.markdown optgroup,.markdown strong{font-weight:bolder}.markdown a{text-decoration:none}.markdown a:hover{text-decoration:underline}.markdown img{max-width:100%}.markdown code{padding:0 .25rem;background:#e9ecef;border-radius:.15rem;font-size:.875em}.markdown pre{padding:1rem;background:#f8f9fa;border-radius:.15rem;overflow-x:auto}.markdown pre code{padding:0;background:0 0}.markdown blockquote{margin:1rem 0;padding:.25rem .75rem;border-left:.25rem solid #e9ecef;border-radius:.15rem}.markdown blockquote :first-child{margin-top:0}.markdown blockquote :last-child{margin-bottom:0}.markdown table{border-spacing:0;border-collapse:collapse;margin-top:1rem;margin-bottom:1rem}.markdown table tr th,.markdown table tr td{padding:.5rem 1rem;line-height:1;border:1px solid #e9ecef}.markdown table tr:nth-child(2n){background:#f8f9fa}.markdown hr{height:1px;border:none;background:#e9ecef}.markdown ul,.markdown ol{padding-left:2rem}.markdown dl dt{font-weight:bolder;margin-top:1rem}.markdown dl dd{margin-left:2rem}.markdown-inner>:first-child{margin-top:0}.markdown-inner>:last-child{margin-bottom:0}.book-expand{margin-top:1rem;margin-bottom:1rem;border:1px solid #e9ecef;border-radius:.15rem;overflow:hidden}.book-expand .book-expand-head{background:#f8f9fa;padding:.5rem 1rem;cursor:pointer}.book-expand .book-expand-content{display:none;padding:1rem}.book-expand input[type=checkbox]:checked+.book-expand-content{display:block}.book-tabs{margin-top:1rem;margin-bottom:1rem;border:1px solid #e9ecef;border-radius:.15rem;overflow:hidden;display:flex;flex-wrap:wrap}.book-tabs label{display:inline-block;padding:.5rem 1rem;border-bottom:1px transparent;cursor:pointer}.book-tabs .book-tabs-content{order:999;width:100%;border-top:1px solid #f8f9fa;padding:1rem;display:none}.book-tabs input[type=radio]:checked+label{border-bottom:1px solid #004ed0}.book-tabs input[type=radio]:checked+label+.book-tabs-content{display:block}.book-columns{margin-left:-1rem;margin-right:-1rem}.book-columns>div{margin:1rem 0;min-width:13.2rem;padding:0 1rem}a.book-btn{display:inline-block;color:#004ed0!important;text-decoration:none!important;border:1px solid #004ed0;border-radius:.15rem;padding:.25rem 1rem;margin-top:.5rem;margin-bottom:.5rem;cursor:pointer}html{font-size:16px;letter-spacing:.33px;scroll-behavior:smooth}html,body{min-width:20rem;overflow-x:hidden}body{color:#343a40;background:#fff;font-family:sans-serif;font-weight:400;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;box-sizing:border-box}body *{box-sizing:inherit}h1,h2,h3,h4,h5{font-weight:400}a{text-decoration:none;color:#004ed0}a:visited{color:#8440f1}img{vertical-align:baseline}aside nav ul{padding:0;margin:0;list-style:none}aside nav ul li{margin:1em 0}aside nav ul a{display:block}aside nav ul a:hover{opacity:.5}aside nav ul ul{padding-left:1rem}ul.pagination{display:flex;justify-content:center}ul.pagination .page-item a{padding:1rem}.container{max-width:80rem;margin:0 auto}.book-brand{margin-top:0}.book-menu{flex:0 0 16rem;font-size:.875rem}.book-menu nav{width:16rem;padding:1rem;position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto}.book-menu a{color:#343a40}.book-menu a.active{color:#004ed0}.book-section-flat{margin-bottom:2rem}.book-section-flat:not(:first-child){margin-top:2rem}.book-section-flat>a,.book-section-flat>span{font-weight:bolder}.book-section-flat>ul{padding-left:0}.book-page{min-width:20rem;flex-grow:1;padding:1rem}.book-header{margin-bottom:1rem;display:none}.book-toc{flex:0 0 16rem;font-size:.75rem}.book-toc nav{width:16rem;padding:1rem;position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto}.book-toc img{height:1em}.book-toc nav>ul>li:first-child{margin-top:0}.book-toc.level-1 ul ul,.book-toc.level-2 ul ul ul,.book-toc.level-3 ul ul ul ul,.book-toc.level-4 ul ul ul ul ul,.book-toc.level-5 ul ul ul ul ul ul,.book-toc.level-6 ul ul ul ul ul ul ul{display:none}.book-footer{display:flex;padding-top:1rem;font-size:.875rem}.book-footer img{height:1em}.book-posts{min-width:20rem;max-width:36rem;flex-grow:1;padding:1rem}.book-posts article{padding-bottom:1rem}.book-home{padding:1rem}aside nav,.book-page,.book-posts,.markdown{transition:.2s ease-in-out;transition-property:transform,margin-left,opacity;will-change:transform,margin-left}@media screen and (max-width:57rem){.book-toc{display:none}}@media screen and (max-width:36rem){.book-menu{margin-left:-16rem}.book-header{display:flex}#menu-control:checked+main .book-menu nav,#menu-control:checked+main .book-page,#menu-control:checked+main .book-posts{transform:translateX(16rem)}#menu-control:checked+main .book-header label{transform:rotate(90deg)}#menu-control:checked+main .markdown{opacity:.25}}@media screen and (min-width:80rem){.book-page,.book-posts,.book-menu nav,.book-toc nav{padding:2rem 1rem}}@font-face{font-family:roboto;font-style:italic;font-weight:300;src:local("Roboto Light Italic"),local(Roboto-LightItalic),url(fonts/roboto-v19-latin-300italic.woff2) format("woff2"),url(fonts/roboto-v19-latin-300italic.woff) format("woff")}@font-face{font-family:roboto;font-style:normal;font-weight:400;src:local(Roboto),local(Roboto-Regular),url(fonts/roboto-v19-latin-regular.woff2) format("woff2"),url(fonts/roboto-v19-latin-regular.woff) format("woff")}@font-face{font-family:roboto;font-style:normal;font-weight:700;src:local("Roboto Bold"),local(Roboto-Bold),url(fonts/roboto-v19-latin-700.woff2) format("woff2"),url(fonts/roboto-v19-latin-700.woff) format("woff")}@font-face{font-family:roboto mono;font-style:normal;font-weight:400;src:local("Roboto Mono"),local(RobotoMono-Regular),url(fonts/roboto-mono-v6-latin-regular.woff2) format("woff2"),url(fonts/roboto-mono-v6-latin-regular.woff) format("woff")}body{font-family:roboto,sans-serif}code{font-family:roboto mono,monospace} \ No newline at end of file +/*!normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css*/html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}.flex{display:flex}.flex-auto{flex:1 1 auto}.flex-even{flex:1 1}.flex-wrap{flex-wrap:wrap}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.align-center{align-items:center}.mx-auto{margin:0 auto}.text-center{text-align:center}.markdown{line-height:1.6}.markdown h1,.markdown h2,.markdown h3,.markdown h4,.markdown h5{font-weight:400;line-height:1;margin-top:1.5em;margin-bottom:1rem}.markdown>:first-child{margin-top:0}.markdown b,.markdown optgroup,.markdown strong{font-weight:bolder}.markdown a{text-decoration:none}.markdown a:hover{text-decoration:underline}.markdown img{max-width:100%}.markdown code{padding:0 .25rem;background:#e9ecef;border-radius:.15rem;font-size:.875em}.markdown pre{padding:1rem;background:#f8f9fa;border-radius:.15rem;overflow-x:auto}.markdown pre code{padding:0;background:0 0}.markdown blockquote{margin:1rem 0;padding:.25rem .75rem;border-left:.25rem solid #e9ecef;border-radius:.15rem}.markdown blockquote :first-child{margin-top:0}.markdown blockquote :last-child{margin-bottom:0}.markdown table{border-spacing:0;border-collapse:collapse;margin-top:1rem;margin-bottom:1rem}.markdown table tr th,.markdown table tr td{padding:.5rem 1rem;line-height:1;border:1px solid #e9ecef}.markdown table tr:nth-child(2n){background:#f8f9fa}.markdown hr{height:1px;border:none;background:#e9ecef}.markdown ul,.markdown ol{padding-left:2rem}.markdown dl dt{font-weight:bolder;margin-top:1rem}.markdown dl dd{margin-left:2rem}.markdown-inner>:first-child{margin-top:0}.markdown-inner>:last-child{margin-bottom:0}.book-expand{margin-top:1rem;margin-bottom:1rem;border:1px solid #e9ecef;border-radius:.15rem;overflow:hidden}.book-expand .book-expand-head{background:#f8f9fa;padding:.5rem 1rem;cursor:pointer}.book-expand .book-expand-content{display:none;padding:1rem}.book-expand input[type=checkbox]:checked+.book-expand-content{display:block}.book-tabs{margin-top:1rem;margin-bottom:1rem;border:1px solid #e9ecef;border-radius:.15rem;overflow:hidden;display:flex;flex-wrap:wrap}.book-tabs label{display:inline-block;padding:.5rem 1rem;border-bottom:1px transparent;cursor:pointer}.book-tabs .book-tabs-content{order:999;width:100%;border-top:1px solid #f8f9fa;padding:1rem;display:none}.book-tabs input[type=radio]:checked+label{border-bottom:1px solid #004ed0}.book-tabs input[type=radio]:checked+label+.book-tabs-content{display:block}.book-columns{margin-left:-1rem;margin-right:-1rem}.book-columns>div{margin:1rem 0;min-width:13.2rem;padding:0 1rem}a.book-btn{display:inline-block;color:#004ed0!important;text-decoration:none!important;border:1px solid #004ed0;border-radius:.15rem;padding:.25rem 1rem;margin-top:.5rem;margin-bottom:.5rem;cursor:pointer}html{font-size:16px;letter-spacing:.33px;scroll-behavior:smooth}html,body{min-width:20rem;overflow-x:hidden}body{color:#343a40;background:#fff;font-family:sans-serif;font-weight:400;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;box-sizing:border-box}body *{box-sizing:inherit}h1,h2,h3,h4,h5{font-weight:400}a{text-decoration:none;color:#004ed0}a:visited{color:#8440f1}img{vertical-align:baseline}aside nav ul{padding:0;margin:0;list-style:none}aside nav ul li{margin:1em 0}aside nav ul a{display:block}aside nav ul a:hover{opacity:.5}aside nav ul ul{padding-left:1rem}ul.pagination{display:flex;justify-content:center}ul.pagination .page-item a{padding:1rem}.container{max-width:80rem;margin:0 auto}.book-brand{margin-top:0}.book-menu{flex:0 0 16rem;font-size:.875rem}.book-menu nav{width:16rem;padding:1rem;position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto}.book-menu a{color:#343a40}.book-menu a.active{color:#004ed0}.book-section-flat{margin-bottom:2rem}.book-section-flat:not(:first-child){margin-top:2rem}.book-section-flat>a,.book-section-flat>span{font-weight:bolder}.book-section-flat>ul{padding-left:0}.book-page{min-width:20rem;flex-grow:1;padding:1rem}.book-header{margin-bottom:1rem;display:none}.book-search{border:0;border-bottom:1px solid #e9ecef;outline:none;padding:.25rem .5rem .25rem 0;margin-bottom:.25rem;width:100%}.book-search:focus{border-bottom-color:#343a40}.book-toc{flex:0 0 16rem;font-size:.75rem}.book-toc nav{width:16rem;padding:1rem;position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto}.book-toc img{height:1em}.book-toc nav>ul>li:first-child{margin-top:0}.book-toc.level-1 ul ul,.book-toc.level-2 ul ul ul,.book-toc.level-3 ul ul ul ul,.book-toc.level-4 ul ul ul ul ul,.book-toc.level-5 ul ul ul ul ul ul,.book-toc.level-6 ul ul ul ul ul ul ul{display:none}.book-footer{display:flex;padding-top:1rem;font-size:.875rem}.book-footer img{height:1em}.book-posts{min-width:20rem;max-width:36rem;flex-grow:1;padding:1rem}.book-posts article{padding-bottom:1rem}.book-home{padding:1rem}aside nav,.book-page,.book-posts,.markdown{transition:.2s ease-in-out;transition-property:transform,margin-left,opacity;will-change:transform,margin-left}@media screen and (max-width:57rem){.book-toc{display:none}}@media screen and (max-width:36rem){.book-menu{margin-left:-16rem;font-size:16px}.book-header{display:flex}#menu-control:checked+main .book-menu nav,#menu-control:checked+main .book-page,#menu-control:checked+main .book-posts{transform:translateX(16rem)}#menu-control:checked+main .book-header label{transform:rotate(90deg)}#menu-control:checked+main .markdown{opacity:.25}}@media screen and (min-width:80rem){.book-page,.book-posts,.book-menu nav,.book-toc nav{padding:2rem 1rem}}@font-face{font-family:roboto;font-style:italic;font-weight:300;src:local("Roboto Light Italic"),local(Roboto-LightItalic),url(fonts/roboto-v19-latin-300italic.woff2) format("woff2"),url(fonts/roboto-v19-latin-300italic.woff) format("woff")}@font-face{font-family:roboto;font-style:normal;font-weight:400;src:local(Roboto),local(Roboto-Regular),url(fonts/roboto-v19-latin-regular.woff2) format("woff2"),url(fonts/roboto-v19-latin-regular.woff) format("woff")}@font-face{font-family:roboto;font-style:normal;font-weight:700;src:local("Roboto Bold"),local(Roboto-Bold),url(fonts/roboto-v19-latin-700.woff2) format("woff2"),url(fonts/roboto-v19-latin-700.woff) format("woff")}@font-face{font-family:roboto mono;font-style:normal;font-weight:400;src:local("Roboto Mono"),local(RobotoMono-Regular),url(fonts/roboto-mono-v6-latin-regular.woff2) format("woff2"),url(fonts/roboto-mono-v6-latin-regular.woff) format("woff")}body{font-family:roboto,sans-serif}code{font-family:roboto mono,monospace} \ No newline at end of file diff --git a/exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.json b/exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.json index 70e58ab..6b4d80b 100644 --- a/exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.json +++ b/exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.json @@ -1 +1 @@ -{"Target":"book.min.f4161f5e2de53a2e927f51df1611323a2a12cccb2681f23cb6fc3517852e8643.css","MediaType":"text/css","Data":{"Integrity":"sha256-9BYfXi3lOi6Sf1HfFhEyOioSzMsmgfI8tvw1F4UuhkM="}} \ No newline at end of file +{"Target":"book.min.60422b170f7beee5a981f3288523ee2bf275a0b48eba3a8983a3736189b9027f.css","MediaType":"text/css","Data":{"Integrity":"sha256-YEIrFw977uWpgfMohSPuK/J1oLSOujqJg6NzYYm5An8="}} \ No newline at end of file diff --git a/layouts/404.html b/layouts/404.html index b6b1d0e..cd7bf3a 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -1,5 +1,4 @@ -{{- partial "docs/shared" -}} diff --git a/layouts/docs/baseof.html b/layouts/docs/baseof.html index 29b067f..1592860 100644 --- a/layouts/docs/baseof.html +++ b/layouts/docs/baseof.html @@ -1,5 +1,4 @@ -{{- partial "docs/shared" -}} diff --git a/layouts/home.html b/layouts/home.html index 69054ca..37f9eeb 100644 --- a/layouts/home.html +++ b/layouts/home.html @@ -1,5 +1,4 @@ -{{- partial "docs/shared" -}} diff --git a/layouts/home.json b/layouts/home.json new file mode 100644 index 0000000..f090548 --- /dev/null +++ b/layouts/home.json @@ -0,0 +1,10 @@ +window.lunrData = [ +{{ range $index, $page := .Site.Pages }} + {{- if and $index (gt $index 0) -}},{{- end }} + { + "href": "{{ $page.RelPermalink }}", + "title": "{{ htmlEscape $page.Title }}", + "content": {{ $page.Plain | jsonify }} + } +{{- end -}} +] diff --git a/layouts/partials/docs/brand.html b/layouts/partials/docs/brand.html index 5a2c9cb..7d7b721 100644 --- a/layouts/partials/docs/brand.html +++ b/layouts/partials/docs/brand.html @@ -1,3 +1,3 @@

{{ .Site.Title }} -

\ No newline at end of file + diff --git a/layouts/partials/docs/html-head.html b/layouts/partials/docs/html-head.html index 5fbc549..805c2b5 100644 --- a/layouts/partials/docs/html-head.html +++ b/layouts/partials/docs/html-head.html @@ -1,11 +1,14 @@ -{{- template "title" . }} | {{ .Site.Title -}} +{{ partial "docs/title" . }} | {{ .Site.Title -}} - -{{ $styles := resources.Get "book.scss" | resources.ToCSS | resources.Minify | resources.Fingerprint }} + +{{- $styles := resources.Get "book.scss" | resources.ToCSS | resources.Minify | resources.Fingerprint }} +{{- $search := resources.Get "search.js" | resources.ExecuteAsTemplate "search.js" . | resources.Minify | resources.Fingerprint }} + + diff --git a/layouts/partials/docs/menu-bundle.html b/layouts/partials/docs/menu-bundle.html index bfc1650..2aedb54 100644 --- a/layouts/partials/docs/menu-bundle.html +++ b/layouts/partials/docs/menu-bundle.html @@ -2,3 +2,18 @@ {{ with .Site.GetPage .Site.Params.BookMenuBundle }} {{- .Content -}} {{ end }} + +{{ define "hrefhack" }} + {{ $attrEq := "$=" }} + {{ $attrVal := .RelPermalink }} + {{ if eq .RelPermalink "/" }} + {{ $attrEq = "=" }} + {{ $attrVal = .Permalink }} + {{ end }} + + +{{ end }} diff --git a/layouts/partials/docs/menu-filetree.html b/layouts/partials/docs/menu-filetree.html index 9ed63ea..abc6fd9 100644 --- a/layouts/partials/docs/menu-filetree.html +++ b/layouts/partials/docs/menu-filetree.html @@ -27,7 +27,7 @@ {{ if .Content }} {{ template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) }} {{ else }} - {{ template "title" . }} + {{ partial "docs/title" . }} {{ end }} {{ template "book-section-children" (dict "Section" . "CurrentPage" $.CurrentPage) }} @@ -53,7 +53,7 @@ {{ define "book-page-link" }} {{ with .Page }} - {{ template "title" . }} + {{ partial "docs/title" . }} {{ end }} {{ end }} diff --git a/layouts/partials/docs/menu.html b/layouts/partials/docs/menu.html index d280713..6a72ac9 100644 --- a/layouts/partials/docs/menu.html +++ b/layouts/partials/docs/menu.html @@ -1,5 +1,6 @@ -{{ if .Site.Params.BookEnableJS }} - {{ template "jsmenu" . }} -{{ end }} + + diff --git a/layouts/partials/docs/mobile-header.html b/layouts/partials/docs/mobile-header.html index b8fa2a9..720b83d 100644 --- a/layouts/partials/docs/mobile-header.html +++ b/layouts/partials/docs/mobile-header.html @@ -1,6 +1,6 @@ -
+
- {{- template "title" . }} + {{ partial "docs/title" . }}
diff --git a/layouts/partials/docs/search.html b/layouts/partials/docs/search.html new file mode 100644 index 0000000..d4b0e65 --- /dev/null +++ b/layouts/partials/docs/search.html @@ -0,0 +1,2 @@ + + diff --git a/layouts/partials/docs/shared.html b/layouts/partials/docs/shared.html deleted file mode 100644 index 2545dea..0000000 --- a/layouts/partials/docs/shared.html +++ /dev/null @@ -1,40 +0,0 @@ -{{/*These templates contains some more complex logic and shared between partials*/}} -{{ define "title" }} - {{ if and .IsSection .File }} - {{ $sections := split (trim .File.Dir "/") "/" }} - {{ $title := index ($sections | last 1) 0 | humanize | title }} - {{ default $title .Title }} - {{ else if and .IsPage .File }} - {{ $title := .File.BaseFileName | humanize | title }} - {{ default $title .Title }} - {{ else }} - {{ .Title }} - {{ end }} -{{ end }} - -{{ define "hrefhack" }} - {{ $attrEq := "$=" }} - {{ $attrVal := .RelPermalink }} - {{ if eq .RelPermalink "/" }} - {{ $attrEq = "=" }} - {{ $attrVal = .Permalink }} - {{ end }} - - -{{ end }} - -{{ define "jsmenu" }} - -{{ end }} diff --git a/layouts/partials/docs/title.html b/layouts/partials/docs/title.html new file mode 100644 index 0000000..91d5f81 --- /dev/null +++ b/layouts/partials/docs/title.html @@ -0,0 +1,9 @@ +{{ $title := .Title }} +{{ if and .IsSection .File }} + {{ $sections := split (trim .File.Dir "/") "/" }} + {{ $title = index ($sections | last 1) 0 | humanize | title }} +{{ else if and .IsPage .File }} + {{ $title = .File.BaseFileName | humanize | title }} +{{ end }} + +{{ return $title }} diff --git a/layouts/posts/baseof.html b/layouts/posts/baseof.html index 6b32b2e..ba4b91c 100644 --- a/layouts/posts/baseof.html +++ b/layouts/posts/baseof.html @@ -1,5 +1,4 @@ -{{- partial "docs/shared" -}} diff --git a/static/lunr.min.js b/static/lunr.min.js new file mode 100644 index 0000000..34b279d --- /dev/null +++ b/static/lunr.min.js @@ -0,0 +1,6 @@ +/** + * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 2.3.6 + * Copyright (C) 2019 Oliver Nightingale + * @license MIT + */ +!function(){var e=function(t){var r=new e.Builder;return r.pipeline.add(e.trimmer,e.stopWordFilter,e.stemmer),r.searchPipeline.add(e.stemmer),t.call(r,r),r.build()};e.version="2.3.6",e.utils={},e.utils.warn=function(e){return function(t){e.console&&console.warn&&console.warn(t)}}(this),e.utils.asString=function(e){return void 0===e||null===e?"":e.toString()},e.utils.clone=function(e){if(null===e||void 0===e)return e;for(var t=Object.create(null),r=Object.keys(e),i=0;i0){var c=e.utils.clone(r)||{};c.position=[a,l],c.index=s.length,s.push(new e.Token(i.slice(a,o),c))}a=o+1}}return s},e.tokenizer.separator=/[\s\-]+/,e.Pipeline=function(){this._stack=[]},e.Pipeline.registeredFunctions=Object.create(null),e.Pipeline.registerFunction=function(t,r){r in this.registeredFunctions&&e.utils.warn("Overwriting existing registered function: "+r),t.label=r,e.Pipeline.registeredFunctions[t.label]=t},e.Pipeline.warnIfFunctionNotRegistered=function(t){var r=t.label&&t.label in this.registeredFunctions;r||e.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",t)},e.Pipeline.load=function(t){var r=new e.Pipeline;return t.forEach(function(t){var i=e.Pipeline.registeredFunctions[t];if(!i)throw new Error("Cannot load unregistered function: "+t);r.add(i)}),r},e.Pipeline.prototype.add=function(){var t=Array.prototype.slice.call(arguments);t.forEach(function(t){e.Pipeline.warnIfFunctionNotRegistered(t),this._stack.push(t)},this)},e.Pipeline.prototype.after=function(t,r){e.Pipeline.warnIfFunctionNotRegistered(r);var i=this._stack.indexOf(t);if(i==-1)throw new Error("Cannot find existingFn");i+=1,this._stack.splice(i,0,r)},e.Pipeline.prototype.before=function(t,r){e.Pipeline.warnIfFunctionNotRegistered(r);var i=this._stack.indexOf(t);if(i==-1)throw new Error("Cannot find existingFn");this._stack.splice(i,0,r)},e.Pipeline.prototype.remove=function(e){var t=this._stack.indexOf(e);t!=-1&&this._stack.splice(t,1)},e.Pipeline.prototype.run=function(e){for(var t=this._stack.length,r=0;r1&&(se&&(r=n),s!=e);)i=r-t,n=t+Math.floor(i/2),s=this.elements[2*n];return s==e?2*n:s>e?2*n:sa?l+=2:o==a&&(t+=r[u+1]*i[l+1],u+=2,l+=2);return t},e.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},e.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),t=1,r=0;t0){var o,a=s.str.charAt(0);a in s.node.edges?o=s.node.edges[a]:(o=new e.TokenSet,s.node.edges[a]=o),1==s.str.length&&(o["final"]=!0),n.push({node:o,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(0!=s.editsRemaining){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new e.TokenSet;s.node.edges["*"]=u}if(0==s.str.length&&(u["final"]=!0),n.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&n.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),1==s.str.length&&(s.node["final"]=!0),s.str.length>=1){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new e.TokenSet;s.node.edges["*"]=l}1==s.str.length&&(l["final"]=!0),n.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var c,h=s.str.charAt(0),d=s.str.charAt(1);d in s.node.edges?c=s.node.edges[d]:(c=new e.TokenSet,s.node.edges[d]=c),1==s.str.length&&(c["final"]=!0),n.push({node:c,editsRemaining:s.editsRemaining-1,str:h+s.str.slice(2)})}}}return i},e.TokenSet.fromString=function(t){for(var r=new e.TokenSet,i=r,n=0,s=t.length;n=e;t--){var r=this.uncheckedNodes[t],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r["char"]]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}},e.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},e.Index.prototype.search=function(t){return this.query(function(r){var i=new e.QueryParser(t,r);i.parse()})},e.Index.prototype.query=function(t){for(var r=new e.Query(this.fields),i=Object.create(null),n=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),u=0;u1?this._b=1:this._b=e},e.Builder.prototype.k1=function(e){this._k1=e},e.Builder.prototype.add=function(t,r){var i=t[this._ref],n=Object.keys(this._fields);this._documents[i]=r||{},this.documentCount+=1;for(var s=0;s=this.length)return e.QueryLexer.EOS;var t=this.str.charAt(this.pos);return this.pos+=1,t},e.QueryLexer.prototype.width=function(){return this.pos-this.start},e.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},e.QueryLexer.prototype.backup=function(){this.pos-=1},e.QueryLexer.prototype.acceptDigitRun=function(){var t,r;do t=this.next(),r=t.charCodeAt(0);while(r>47&&r<58);t!=e.QueryLexer.EOS&&this.backup()},e.QueryLexer.prototype.more=function(){return this.pos1&&(t.backup(),t.emit(e.QueryLexer.TERM)),t.ignore(),t.more())return e.QueryLexer.lexText},e.QueryLexer.lexEditDistance=function(t){return t.ignore(),t.acceptDigitRun(),t.emit(e.QueryLexer.EDIT_DISTANCE),e.QueryLexer.lexText},e.QueryLexer.lexBoost=function(t){return t.ignore(),t.acceptDigitRun(),t.emit(e.QueryLexer.BOOST),e.QueryLexer.lexText},e.QueryLexer.lexEOS=function(t){t.width()>0&&t.emit(e.QueryLexer.TERM)},e.QueryLexer.termSeparator=e.tokenizer.separator,e.QueryLexer.lexText=function(t){for(;;){var r=t.next();if(r==e.QueryLexer.EOS)return e.QueryLexer.lexEOS;if(92!=r.charCodeAt(0)){if(":"==r)return e.QueryLexer.lexField;if("~"==r)return t.backup(),t.width()>0&&t.emit(e.QueryLexer.TERM),e.QueryLexer.lexEditDistance;if("^"==r)return t.backup(),t.width()>0&&t.emit(e.QueryLexer.TERM),e.QueryLexer.lexBoost;if("+"==r&&1===t.width())return t.emit(e.QueryLexer.PRESENCE),e.QueryLexer.lexText;if("-"==r&&1===t.width())return t.emit(e.QueryLexer.PRESENCE),e.QueryLexer.lexText;if(r.match(e.QueryLexer.termSeparator))return e.QueryLexer.lexTerm}else t.escapeCharacter()}},e.QueryParser=function(t,r){this.lexer=new e.QueryLexer(t),this.query=r,this.currentClause={},this.lexemeIdx=0},e.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var t=e.QueryParser.parseClause;t;)t=t(this);return this.query},e.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},e.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},e.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},e.QueryParser.parseClause=function(t){var r=t.peekLexeme();if(void 0!=r)switch(r.type){case e.QueryLexer.PRESENCE:return e.QueryParser.parsePresence;case e.QueryLexer.FIELD:return e.QueryParser.parseField;case e.QueryLexer.TERM:return e.QueryParser.parseTerm;default:var i="expected either a field or a term, found "+r.type;throw r.str.length>=1&&(i+=" with value '"+r.str+"'"),new e.QueryParseError(i,r.start,r.end)}},e.QueryParser.parsePresence=function(t){var r=t.consumeLexeme();if(void 0!=r){switch(r.str){case"-":t.currentClause.presence=e.Query.presence.PROHIBITED;break;case"+":t.currentClause.presence=e.Query.presence.REQUIRED;break;default:var i="unrecognised presence operator'"+r.str+"'";throw new e.QueryParseError(i,r.start,r.end)}var n=t.peekLexeme();if(void 0==n){var i="expecting term or field, found nothing";throw new e.QueryParseError(i,r.start,r.end)}switch(n.type){case e.QueryLexer.FIELD:return e.QueryParser.parseField;case e.QueryLexer.TERM:return e.QueryParser.parseTerm;default:var i="expecting term or field, found '"+n.type+"'";throw new e.QueryParseError(i,n.start,n.end)}}},e.QueryParser.parseField=function(t){var r=t.consumeLexeme();if(void 0!=r){if(t.query.allFields.indexOf(r.str)==-1){var i=t.query.allFields.map(function(e){return"'"+e+"'"}).join(", "),n="unrecognised field '"+r.str+"', possible fields: "+i;throw new e.QueryParseError(n,r.start,r.end)}t.currentClause.fields=[r.str];var s=t.peekLexeme();if(void 0==s){var n="expecting term, found nothing";throw new e.QueryParseError(n,r.start,r.end)}switch(s.type){case e.QueryLexer.TERM:return e.QueryParser.parseTerm;default:var n="expecting term, found '"+s.type+"'";throw new e.QueryParseError(n,s.start,s.end)}}},e.QueryParser.parseTerm=function(t){var r=t.consumeLexeme();if(void 0!=r){t.currentClause.term=r.str.toLowerCase(),r.str.indexOf("*")!=-1&&(t.currentClause.usePipeline=!1);var i=t.peekLexeme();if(void 0==i)return void t.nextClause();switch(i.type){case e.QueryLexer.TERM:return t.nextClause(),e.QueryParser.parseTerm;case e.QueryLexer.FIELD:return t.nextClause(),e.QueryParser.parseField;case e.QueryLexer.EDIT_DISTANCE:return e.QueryParser.parseEditDistance;case e.QueryLexer.BOOST:return e.QueryParser.parseBoost;case e.QueryLexer.PRESENCE:return t.nextClause(),e.QueryParser.parsePresence;default:var n="Unexpected lexeme type '"+i.type+"'";throw new e.QueryParseError(n,i.start,i.end)}}},e.QueryParser.parseEditDistance=function(t){var r=t.consumeLexeme();if(void 0!=r){var i=parseInt(r.str,10);if(isNaN(i)){var n="edit distance must be numeric";throw new e.QueryParseError(n,r.start,r.end)}t.currentClause.editDistance=i;var s=t.peekLexeme();if(void 0==s)return void t.nextClause();switch(s.type){case e.QueryLexer.TERM:return t.nextClause(),e.QueryParser.parseTerm;case e.QueryLexer.FIELD:return t.nextClause(),e.QueryParser.parseField;case e.QueryLexer.EDIT_DISTANCE:return e.QueryParser.parseEditDistance;case e.QueryLexer.BOOST:return e.QueryParser.parseBoost;case e.QueryLexer.PRESENCE:return t.nextClause(),e.QueryParser.parsePresence;default:var n="Unexpected lexeme type '"+s.type+"'";throw new e.QueryParseError(n,s.start,s.end)}}},e.QueryParser.parseBoost=function(t){var r=t.consumeLexeme();if(void 0!=r){var i=parseInt(r.str,10);if(isNaN(i)){var n="boost must be numeric";throw new e.QueryParseError(n,r.start,r.end)}t.currentClause.boost=i;var s=t.peekLexeme();if(void 0==s)return void t.nextClause();switch(s.type){case e.QueryLexer.TERM:return t.nextClause(),e.QueryParser.parseTerm;case e.QueryLexer.FIELD:return t.nextClause(),e.QueryParser.parseField;case e.QueryLexer.EDIT_DISTANCE:return e.QueryParser.parseEditDistance;case e.QueryLexer.BOOST:return e.QueryParser.parseBoost;case e.QueryLexer.PRESENCE:return t.nextClause(),e.QueryParser.parsePresence;default:var n="Unexpected lexeme type '"+s.type+"'";throw new e.QueryParseError(n,s.start,s.end)}}},function(e,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():e.lunr=t()}(this,function(){return e})}(); diff --git a/static/svg/search.svg b/static/svg/search.svg new file mode 100644 index 0000000..19c9df7 --- /dev/null +++ b/static/svg/search.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/theme.toml b/theme.toml index b2d7552..51143df 100644 --- a/theme.toml +++ b/theme.toml @@ -8,7 +8,7 @@ description = "Hugo documentation theme as simple as plain book" homepage = "https://github.com/alex-shpak/hugo-book" tags = ["responsive", "clean", "documentation", "docs", "flexbox"] features = [] -min_version = "0.48" +min_version = "0.55" [author] name = "Alex Shpak" -- cgit v1.2.3