Compare commits

..

1 commit

Author SHA1 Message Date
Alex Shpak
7b5d299b7b Rewrite prev-next with enw lang. selector 2021-08-30 14:13:46 +02:00
78 changed files with 270 additions and 2012 deletions

24
.github/workflows/main.yml vendored Normal file
View file

@ -0,0 +1,24 @@
name: Build with Hugo
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
hugo-version:
- 'latest'
- '0.68.0'
steps:
- uses: actions/checkout@v2
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: ${{ matrix.hugo-version }}
extended: true
- name: Run Hugo
working-directory: exampleSite
run: hugo --themesDir ../..

1
.gitignore vendored
View file

@ -1,4 +1,3 @@
public/ public/
exampleSite/public/ exampleSite/public/
.DS_Store .DS_Store
.hugo_build.lock

View file

@ -1,12 +1,12 @@
# Hugo Book Theme # Hugo Book Theme
[![Hugo](https://img.shields.io/badge/hugo-0.124-blue.svg)](https://gohugo.io) [![Hugo](https://img.shields.io/badge/hugo-0.68-blue.svg)](https://gohugo.io)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
![Build with Hugo](https://github.com/alex-shpak/hugo-book/workflows/Build%20with%20Hugo/badge.svg) ![Build with Hugo](https://github.com/alex-shpak/hugo-book/workflows/Build%20with%20Hugo/badge.svg)
### [Hugo](https://gohugo.io) documentation theme as simple as plain book ### [Hugo](https://gohugo.io) documentation theme as simple as plain book
![Screenshot](https://raw.githubusercontent.com/alex-shpak/hugo-book/master/images/screenshot.png) ![Screenshot](https://github.com/alex-shpak/hugo-book/blob/master/images/screenshot.png)
- [Features](#features) - [Features](#features)
- [Requirements](#requirements) - [Requirements](#requirements)
@ -33,46 +33,21 @@
## Requirements ## Requirements
- Hugo 0.124 or higher - Hugo 0.68 or higher
- Hugo extended version, [Installation Instructions](https://gohugo.io/installation/) - Hugo extended version, read more [here](https://gohugo.io/news/0.48-relnotes/)
## Installation ## Installation
### Install as git submodule
Navigate to your hugo project root and run: Navigate to your hugo project root and run:
``` ```
git submodule add https://github.com/alex-shpak/hugo-book themes/hugo-book git submodule add https://github.com/alex-shpak/hugo-book themes/book
``` ```
Then run hugo (or set `theme = "hugo-book"`/`theme: hugo-book` in configuration file) Then run hugo (or set `theme = "book"`/`theme: book` in configuration file)
``` ```
hugo server --minify --theme hugo-book hugo server --minify --theme book
```
### Install as hugo module
You can also add this theme as a Hugo module instead of a git submodule.
Start with initializing hugo modules, if not done yet:
```
hugo mod init github.com/repo/path
```
Navigate to your hugo project root and add [module] section to your `hugo.toml`:
```toml
[module]
[[module.imports]]
path = 'github.com/alex-shpak/hugo-book'
```
Then, to load/update the theme module and run hugo:
```sh
hugo mod get -u
hugo server --minify
``` ```
### Creating site from scratch ### Creating site from scratch
@ -82,12 +57,12 @@ Below is an example on how to create a new site from scratch:
```sh ```sh
hugo new site mydocs; cd mydocs hugo new site mydocs; cd mydocs
git init git init
git submodule add https://github.com/alex-shpak/hugo-book themes/hugo-book git submodule add https://github.com/alex-shpak/hugo-book themes/book
cp -R themes/hugo-book/exampleSite/content.en/* ./content cp -R themes/book/exampleSite/content .
``` ```
```sh ```sh
hugo server --minify --theme hugo-book hugo server --minify --theme book
``` ```
## Menu ## Menu
@ -97,7 +72,7 @@ hugo server --minify --theme hugo-book
By default, the theme will render pages from the `content/docs` section as a menu in a tree structure. By default, the theme will render pages from the `content/docs` section as a menu in a tree structure.
You can set `title` and `weight` in the front matter of pages to adjust the order and titles in the menu. You can set `title` and `weight` in the front matter of pages to adjust the order and titles in the menu.
### Leaf bundle menu (Deprecated, to be removed in June 2022) ### Leaf bundle menu
You can also use leaf bundle and the content of its `index.md` file as menu. You can also use leaf bundle and the content of its `index.md` file as menu.
Given you have the following file structure: Given you have the following file structure:
@ -127,7 +102,7 @@ headless = true
And Enable it by setting `BookMenuBundle: /menu` in Site configuration. And Enable it by setting `BookMenuBundle: /menu` in Site configuration.
- [Example menu](https://github.com/alex-shpak/hugo-book/blob/master/exampleSite/content.en/menu/index.md) - [Example menu](https://github.com/alex-shpak/hugo-book/blob/master/exampleSite/content/menu/index.md)
- [Example config file](https://github.com/alex-shpak/hugo-book/blob/master/exampleSite/config.yaml) - [Example config file](https://github.com/alex-shpak/hugo-book/blob/master/exampleSite/config.yaml)
- [Leaf bundles](https://gohugo.io/content-management/page-bundles/) - [Leaf bundles](https://gohugo.io/content-management/page-bundles/)
@ -140,7 +115,7 @@ A blog is not the primary usecase of this theme, so it has only minimal features
### Site Configuration ### Site Configuration
There are a few configuration options that you can add to your `hugo.toml` file. There are a few configuration options that you can add to your `config.toml` file.
You can also see the `yaml` example [here](https://github.com/alex-shpak/hugo-book/blob/master/exampleSite/config.yaml). You can also see the `yaml` example [here](https://github.com/alex-shpak/hugo-book/blob/master/exampleSite/config.yaml).
```toml ```toml
@ -179,7 +154,6 @@ disableKinds = ['taxonomy', 'taxonomyTerm']
# (Optional, default none) Set leaf bundle to render as side menu # (Optional, default none) Set leaf bundle to render as side menu
# When not specified file structure and weights will be used # When not specified file structure and weights will be used
# Deprecated, to be removed in June 2022
BookMenuBundle = '/menu' BookMenuBundle = '/menu'
# (Optional, default docs) Specify section of content to render as menu # (Optional, default docs) Specify section of content to render as menu
@ -189,7 +163,7 @@ disableKinds = ['taxonomy', 'taxonomyTerm']
# Set source repository location. # Set source repository location.
# Used for 'Last Modified' and 'Edit this page' links. # Used for 'Last Modified' and 'Edit this page' links.
BookRepo = 'https://github.com/alex-shpak/hugo-book' BookRepo = 'https://github.com/alex-shpak/hugo-book'
# Specifies commit portion of the link to the page's last modified commit hash for 'doc' page # Specifies commit portion of the link to the page's last modified commit hash for 'doc' page
# type. # type.
# Required if 'BookRepo' param is set. # Required if 'BookRepo' param is set.
@ -261,18 +235,13 @@ bookComments = true
# (Optional) Set to 'false' to exclude page from search index. # (Optional) Set to 'false' to exclude page from search index.
bookSearchExclude = true bookSearchExclude = true
# (Optional) Set explicit href attribute for this page in a menu (if BookMenuBundle not set)
bookHref = ''
``` ```
### Partials ### Partials
There are layout partials available for you to easily override components of the theme in `layouts/partials/`. There are few empty partials you can override in `layouts/partials/`
In addition to this, there are several empty partials you can override to easily add/inject code. | Partial | Placement |
| Empty Partial | Placement |
| -------------------------------------------------- | ------------------------------------------- | | -------------------------------------------------- | ------------------------------------------- |
| `layouts/partials/docs/inject/head.html` | Before closing `<head>` tag | | `layouts/partials/docs/inject/head.html` | Before closing `<head>` tag |
| `layouts/partials/docs/inject/body.html` | Before closing `<body>` tag | | `layouts/partials/docs/inject/body.html` | Before closing `<body>` tag |
@ -296,7 +265,7 @@ In addition to this, there are several empty partials you can override to easily
### Plugins ### Plugins
There are a few features implemented as pluggable `scss` styles. Usually these are features that don't make it to the core but can still be useful. There are a few features implemented as plugable `scss` styles. Usually these are features that don't make it to the core but can still be useful.
| Plugin | Description | | Plugin | Description |
| --------------------------------- | ----------------------------------------------------------- | | --------------------------------- | ----------------------------------------------------------- |

View file

@ -69,7 +69,6 @@ ul.pagination {
display: flex; display: flex;
justify-content: center; justify-content: center;
list-style-type: none; list-style-type: none;
padding-inline-start: 0px;
.page-item a { .page-item a {
padding: $padding-16; padding: $padding-16;
@ -251,10 +250,20 @@ body[dir="rtl"] .book-menu {
padding-top: $padding-16; padding-top: $padding-16;
font-size: $font-size-14; font-size: $font-size-14;
a {
margin: $padding-8 0;
}
img { img {
height: 1em; height: 1em;
width: 1em; width: 1em;
margin-inline-end: $padding-8;
&:first-child {
margin-inline-end: $padding-8;
}
&:last-child {
margin-inline-start: $padding-8;
}
} }
} }

View file

@ -65,12 +65,9 @@
img { img {
max-width: 100%; max-width: 100%;
height: auto;
} }
code { code {
direction: ltr;
unicode-bidi: embed;
padding: 0 $padding-4; padding: 0 $padding-4;
background: var(--gray-200); background: var(--gray-200);
border-radius: $border-radius; border-radius: $border-radius;
@ -78,8 +75,6 @@
} }
pre { pre {
direction: ltr;
unicode-bidi: embed;
padding: $padding-16; padding: $padding-16;
background: var(--gray-100); background: var(--gray-100);
border-radius: $border-radius; border-radius: $border-radius;
@ -91,10 +86,6 @@
} }
} }
p {
word-wrap: break-word;
}
blockquote { blockquote {
margin: $padding-16 0; margin: $padding-16 0;
padding: $padding-8 $padding-16 $padding-8 ($padding-16 - $padding-4); //to keep total left space 16dp padding: $padding-8 $padding-16 $padding-8 ($padding-16 - $padding-4); //to keep total left space 16dp
@ -138,7 +129,6 @@
ul, ul,
ol { ol {
padding-inline-start: $padding-16 * 2; padding-inline-start: $padding-16 * 2;
word-wrap: break-word;
} }
dl { dl {
@ -154,11 +144,6 @@
} }
// Special case for highlighted code with line numbers // Special case for highlighted code with line numbers
.highlight {
direction: ltr;
unicode-bidi: embed;
}
.highlight table tr { .highlight table tr {
td:nth-child(1) pre { td:nth-child(1) pre {
margin: 0; margin: 0;

View file

@ -11,9 +11,6 @@
document.querySelectorAll("pre code").forEach(code => { document.querySelectorAll("pre code").forEach(code => {
code.addEventListener("click", function (event) { code.addEventListener("click", function (event) {
if (window.getSelection().toString()) {
return;
}
select(code.parentElement); select(code.parentElement);
if (navigator.clipboard) { if (navigator.clipboard) {

View file

@ -1,14 +1,14 @@
{ {
"name": "{{ .Site.Title }}", "name": "{{ .Site.Title }}",
"short_name": "{{ .Site.Title }}", "short_name": "{{ .Site.Title }}",
"start_url": "{{ "./" | relURL }}", "start_url": "{{ "/" | relURL }}",
"scope": "{{ "./" | relURL }}", "scope": "{{ "/" | relURL }}",
"display": "standalone", "display": "standalone",
"background_color": "#000000", "background_color": "#000000",
"theme_color": "#000000", "theme_color": "#000000",
"icons": [ "icons": [
{ {
"src": "{{ "./favicon.svg" | relURL }}", "src": "{{ "/favicon.svg" | relURL }}",
"sizes": "512x512" "sizes": "512x512"
} }
] ]

View file

@ -1,7 +1,7 @@
$startLevel: 1; $startLevel: 1;
$endLevel: 6; $endLevel: 6;
.book-page .markdown.book-article { .book-page .markdown {
@for $currentLevel from $startLevel through $endLevel { @for $currentLevel from $startLevel through $endLevel {
> h#{$currentLevel} { > h#{$currentLevel} {
counter-increment: h#{$currentLevel}; counter-increment: h#{$currentLevel};
@ -19,7 +19,7 @@ $endLevel: 6;
} }
} }
.book-toc nav#TableOfContents ul { .book-toc nav ul {
li { li {
counter-increment: item; counter-increment: item;

View file

@ -1,9 +1,7 @@
[ [
{{- $pages := where .Site.Pages "Kind" "in" (slice "page" "section") -}} {{- $pages := where .Site.Pages "Kind" "in" (slice "page" "section") -}}
{{- $pages = where $pages "Params.booksearchexclude" "!=" true -}} {{- $pages = where $pages "Params.booksearchexclude" "!=" true -}}
{{/* Remove until we know why it does not work, see https://github.com/alex-shpak/hugo-book/issues/528 */}} {{- $pages = where $pages "Content" "not in" (slice nil "") -}}
{{/*- $pages = where $pages "Content" "not in" (slice nil "") -*/}}
{{- $pages = where $pages "Content" "!=" "" -}}
{{ range $index, $page := $pages }} {{ range $index, $page := $pages }}
{{ if gt $index 0}},{{end}} { {{ if gt $index 0}},{{end}} {

View file

@ -7,21 +7,11 @@
(function () { (function () {
const searchDataURL = '{{ $searchData.RelPermalink }}'; const searchDataURL = '{{ $searchData.RelPermalink }}';
const indexConfig = Object.assign({{ $searchConfig }}, { const indexConfig = Object.assign({{ $searchConfig }}, {
includeScore: true, doc: {
useExtendedSearch: true, id: 'id',
fieldNormWeight: 1.5, field: ['title', 'content'],
threshold: 0.2, store: ['title', 'href', 'section']
ignoreLocation: true, }
keys: [
{
name: 'title',
weight: 0.7
},
{
name: 'content',
weight: 0.3
}
]
}); });
const input = document.querySelector('#book-search-input'); const input = document.querySelector('#book-search-input');
@ -40,10 +30,6 @@
* @param {Event} event * @param {Event} event
*/ */
function focusSearchFieldOnKeyPress(event) { function focusSearchFieldOnKeyPress(event) {
if (event.target.value !== undefined) {
return;
}
if (input === document.activeElement) { if (input === document.activeElement) {
return; return;
} }
@ -73,7 +59,8 @@
fetch(searchDataURL) fetch(searchDataURL)
.then(pages => pages.json()) .then(pages => pages.json())
.then(pages => { .then(pages => {
window.bookSearchIndex = new Fuse(pages, indexConfig); window.bookSearchIndex = FlexSearch.create('balance', indexConfig);
window.bookSearchIndex.add(pages);
}) })
.then(() => input.required = false) .then(() => input.required = false)
.then(search); .then(search);
@ -88,14 +75,14 @@
return; return;
} }
const searchHits = window.bookSearchIndex.search(input.value).slice(0,10); const searchHits = window.bookSearchIndex.search(input.value, 10);
searchHits.forEach(function (page) { searchHits.forEach(function (page) {
const li = element('<li><a href></a><small></small></li>'); const li = element('<li><a href></a><small></small></li>');
const a = li.querySelector('a'), small = li.querySelector('small'); const a = li.querySelector('a'), small = li.querySelector('small');
a.href = page.item.href; a.href = page.href;
a.textContent = page.item.title; a.textContent = page.title;
small.textContent = page.item.section; small.textContent = page.section;
results.appendChild(li); results.appendChild(li);
}); });

View file

@ -2,6 +2,6 @@
if (navigator.serviceWorker) { if (navigator.serviceWorker) {
navigator.serviceWorker.register( navigator.serviceWorker.register(
"{{ $swJS.RelPermalink }}", "{{ $swJS.RelPermalink }}",
{ scope: "{{ "./" | relURL }}" } { scope: "{{ "/" | relURL }}" }
); );
} }

View file

@ -1,4 +1,4 @@
# hugo server --minify --themesDir ../.. --baseURL=http://0.0.0.0:1313/theme/hugo-book/ # hugo server --minify --themesDir ... --baseURL=http://0.0.0.0:1313/theme/hugo-book/
baseURL = 'https://example.com/' baseURL = 'https://example.com/'
title = 'Hugo Book' title = 'Hugo Book'
@ -23,7 +23,7 @@ enableGitInfo = true
[languages] [languages]
[languages.en] [languages.en]
languageName = 'English' languageName = 'English'
contentDir = 'content.en' contentDir = 'content'
weight = 1 weight = 1
[languages.ru] [languages.ru]
@ -45,7 +45,7 @@ enableGitInfo = true
[[menu.after]] [[menu.after]]
name = "Hugo Themes" name = "Hugo Themes"
url = "https://themes.gohugo.io/themes/hugo-book/" url = "https://themes.gohugo.io/hugo-book/"
weight = 20 weight = 20
[params] [params]
@ -58,12 +58,8 @@ enableGitInfo = true
# You can also specify this parameter per page in front matter. # You can also specify this parameter per page in front matter.
BookToC = true BookToC = true
# (Optional, default favicon.png) Set the path to a favicon file. # (Optional, default none) Set the path to a logo for the book. If the logo is
# If the favicon is /static/favicon.png then the path would be favicon.png # /static/logo.png then the path would be logo.png
# BookFavicon = 'favicon.png'
# (Optional, default none) Set the path to a logo for the book.
# If the logo is /static/logo.png then the path would be logo.png
# BookLogo = 'logo.png' # BookLogo = 'logo.png'
# (Optional, default none) Set leaf bundle to render as side menu # (Optional, default none) Set leaf bundle to render as side menu

View file

@ -1,4 +1,4 @@
# hugo server --minify --themesDir ../.. --baseURL=http://0.0.0.0:1313/theme/hugo-book/ # hugo server --minify --themesDir ... --baseURL=http://0.0.0.0:1313/theme/hugo-book/
baseURL: https://example.com/ baseURL: https://example.com/
title: Hugo Book title: Hugo Book
@ -23,7 +23,7 @@ markup:
languages: languages:
en: en:
languageName: English languageName: English
contentDir: content.en contentDir: content
weight: 1 weight: 1
ru: ru:
languageName: Russian languageName: Russian
@ -41,7 +41,7 @@ menu:
url: "https://github.com/alex-shpak/hugo-book" url: "https://github.com/alex-shpak/hugo-book"
weight: 10 weight: 10
- name: "Hugo Themes" - name: "Hugo Themes"
url: "https://themes.gohugo.io/themes/hugo-book/" url: "https://themes.gohugo.io/hugo-book/"
weight: 20 weight: 20
params: params:
@ -54,12 +54,8 @@ params:
# You can also specify this parameter per page in front matter. # You can also specify this parameter per page in front matter.
BookToC: true BookToC: true
# (Optional, default favicon.png) Set the path to a favicon file. # (Optional, default none) Set the path to a logo for the book. If the logo is
# If the favicon is /static/favicon.png then the path would be favicon.png # /static/logo.png then the path would be logo.png
# BookFavicon: "favicon.png"
# (Optional, default none) Set the path to a logo for the book.
# If the logo is /static/logo.png then the path would be logo.png
# BookLogo: /logo.png # BookLogo: /logo.png
# (Optional, default none) Set leaf bundle to render as side menu # (Optional, default none) Set leaf bundle to render as side menu

View file

@ -1,15 +0,0 @@
---
bookCollapseSection: true
---
# Section
Section renders pages in section as definition list, using title and description. Optional param `summary` can be used to show or hide page summary
## Example
```tpl
{{</* section [summary] */>}}
```
{{<section summary >}}

View file

@ -1,35 +1,28 @@
---
title: KaTeX
---
# KaTeX # KaTeX
KaTeX shortcode let you render math typesetting in markdown document. See [KaTeX](https://katex.org/) KaTeX shortcode let you render math typesetting in markdown document. See [KaTeX](https://katex.org/)
## Example ## Example
{{< columns >}}
<div class="book-columns flex flex-wrap">
<div class="flex-even markdown-inner">
```latex ```latex
{{</* katex display=true class="optional" >}} {{</* katex [display] [class="text-center"] */>}}
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
{{< /katex */>}} {{</* /katex */>}}
``` ```
</div> <--->
<div class="flex-even markdown-inner">
{{< katex display=true class="optional" >}} {{< katex display >}}
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
{{< /katex >}} {{< /katex >}}
</div> {{< /columns >}}
</div>
## Display Mode Example ## Display Mode Example
Here is some inline example: {{< katex >}}\pi(x){{< /katex >}}, rendered in the same line. And below is `display` example, having `display: block` Here is some inline example: {{< katex >}}\pi(x){{< /katex >}}, rendered in the same line. And below is `display` example, having `display: block`
{{< katex display=true >}} {{< katex display >}}
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
{{< /katex >}} {{< /katex >}}
Text continues here. Text continues here.

View file

@ -11,12 +11,9 @@ create a `mermaid.json` file in your `assets` folder!
## Example ## Example
{{< columns >}}
<div class="book-columns flex flex-wrap">
<div class="flex-even markdown-inner">
```tpl ```tpl
{{</* mermaid class="optional" >}} {{</* mermaid [class="text-center"]*/>}}
stateDiagram-v2 stateDiagram-v2
State1: The state with a note State1: The state with a note
note right of State1 note right of State1
@ -25,13 +22,12 @@ stateDiagram-v2
end note end note
State1 --> State2 State1 --> State2
note left of State2 : This is the note to the left. note left of State2 : This is the note to the left.
{{< /mermaid */>}} {{</* /mermaid */>}}
``` ```
</div> <--->
<div class="flex-even markdown-inner">
{{< mermaid class="optional" >}} {{< mermaid >}}
stateDiagram-v2 stateDiagram-v2
State1: The state with a note State1: The state with a note
note right of State1 note right of State1
@ -42,5 +38,4 @@ stateDiagram-v2
note left of State2 : This is the note to the left. note left of State2 : This is the note to the left.
{{< /mermaid >}} {{< /mermaid >}}
</div> {{< /columns >}}
</div>

View file

@ -0,0 +1,15 @@
---
bookCollapseSection: true
---
# Section
Section renders pages in section as definition list, using title and description.
## Example
```tpl
{{</* section */>}}
```
{{<section>}}

View file

@ -16,7 +16,7 @@ headless: true
- [Columns]({{< relref "/docs/shortcodes/columns" >}}) - [Columns]({{< relref "/docs/shortcodes/columns" >}})
- [Expand]({{< relref "/docs/shortcodes/expand" >}}) - [Expand]({{< relref "/docs/shortcodes/expand" >}})
- [Hints]({{< relref "/docs/shortcodes/hints" >}}) - [Hints]({{< relref "/docs/shortcodes/hints" >}})
- [KaTeX]({{< relref "/docs/shortcodes/katex" >}}) - [Katex]({{< relref "/docs/shortcodes/katex" >}})
- [Mermaid]({{< relref "/docs/shortcodes/mermaid" >}}) - [Mermaid]({{< relref "/docs/shortcodes/mermaid" >}})
- [Tabs]({{< relref "/docs/shortcodes/tabs" >}}) - [Tabs]({{< relref "/docs/shortcodes/tabs" >}})
<br /> <br />

File diff suppressed because one or more lines are too long

View file

@ -1 +0,0 @@
{"Target":"book.min.309b7ed028807cdb68d8d61e26d609f48369c098dbf5e4d8c0dcf4cdf49feafc.css","MediaType":"text/css","Data":{"Integrity":"sha256-MJt+0CiAfNto2NYeJtYJ9INpwJjb9eTYwNz0zfSf6vw="}}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
{"Target":"book.min.ad694c0f1601cd801d432bdb4a6abae57aa202e0cec7e44e2f6ab46fbe7b628c.css","MediaType":"text/css","Data":{"Integrity":"sha256-rWlMDxYBzYAdQyvbSmq65XqiAuDOx+ROL2q0b757Yow="}}

3
go.mod
View file

@ -1,3 +0,0 @@
module code.lila.network/adoralaura/hugo-book-theme
go 1.22.2

View file

@ -1,14 +0,0 @@
- id: Search
translation: ፈልግ
- id: Edit this page
translation: ይህንን ገጽ አስተካክል
- id: Last modified by
translation: መጨረሻ የከለሰው ሰው
- id: Expand
translation: አስፋ
- id: bookSearchConfig
translation: '{ cache: true }'

View file

@ -8,7 +8,7 @@
translation: Última modificación por translation: Última modificación por
- id: Expand - id: Expand
translation: Expandir translation: Expand
- id: bookSearchConfig - id: bookSearchConfig
translation: '{ cache: true }' translation: '{ cache: true }'

View file

@ -29,6 +29,7 @@
</main> </main>
{{ partial "docs/inject/body" . }} {{ partial "docs/inject/body" . }}
{{ template "_internal/google_analytics_async.html" . }}
</body> </body>
</html> </html>

View file

@ -1,10 +1,10 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="{{ default .Site.Language.Lang .Site.LanguageCode }}" dir="{{ default "ltr" .Site.Language.LanguageDirection }}"> <html lang="{{ .Site.Language.Lang }}" dir="{{ .Site.Language.LanguageDirection | default "ltr" }}">
<head> <head>
{{ partial "docs/html-head" . }} {{ partial "docs/html-head" . }}
{{ partial "docs/inject/head" . }} {{ partial "docs/inject/head" . }}
</head> </head>
<body dir="{{ default "ltr" .Site.Language.LanguageDirection }}"> <body dir="{{ .Site.Language.LanguageDirection | default "ltr" }}">
<input type="checkbox" class="hidden toggle" id="menu-control" /> <input type="checkbox" class="hidden toggle" id="menu-control" />
<input type="checkbox" class="hidden toggle" id="toc-control" /> <input type="checkbox" class="hidden toggle" id="toc-control" />
<main class="container flex"> <main class="container flex">
@ -73,7 +73,7 @@
{{ end }} {{ end }}
{{ define "main" }} {{ define "main" }}
<article class="markdown book-article"> <article class="markdown">
{{- .Content -}} {{- .Content -}}
</article> </article>
{{ end }} {{ end }}

View file

@ -3,4 +3,4 @@
Usage: partial "docs/date" (dict "Date" .Date "Format" .Site.Params.BookDateFormat) Usage: partial "docs/date" (dict "Date" .Date "Format" .Site.Params.BookDateFormat)
--> -->
{{- $format := default "January 2, 2006" .Format -}} {{- $format := default "January 2, 2006" .Format -}}
{{- return (time.Format $format .Date) -}} {{- return (.Date.Format $format) -}}

View file

@ -1,27 +1,25 @@
<div class="flex flex-wrap justify-between"> <div class="flex flex-wrap justify-between">
{{ if and .GitInfo .Site.Params.BookRepo }} {{ if and .GitInfo .Site.Params.BookRepo }}
<div> {{- $date := partial "docs/date" (dict "Date" .GitInfo.AuthorDate.Local "Format" .Site.Params.BookDateFormat) -}}
{{- $date := partial "docs/date" (dict "Date" .GitInfo.AuthorDate.Local "Format" .Site.Params.BookDateFormat) -}} {{- $commitPath := default "commit" .Site.Params.BookCommitPath -}}
{{- $commitPath := default "commit" .Site.Params.BookCommitPath -}} <a class="flex align-center" href="{{ .Site.Params.BookRepo }}/{{ $commitPath }}/{{ .GitInfo.Hash }}" title='{{ i18n "Last modified by" }} {{ .GitInfo.AuthorName }} | {{ $date }}' target="_blank" rel="noopener">
<a class="flex align-center" href="{{ .Site.Params.BookRepo }}/{{ $commitPath }}/{{ .GitInfo.Hash }}" title='{{ i18n "Last modified by" }} {{ .GitInfo.AuthorName }} | {{ $date }}' target="_blank" rel="noopener"> <img src="{{ "svg/calendar.svg" | relURL }}" class="book-icon" alt="Calendar" />
<img src="{{ "svg/calendar.svg" | relURL }}" class="book-icon" alt="" /> <span>{{ $date }}</span>
<span>{{ $date }}</span> </a>
</a>
</div>
{{ end }} {{ end }}
{{ if and .File .Site.Params.BookRepo .Site.Params.BookEditPath }} {{ if and .File .Site.Params.BookRepo .Site.Params.BookEditPath }}
<div> <a class="flex align-center" href="{{ .Site.Params.BookRepo }}/{{ .Site.Params.BookEditPath }}/{{ .Site.Params.contentDir | default "content" }}/{{ replace .File.Path "\\" "/" }}" target="_blank" rel="noopener">
<a class="flex align-center" href="{{ .Site.Params.BookRepo }}/{{ .Site.Params.BookEditPath }}/{{ .Site.Params.contentDir | default "content" }}/{{ replace .File.Path "\\" "/" }}" target="_blank" rel="noopener"> <img src="{{ "svg/edit.svg" | relURL }}" class="book-icon" alt="Edit" />
<img src="{{ "svg/edit.svg" | relURL }}" class="book-icon" alt="" /> <span>{{ i18n "Edit this page" }}</span>
<span>{{ i18n "Edit this page" }}</span> </a>
</a>
</div>
{{ end }} {{ end }}
</div> </div>
{{ partial "docs/prev-next" . }}
{{ $script := resources.Get "clipboard.js" | resources.Minify }} {{ $script := resources.Get "clipboard.js" | resources.Minify }}
{{ with $script.Content }} {{ with $script.Content }}
<script>{{ . | safeJS }}</script> <script>{{ . | safeJS }}</script>

View file

@ -1 +0,0 @@
{{ partial "docs/title" . }} | {{ .Site.Title -}}

View file

@ -1,25 +1,18 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="{{ default .Summary .Description }}"> <meta name="description" content="{{ default .Summary .Description }}">
<meta name="theme-color" media="(prefers-color-scheme: light)" content="#ffffff"> <meta name="theme-color" content="#FFFFFF">
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#343a40">
<meta name="color-scheme" content="light dark">
{{- with .Page.Params.BookHref -}}
<meta http-equiv="Refresh" content="0; url='{{ . }}'" />
{{- end -}}
{{- template "_internal/opengraph.html" . -}} {{- template "_internal/opengraph.html" . -}}
<title>{{ partial "docs/html-head-title" . }}</title> <title>{{ partial "docs/title" . }} | {{ .Site.Title -}}</title>
{{- $manifest := resources.Get "manifest.json" | resources.ExecuteAsTemplate "manifest.json" . }} {{- $manifest := resources.Get "manifest.json" | resources.ExecuteAsTemplate "manifest.json" . }}
<link rel="manifest" href="{{ $manifest.RelPermalink }}"> <link rel="manifest" href="{{ $manifest.RelPermalink }}">
<link rel="icon" href="{{ .Site.Params.BookFavicon | default "favicon.png" | relURL }}" > <link rel="icon" href="{{ "favicon.png" | relURL }}" type="image/x-icon">
<link rel="canonical" href="{{ .Permalink }}">
{{- range .Translations }} {{- range .Translations }}
<link rel="alternate" hreflang="{{ default .Language.Lang .Site.LanguageCode }}" href="{{ .Permalink }}" title="{{ partial "docs/title" . }}"> <link rel="alternate" hreflang="{{ .Language.Lang }}" href="{{ .Permalink }}" title="{{ partial "docs/title" . }}">
{{- end -}} {{- end -}}
<!-- Theme stylesheet, you can customize scss by creating `assets/custom.scss` in your website --> <!-- Theme stylesheet, you can customize scss by creating `assets/custom.scss` in your website -->
@ -29,7 +22,7 @@
{{- if default true .Site.Params.BookSearch -}} {{- if default true .Site.Params.BookSearch -}}
{{- $searchJSFile := printf "%s.search.js" .Language.Lang }} {{- $searchJSFile := printf "%s.search.js" .Language.Lang }}
{{- $searchJS := resources.Get "search.js" | resources.ExecuteAsTemplate $searchJSFile . | resources.Minify | resources.Fingerprint }} {{- $searchJS := resources.Get "search.js" | resources.ExecuteAsTemplate $searchJSFile . | resources.Minify | resources.Fingerprint }}
<script defer src="{{ "fuse.min.js" | relURL }}"></script> <script defer src="{{ "flexsearch.min.js" | relURL }}"></script>
<script defer src="{{ $searchJS.RelPermalink }}" {{ template "integrity" $searchJS }}></script> <script defer src="{{ $searchJS.RelPermalink }}" {{ template "integrity" $searchJS }}></script>
{{ end -}} {{ end -}}
@ -38,7 +31,7 @@
<script defer src="{{ $swJS.RelPermalink }}" {{ template "integrity" $swJS }}></script> <script defer src="{{ $swJS.RelPermalink }}" {{ template "integrity" $swJS }}></script>
{{ end -}} {{ end -}}
{{- template "_internal/google_analytics.html" . -}} {{- template "_internal/google_analytics_async.html" . -}}
<!-- RSS --> <!-- RSS -->
{{- with .OutputFormats.Get "rss" -}} {{- with .OutputFormats.Get "rss" -}}

View file

@ -28,19 +28,15 @@
{{ $current := eq .CurrentPage .Page }} {{ $current := eq .CurrentPage .Page }}
{{ $ancestor := .Page.IsAncestor .CurrentPage }} {{ $ancestor := .Page.IsAncestor .CurrentPage }}
{{ if .Page.Params.BookCollapseSection }} {{ if .Page.Params.bookCollapseSection }}
<input type="checkbox" id="section-{{ md5 .Page }}" class="toggle" {{ if or $current $ancestor }}checked{{ end }} /> <input type="checkbox" id="section-{{ md5 .Page }}" class="toggle" {{ if or $current $ancestor }}checked{{ end }} />
<label for="section-{{ md5 .Page }}" class="flex justify-between"> <label for="section-{{ md5 .Page }}" class="flex justify-between">
<a {{ if .Page.Content }}href="{{ .Page.RelPermalink }}"{{ else }}role="button"{{ end }} class="{{ if $current }}active{{ end }}"> <a {{ if .Page.Content }}href="{{ .Page.Permalink }}"{{ else }}role="button"{{ end }} class="{{ if $current }}active{{ end }}">
{{- partial "docs/title" .Page -}} {{- partial "docs/title" .Page -}}
</a> </a>
</label> </label>
{{ else if .Page.Params.BookHref }}
<a href="{{ .Page.Params.BookHref }}" class="{{ if $current }}active{{ end }}" target="_blank" rel="noopener">
{{- partial "docs/title" .Page -}}
</a>
{{ else if .Page.Content }} {{ else if .Page.Content }}
<a href="{{ .Page.RelPermalink }}" class="{{ if $current }}active{{ end }}"> <a href="{{ .Page.Permalink }}" class="{{ if $current }} active{{ end }}">
{{- partial "docs/title" .Page -}} {{- partial "docs/title" .Page -}}
</a> </a>
{{ else }} {{ else }}

View file

@ -10,7 +10,7 @@
<ul> <ul>
{{ range . }} {{ range . }}
<li> <li>
<a href="{{ .URL }}" {{ with .Params.class }}class="{{ . }}"{{ end }} {{ if not .Page }}target="_blank" rel="noopener"{{ end }}> <a href="{{ .URL }}" {{ if not .Page }}target="_blank" rel="noopener"{{ end }}>
{{- .Pre -}} {{- .Pre -}}
{{ with .Page }} {{ with .Page }}
{{ partial "docs/title" .Page }} {{ partial "docs/title" .Page }}

View file

@ -1,7 +1,7 @@
<nav> <nav>
{{ partial "docs/brand" . }} {{ partial "docs/brand" . }}
{{ partial "docs/search" . }} {{ partial "docs/search" . }}
{{ if hugo.IsMultilingual }} {{ if .Site.IsMultiLingual }}
{{ partial "docs/languages" . }} {{ partial "docs/languages" . }}
{{ end }} {{ end }}

View file

@ -0,0 +1,14 @@
{{ $scratch := newScratch }}
{{ template "recurse" (dict "Scratch" $scratch "Sections" .) }}
{{ define "recurse" }}
{{ range .Sections }}
{{ if and .Content (not .Params.BookHidden) }}
{{ $.Scratch.Add "BookPages" (slice .) }}
{{ end }}
{{ if .IsSection }}
{{ template "recurse" (dict "Scratch" $.Scratch "Sections" .Pages) }}
{{ end }}
{{ end }}
{{ end }}
{{ return $scratch.Get "BookPages" }}

View file

@ -0,0 +1,27 @@
{{ $bookSection := default "docs" .Site.Params.BookSection }}
{{ if eq $bookSection "*" }}
{{ $bookSection = "/" }}{{/* Backward compatibility */}}
{{ end }}
{{ with .Site.GetPage $bookSection }}
{{ $pages := partialCached "docs/prev-next-cache" .Pages }}
{{ $prev := $pages.Next $ }}
{{ $next := $pages.Prev $ }}
{{- if or $prev $next }}
<div class="flex flex-wrap justify-between">
{{ with $prev }}
<a href="{{ .RelPermalink }}" class="flex align-center float-left book-icon">
<img src="{{ "svg/backward.svg" | relURL }}" alt="Previous" title="{{ partial "docs/title" . }}" />
<span>{{ partial "docs/title" . }}</span>
</a>
{{ end }}
{{ with $next }}
<a href="{{ .RelPermalink }}" class="flex align-center float-right book-icon">
<span>{{ partial "docs/title" . }}</span>
<img src="{{ "svg/forward.svg" | relURL }}" alt="Next" title="{{ partial "docs/title" . }}" />
</a>
{{ end }}
</div>
{{ end -}}
{{ end }}

View file

@ -1,8 +1,7 @@
{{ if default true .Site.Params.BookSearch }} {{ if default true .Site.Params.BookSearch }}
<div class="book-search hidden"> <div class="book-search">
<input type="text" id="book-search-input" placeholder="{{ i18n "Search" }}" aria-label="{{ i18n "Search" }}" maxlength="64" data-hotkeys="s/" /> <input type="text" id="book-search-input" placeholder="{{ i18n "Search" }}" aria-label="{{ i18n "Search" }}" maxlength="64" data-hotkeys="s/" />
<div class="book-search-spinner hidden"></div> <div class="book-search-spinner hidden"></div>
<ul id="book-search-results"></ul> <ul id="book-search-results"></ul>
</div> </div>
<script>document.querySelector(".book-search").classList.remove("hidden")</script>
{{ end }} {{ end }}

View file

@ -4,9 +4,7 @@
--> -->
{{ $title := "" }} {{ $title := "" }}
{{ if .LinkTitle }} {{ if .Title }}
{{ $title = .LinkTitle }}
{{ else if .Title }}
{{ $title = .Title }} {{ $title = .Title }}
{{ else if and .IsSection .File }} {{ else if and .IsSection .File }}
{{ $title = path.Base .File.Dir | humanize | title }} {{ $title = path.Base .File.Dir | humanize | title }}

View file

@ -1,5 +1,5 @@
{{ define "main" }} {{ define "main" }}
<article class="markdown book-post"> <article class="markdown">
<h1> <h1>
<a href="{{ .RelPermalink }}">{{ partial "docs/title.html" . }}</a> <a href="{{ .RelPermalink }}">{{ partial "docs/title.html" . }}</a>
</h1> </h1>

View file

@ -8,5 +8,5 @@
{{ $ref = relref $ . }} {{ $ref = relref $ . }}
{{ end }} {{ end }}
<a {{ with $ref }} href="{{.}}" {{ end }} {{ with $target }} target="{{.}}" rel="noopener" {{ end }} class="book-btn{{ with .Get "class" }} {{ . }}{{ end }}"> <a {{ with $ref }} href="{{.}}" {{ end }} {{ with $target }} target="{{.}}" rel="noopener" {{ end }} class="book-btn{{ with .Get "class" }} {{ . }}{{ end }}">
{{ .Inner | .Page.RenderString }} {{ $.Inner | markdownify }}
</a> </a>

View file

@ -1,7 +1,6 @@
<details {{ if or (.Get "open") (in .Params "open") }}open{{ end }}> <details {{ if or (.Get "open") (in .Params "open") }}open{{ end }}>
{{- $summary := cond .IsNamedParams (.Get "title") (.Get 0) -}} <summary>{{ cond .IsNamedParams (.Get "title") (.Get 0) }}</summary>
<summary>{{ $summary | .Page.RenderString }}</summary>
<div class="markdown-inner"> <div class="markdown-inner">
{{ .Inner | .Page.RenderString }} {{ .Inner | markdownify }}
</div> </div>
</details> </details>

View file

@ -1,3 +1,3 @@
<blockquote class="book-hint {{ .Get 0 }}"> <blockquote class="book-hint {{ .Get 0 }}">
{{ .Inner | .Page.RenderString }} {{ .Inner | markdownify }}
</blockquote> </blockquote>

View file

@ -1 +0,0 @@
{{- .Inner -}}

View file

@ -1,5 +1,5 @@
{{- if not (.Page.Scratch.Get "katex") -}} {{- if not (.Page.Scratch.Get "katex") -}}
<!-- Include katex only first time --> <!-- Include katext only first time -->
<link rel="stylesheet" href="{{ "katex/katex.min.css" | relURL }}" /> <link rel="stylesheet" href="{{ "katex/katex.min.css" | relURL }}" />
<script defer src="{{ "katex/katex.min.js" | relURL }}"></script> <script defer src="{{ "katex/katex.min.js" | relURL }}"></script>
<script defer src="{{ "katex/auto-render.min.js" | relURL }}" onload="renderMathInElement(document.body);"></script> <script defer src="{{ "katex/auto-render.min.js" | relURL }}" onload="renderMathInElement(document.body);"></script>
@ -7,7 +7,7 @@
{{- end -}} {{- end -}}
<span {{- with .Get "class" }} class="{{ . }}"{{ end }}> <span {{- with .Get "class" }} class="{{ . }}"{{ end }}>
{{ with .Get "display" }}\[{{else}}\({{end}} {{ cond (in .Params "display") "\\[" "\\(" -}}
{{- trim .Inner "\n" -}} {{- trim .Inner "\n" -}}
{{ with .Get "display" }}\]{{else}}\){{end}} {{- cond (in .Params "display") "\\]" "\\)" }}
</span> </span>

View file

@ -3,10 +3,8 @@
<dt> <dt>
<a href="{{ .RelPermalink }}">{{ partial "docs/title" . }}</a> <a href="{{ .RelPermalink }}">{{ partial "docs/title" . }}</a>
</dt> </dt>
{{ if (in $.Params "summary") -}}
<dd class="markdown-inner"> <dd class="markdown-inner">
{{ default .Summary .Description }} {{ default .Summary .Description }}
</dd> </dd>
{{ end -}}
{{ end }} {{ end }}
</dl> </dl>

View file

@ -9,7 +9,7 @@
{{- $tab.Name -}} {{- $tab.Name -}}
</label> </label>
<div class="book-tabs-content markdown-inner"> <div class="book-tabs-content markdown-inner">
{{- .Content | $.Page.RenderString -}} {{- .Content | markdownify -}}
</div> </div>
{{- end -}} {{- end -}}
</div> </div>

View file

@ -1,5 +1,5 @@
{{ define "main" }} {{ define "main" }}
<article class="markdown book-post"> <article class="markdown">
<h1>{{ .Title | title }}</h1> <h1>{{ .Title | title }}</h1>
{{ $taxonomies := index .Site.Taxonomies .Page.Type }} {{ $taxonomies := index .Site.Taxonomies .Page.Type }}
{{ range $taxonomies }} {{ range $taxonomies }}

File diff suppressed because one or more lines are too long

View file

@ -1 +0,0 @@
{"Target":"book.min.309b7ed028807cdb68d8d61e26d609f48369c098dbf5e4d8c0dcf4cdf49feafc.css","MediaType":"text/css","Data":{"Integrity":"sha256-MJt+0CiAfNto2NYeJtYJ9INpwJjb9eTYwNz0zfSf6vw="}}

42
static/flexsearch.min.js vendored Normal file
View file

@ -0,0 +1,42 @@
/*
FlexSearch v0.6.30
Copyright 2019 Nextapps GmbH
Author: Thomas Wilkerling
Released under the Apache 2.0 Licence
https://github.com/nextapps-de/flexsearch
*/
'use strict';(function(K,R,w){let L;(L=w.define)&&L.amd?L([],function(){return R}):(L=w.modules)?L[K.toLowerCase()]=R:"object"===typeof exports?module.exports=R:w[K]=R})("FlexSearch",function ma(K){function w(a,c){const b=c?c.id:a&&a.id;this.id=b||0===b?b:na++;this.init(a,c);fa(this,"index",function(){return this.a?Object.keys(this.a.index[this.a.keys[0]].c):Object.keys(this.c)});fa(this,"length",function(){return this.index.length})}function L(a,c,b,d){this.u!==this.g&&(this.o=this.o.concat(b),this.u++,
d&&this.o.length>=d&&(this.u=this.g),this.u===this.g&&(this.cache&&this.j.set(c,this.o),this.F&&this.F(this.o)));return this}function S(a){const c=B();for(const b in a)if(a.hasOwnProperty(b)){const d=a[b];F(d)?c[b]=d.slice(0):G(d)?c[b]=S(d):c[b]=d}return c}function W(a,c){const b=a.length,d=O(c),e=[];for(let f=0,h=0;f<b;f++){const g=a[f];if(d&&c(g)||!d&&!c[g])e[h++]=g}return e}function P(a,c,b,d,e,f,h,g,k,l){b=ha(b,h?0:e,g,f,c,k,l);let p;g&&(g=b.page,p=b.next,b=b.result);if(h)c=this.where(h,null,
e,b);else{c=b;b=this.l;e=c.length;f=Array(e);for(h=0;h<e;h++)f[h]=b[c[h]];c=f}b=c;d&&(O(d)||(M=d.split(":"),1<M.length?d=oa:(M=M[0],d=pa)),b.sort(d));b=T(g,p,b);this.cache&&this.j.set(a,b);return b}function fa(a,c,b){Object.defineProperty(a,c,{get:b})}function r(a){return new RegExp(a,"g")}function Q(a,c){for(let b=0;b<c.length;b+=2)a=a.replace(c[b],c[b+1]);return a}function V(a,c,b,d,e,f,h,g){if(c[b])return c[b];e=e?(g-(h||g/1.5))*f+(h||g/1.5)*e:f;c[b]=e;e>=h&&(a=a[g-(e+.5>>0)],a=a[b]||(a[b]=[]),
a[a.length]=d);return e}function ba(a,c){if(a){const b=Object.keys(a);for(let d=0,e=b.length;d<e;d++){const f=b[d],h=a[f];if(h)for(let g=0,k=h.length;g<k;g++)if(h[g]===c){1===k?delete a[f]:h.splice(g,1);break}else G(h[g])&&ba(h[g],c)}}}function ca(a){let c="",b="";var d="";for(let e=0;e<a.length;e++){const f=a[e];if(f!==b)if(e&&"h"===f){if(d="a"===d||"e"===d||"i"===d||"o"===d||"u"===d||"y"===d,("a"===b||"e"===b||"i"===b||"o"===b||"u"===b||"y"===b)&&d||" "===b)c+=f}else c+=f;d=e===a.length-1?"":a[e+
1];b=f}return c}function qa(a,c){a=a.length-c.length;return 0>a?1:a?-1:0}function pa(a,c){a=a[M];c=c[M];return a<c?-1:a>c?1:0}function oa(a,c){const b=M.length;for(let d=0;d<b;d++)a=a[M[d]],c=c[M[d]];return a<c?-1:a>c?1:0}function T(a,c,b){return a?{page:a,next:c?""+c:null,result:b}:b}function ha(a,c,b,d,e,f,h){let g,k=[];if(!0===b){b="0";var l=""}else l=b&&b.split(":");const p=a.length;if(1<p){const y=B(),t=[];let v,x;var n=0,m;let I;var u=!0;let D,E=0,N,da,X,ea;l&&(2===l.length?(X=l,l=!1):l=ea=
parseInt(l[0],10));if(h){for(v=B();n<p;n++)if("not"===e[n])for(x=a[n],I=x.length,m=0;m<I;m++)v["@"+x[m]]=1;else da=n+1;if(C(da))return T(b,g,k);n=0}else N=J(e)&&e;let Y;for(;n<p;n++){const ra=n===(da||p)-1;if(!N||!n)if((m=N||e&&e[n])&&"and"!==m)if("or"===m)Y=!1;else continue;else Y=f=!0;x=a[n];if(I=x.length){if(u)if(D){var q=D.length;for(m=0;m<q;m++){u=D[m];var A="@"+u;h&&v[A]||(y[A]=1,f||(k[E++]=u))}D=null;u=!1}else{D=x;continue}A=!1;for(m=0;m<I;m++){q=x[m];var z="@"+q;const Z=f?y[z]||0:n;if(!(!Z&&
!d||h&&v[z]||!f&&y[z]))if(Z===n){if(ra){if(!ea||--ea<E)if(k[E++]=q,c&&E===c)return T(b,E+(l||0),k)}else y[z]=n+1;A=!0}else d&&(z=t[Z]||(t[Z]=[]),z[z.length]=q)}if(Y&&!A&&!d)break}else if(Y&&!d)return T(b,g,x)}if(D)if(n=D.length,h)for(m=l?parseInt(l,10):0;m<n;m++)a=D[m],v["@"+a]||(k[E++]=a);else k=D;if(d)for(E=k.length,X?(n=parseInt(X[0],10)+1,m=parseInt(X[1],10)+1):(n=t.length,m=0);n--;)if(q=t[n]){for(I=q.length;m<I;m++)if(d=q[m],!h||!v["@"+d])if(k[E++]=d,c&&E===c)return T(b,n+":"+m,k);m=0}}else!p||
e&&"not"===e[0]||(k=a[0],l&&(l=parseInt(l[0],10)));c&&(h=k.length,l&&l>h&&(l=0),l=l||0,g=l+c,g<h?k=k.slice(l,g):(g=0,l&&(k=k.slice(l))));return T(b,g,k)}function J(a){return"string"===typeof a}function F(a){return a.constructor===Array}function O(a){return"function"===typeof a}function G(a){return"object"===typeof a}function C(a){return"undefined"===typeof a}function ia(a){const c=Array(a);for(let b=0;b<a;b++)c[b]=B();return c}function B(){return Object.create(null)}function sa(){let a,c;self.onmessage=
function(b){if(b=b.data)if(b.search){const d=c.search(b.content,b.threshold?{limit:b.limit,threshold:b.threshold,where:b.where}:b.limit);self.postMessage({id:a,content:b.content,limit:b.limit,result:d})}else b.add?c.add(b.id,b.content):b.update?c.update(b.id,b.content):b.remove?c.remove(b.id):b.clear?c.clear():b.info?(b=c.info(),b.worker=a,console.log(b)):b.register&&(a=b.id,b.options.cache=!1,b.options.async=!1,b.options.worker=!1,c=(new Function(b.register.substring(b.register.indexOf("{")+1,b.register.lastIndexOf("}"))))(),
c=new c(b.options))}}function ta(a,c,b,d){a=K("flexsearch","id"+a,sa,function(f){(f=f.data)&&f.result&&d(f.id,f.content,f.result,f.limit,f.where,f.cursor,f.suggest)},c);const e=ma.toString();b.id=c;a.postMessage({register:e,options:b,id:c});return a}const H={encode:"icase",f:"forward",split:/\W+/,cache:!1,async:!1,g:!1,D:!1,a:!1,b:9,threshold:0,depth:0},ja={memory:{encode:"extra",f:"strict",threshold:0,b:1},speed:{encode:"icase",f:"strict",threshold:1,b:3,depth:2},match:{encode:"extra",f:"full",threshold:1,
b:3},score:{encode:"extra",f:"strict",threshold:1,b:9,depth:4},balance:{encode:"balance",f:"strict",threshold:0,b:3,depth:3},fast:{encode:"icase",f:"strict",threshold:8,b:9,depth:1}},aa=[];let na=0;const ka={},la={};w.create=function(a,c){return new w(a,c)};w.registerMatcher=function(a){for(const c in a)a.hasOwnProperty(c)&&aa.push(r(c),a[c]);return this};w.registerEncoder=function(a,c){U[a]=c.bind(U);return this};w.registerLanguage=function(a,c){ka[a]=c.filter;la[a]=c.stemmer;return this};w.encode=
function(a,c){return U[a](c)};w.prototype.init=function(a,c){this.v=[];if(c){var b=c.preset;a=c}else a||(a=H),b=a.preset;c={};J(a)?(c=ja[a],a={}):b&&(c=ja[b]);if(b=a.worker)if("undefined"===typeof Worker)a.worker=!1,this.m=null;else{var d=parseInt(b,10)||4;this.C=-1;this.u=0;this.o=[];this.F=null;this.m=Array(d);for(var e=0;e<d;e++)this.m[e]=ta(this.id,e,a,L.bind(this))}this.f=a.tokenize||c.f||this.f||H.f;this.split=C(b=a.split)?this.split||H.split:J(b)?r(b):b;this.D=a.rtl||this.D||H.D;this.async=
"undefined"===typeof Promise||C(b=a.async)?this.async||H.async:b;this.g=C(b=a.worker)?this.g||H.g:b;this.threshold=C(b=a.threshold)?c.threshold||this.threshold||H.threshold:b;this.b=C(b=a.resolution)?b=c.b||this.b||H.b:b;b<=this.threshold&&(this.b=this.threshold+1);this.depth="strict"!==this.f||C(b=a.depth)?c.depth||this.depth||H.depth:b;this.w=(b=C(b=a.encode)?c.encode||H.encode:b)&&U[b]&&U[b].bind(U)||(O(b)?b:this.w||!1);(b=a.matcher)&&this.addMatcher(b);if(b=(c=a.lang)||a.filter){J(b)&&(b=ka[b]);
if(F(b)){d=this.w;e=B();for(var f=0;f<b.length;f++){var h=d?d(b[f]):b[f];e[h]=1}b=e}this.filter=b}if(b=c||a.stemmer){var g;c=J(b)?la[b]:b;d=this.w;e=[];for(g in c)c.hasOwnProperty(g)&&(f=d?d(g):g,e.push(r(f+"($|\\W)"),d?d(c[g]):c[g]));this.stemmer=g=e}this.a=e=(b=a.doc)?S(b):this.a||H.a;this.i=ia(this.b-(this.threshold||0));this.h=B();this.c=B();if(e){this.l=B();a.doc=null;g=e.index={};c=e.keys=[];d=e.field;f=e.tag;h=e.store;F(e.id)||(e.id=e.id.split(":"));if(h){var k=B();if(J(h))k[h]=1;else if(F(h))for(let l=
0;l<h.length;l++)k[h[l]]=1;else G(h)&&(k=h);e.store=k}if(f){this.G=B();h=B();if(d)if(J(d))h[d]=a;else if(F(d))for(k=0;k<d.length;k++)h[d[k]]=a;else G(d)&&(h=d);F(f)||(e.tag=f=[f]);for(d=0;d<f.length;d++)this.G[f[d]]=B();this.I=f;d=h}if(d){let l;F(d)||(G(d)?(l=d,e.field=d=Object.keys(d)):e.field=d=[d]);for(e=0;e<d.length;e++)f=d[e],F(f)||(l&&(a=l[f]),c[e]=f,d[e]=f.split(":")),g[f]=new w(a)}a.doc=b}this.B=!0;this.j=(this.cache=b=C(b=a.cache)?this.cache||H.cache:b)?new ua(b):!1;return this};w.prototype.encode=
function(a){a&&(aa.length&&(a=Q(a,aa)),this.v.length&&(a=Q(a,this.v)),this.w&&(a=this.w(a)),this.stemmer&&(a=Q(a,this.stemmer)));return a};w.prototype.addMatcher=function(a){const c=this.v;for(const b in a)a.hasOwnProperty(b)&&c.push(r(b),a[b]);return this};w.prototype.add=function(a,c,b,d,e){if(this.a&&G(a))return this.A("add",a,c);if(c&&J(c)&&(a||0===a)){var f="@"+a;if(this.c[f]&&!d)return this.update(a,c);if(this.g)return++this.C>=this.m.length&&(this.C=0),this.m[this.C].postMessage({add:!0,id:a,
content:c}),this.c[f]=""+this.C,b&&b(),this;if(!e){if(this.async&&"function"!==typeof importScripts){let t=this;f=new Promise(function(v){setTimeout(function(){t.add(a,c,null,d,!0);t=null;v()})});if(b)f.then(b);else return f;return this}if(b)return this.add(a,c,null,d,!0),b(),this}c=this.encode(c);if(!c.length)return this;b=this.f;e=O(b)?b(c):c.split(this.split);this.filter&&(e=W(e,this.filter));const n=B();n._ctx=B();const m=e.length,u=this.threshold,q=this.depth,A=this.b,z=this.i,y=this.D;for(let t=
0;t<m;t++){var h=e[t];if(h){var g=h.length,k=(y?t+1:m-t)/m,l="";switch(b){case "reverse":case "both":for(var p=g;--p;)l=h[p]+l,V(z,n,l,a,y?1:(g-p)/g,k,u,A-1);l="";case "forward":for(p=0;p<g;p++)l+=h[p],V(z,n,l,a,y?(p+1)/g:1,k,u,A-1);break;case "full":for(p=0;p<g;p++){const v=(y?p+1:g-p)/g;for(let x=g;x>p;x--)l=h.substring(p,x),V(z,n,l,a,v,k,u,A-1)}break;default:if(g=V(z,n,h,a,1,k,u,A-1),q&&1<m&&g>=u)for(g=n._ctx[h]||(n._ctx[h]=B()),h=this.h[h]||(this.h[h]=ia(A-(u||0))),k=t-q,l=t+q+1,0>k&&(k=0),l>
m&&(l=m);k<l;k++)k!==t&&V(h,g,e[k],a,0,A-(k<t?t-k:k-t),u,A-1)}}}this.c[f]=1;this.B=!1}return this};w.prototype.A=function(a,c,b){if(F(c)){var d=c.length;if(d--){for(var e=0;e<d;e++)this.A(a,c[e]);return this.A(a,c[d],b)}}else{var f=this.a.index,h=this.a.keys,g=this.a.tag;e=this.a.store;var k;var l=this.a.id;d=c;for(var p=0;p<l.length;p++)d=d[l[p]];if("remove"===a&&(delete this.l[d],l=h.length,l--)){for(c=0;c<l;c++)f[h[c]].remove(d);return f[h[l]].remove(d,b)}if(g){for(k=0;k<g.length;k++){var n=g[k];
var m=c;l=n.split(":");for(p=0;p<l.length;p++)m=m[l[p]];m="@"+m}k=this.G[n];k=k[m]||(k[m]=[])}l=this.a.field;for(let u=0,q=l.length;u<q;u++){n=l[u];g=c;for(m=0;m<n.length;m++)g=g[n[m]];n=f[h[u]];m="add"===a?n.add:n.update;u===q-1?m.call(n,d,g,b):m.call(n,d,g)}if(e){b=Object.keys(e);a=B();for(f=0;f<b.length;f++)if(h=b[f],e[h]){h=h.split(":");let u,q;for(l=0;l<h.length;l++)g=h[l],u=(u||c)[g],q=(q||a)[g]=u}c=a}k&&(k[k.length]=c);this.l[d]=c}return this};w.prototype.update=function(a,c,b){if(this.a&&
G(a))return this.A("update",a,c);this.c["@"+a]&&J(c)&&(this.remove(a),this.add(a,c,b,!0));return this};w.prototype.remove=function(a,c,b){if(this.a&&G(a))return this.A("remove",a,c);var d="@"+a;if(this.c[d]){if(this.g)return this.m[this.c[d]].postMessage({remove:!0,id:a}),delete this.c[d],c&&c(),this;if(!b){if(this.async&&"function"!==typeof importScripts){let e=this;d=new Promise(function(f){setTimeout(function(){e.remove(a,null,!0);e=null;f()})});if(c)d.then(c);else return d;return this}if(c)return this.remove(a,
null,!0),c(),this}for(c=0;c<this.b-(this.threshold||0);c++)ba(this.i[c],a);this.depth&&ba(this.h,a);delete this.c[d];this.B=!1}return this};let M;w.prototype.search=function(a,c,b,d){if(G(c)){if(F(c))for(var e=0;e<c.length;e++)c[e].query=a;else c.query=a;a=c;c=1E3}else c&&O(c)?(b=c,c=1E3):c||0===c||(c=1E3);if(this.g){this.F=b;this.u=0;this.o=[];for(var f=0;f<this.g;f++)this.m[f].postMessage({search:!0,limit:c,content:a})}else{var h=[],g=a;if(G(a)&&!F(a)){b||(b=a.callback)&&(g.callback=null);var k=
a.sort;var l=a.page;c=a.limit;f=a.threshold;var p=a.suggest;a=a.query}if(this.a){f=this.a.index;const y=g.where;var n=g.bool||"or",m=g.field;let t=n;let v,x;if(m)F(m)||(m=[m]);else if(F(g)){var u=g;m=[];t=[];for(var q=0;q<g.length;q++)d=g[q],e=d.bool||n,m[q]=d.field,t[q]=e,"not"===e?v=!0:"and"===e&&(x=!0)}else m=this.a.keys;n=m.length;for(q=0;q<n;q++)u&&(g=u[q]),l&&!J(g)&&(g.page=null,g.limit=0),h[q]=f[m[q]].search(g,0);if(b)return b(P.call(this,a,t,h,k,c,p,y,l,x,v));if(this.async){const I=this;return new Promise(function(D){Promise.all(h).then(function(E){D(P.call(I,
a,t,E,k,c,p,y,l,x,v))})})}return P.call(this,a,t,h,k,c,p,y,l,x,v)}f||(f=this.threshold||0);if(!d){if(this.async&&"function"!==typeof importScripts){let y=this;f=new Promise(function(t){setTimeout(function(){t(y.search(g,c,null,!0));y=null})});if(b)f.then(b);else return f;return this}if(b)return b(this.search(g,c,null,!0)),this}if(!a||!J(a))return h;g=a;if(this.cache)if(this.B){if(b=this.j.get(a))return b}else this.j.clear(),this.B=!0;g=this.encode(g);if(!g.length)return h;b=this.f;b=O(b)?b(g):g.split(this.split);
this.filter&&(b=W(b,this.filter));u=b.length;d=!0;e=[];var A=B(),z=0;1<u&&(this.depth&&"strict"===this.f?n=!0:b.sort(qa));if(!n||(q=this.h)){const y=this.b;for(;z<u;z++){let t=b[z];if(t){if(n){if(!m)if(q[t])m=t,A[t]=1;else if(!p)return h;if(p&&z===u-1&&!e.length)n=!1,t=m||t,A[t]=0;else if(!m)continue}if(!A[t]){const v=[];let x=!1,I=0;const D=n?q[m]:this.i;if(D){let E;for(let N=0;N<y-f;N++)if(E=D[N]&&D[N][t])v[I++]=E,x=!0}if(x)m=t,e[e.length]=1<I?v.concat.apply([],v):v[0];else if(!p){d=!1;break}A[t]=
1}}}}else d=!1;d&&(h=ha(e,c,l,p));this.cache&&this.j.set(a,h);return h}};w.prototype.find=function(a,c){return this.where(a,c,1)[0]||null};w.prototype.where=function(a,c,b,d){const e=this.l,f=[];let h=0;let g;var k;let l;if(G(a)){b||(b=c);var p=Object.keys(a);var n=p.length;g=!1;if(1===n&&"id"===p[0])return[e[a.id]];if((k=this.I)&&!d)for(var m=0;m<k.length;m++){var u=k[m],q=a[u];if(!C(q)){l=this.G[u]["@"+q];if(0===--n)return l;p.splice(p.indexOf(u),1);delete a[u];break}}k=Array(n);for(m=0;m<n;m++)k[m]=
p[m].split(":")}else{if(O(a)){c=d||Object.keys(e);b=c.length;for(p=0;p<b;p++)n=e[c[p]],a(n)&&(f[h++]=n);return f}if(C(c))return[e[a]];if("id"===a)return[e[c]];p=[a];n=1;k=[a.split(":")];g=!0}d=l||d||Object.keys(e);m=d.length;for(u=0;u<m;u++){q=l?d[u]:e[d[u]];let A=!0;for(let z=0;z<n;z++){g||(c=a[p[z]]);const y=k[z],t=y.length;let v=q;if(1<t)for(let x=0;x<t;x++)v=v[y[x]];else v=v[y[0]];if(v!==c){A=!1;break}}if(A&&(f[h++]=q,b&&h===b))break}return f};w.prototype.info=function(){if(this.g)for(let a=0;a<
this.g;a++)this.m[a].postMessage({info:!0,id:this.id});else return{id:this.id,items:this.length,cache:this.cache&&this.cache.s?this.cache.s.length:!1,matcher:aa.length+(this.v?this.v.length:0),worker:this.g,threshold:this.threshold,depth:this.depth,resolution:this.b,contextual:this.depth&&"strict"===this.f}};w.prototype.clear=function(){return this.destroy().init()};w.prototype.destroy=function(){this.cache&&(this.j.clear(),this.j=null);this.i=this.h=this.c=null;if(this.a){const a=this.a.keys;for(let c=
0;c<a.length;c++)this.a.index[a[c]].destroy();this.a=this.l=null}return this};w.prototype.export=function(a){const c=!a||C(a.serialize)||a.serialize;if(this.a){const d=!a||C(a.doc)||a.doc;var b=!a||C(a.index)||a.index;a=[];let e=0;if(b)for(b=this.a.keys;e<b.length;e++){const f=this.a.index[b[e]];a[e]=[f.i,f.h,Object.keys(f.c)]}d&&(a[e]=this.l)}else a=[this.i,this.h,Object.keys(this.c)];c&&(a=JSON.stringify(a));return a};w.prototype.import=function(a,c){if(!c||C(c.serialize)||c.serialize)a=JSON.parse(a);
const b=B();if(this.a){var d=!c||C(c.doc)||c.doc,e=0;if(!c||C(c.index)||c.index){c=this.a.keys;const h=c.length;for(var f=a[0][2];e<f.length;e++)b[f[e]]=1;for(e=0;e<h;e++){f=this.a.index[c[e]];const g=a[e];g&&(f.i=g[0],f.h=g[1],f.c=b)}}d&&(this.l=G(d)?d:a[e])}else{d=a[2];for(e=0;e<d.length;e++)b[d[e]]=1;this.i=a[0];this.h=a[1];this.c=b}};const va=function(){const a=r("\\s+"),c=r("[^a-z0-9 ]"),b=[r("[-/]")," ",c,"",a," "];return function(d){return ca(Q(d.toLowerCase(),b))}}(),U={icase:function(a){return a.toLowerCase()},
simple:function(){const a=r("\\s+"),c=r("[^a-z0-9 ]"),b=r("[-/]"),d=r("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),e=r("[\u00e8\u00e9\u00ea\u00eb]"),f=r("[\u00ec\u00ed\u00ee\u00ef]"),h=r("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),g=r("[\u00f9\u00fa\u00fb\u00fc\u0171]"),k=r("[\u00fd\u0177\u00ff]"),l=r("\u00f1"),p=r("[\u00e7c]"),n=r("\u00df"),m=r(" & "),u=[d,"a",e,"e",f,"i",h,"o",g,"u",k,"y",l,"n",p,"k",n,"s",m," and ",b," ",c,"",a," "];return function(q){q=Q(q.toLowerCase(),u);return" "===q?"":q}}(),advanced:function(){const a=
r("ae"),c=r("ai"),b=r("ay"),d=r("ey"),e=r("oe"),f=r("ue"),h=r("ie"),g=r("sz"),k=r("zs"),l=r("ck"),p=r("cc"),n=r("sh"),m=r("th"),u=r("dt"),q=r("ph"),A=r("pf"),z=r("ou"),y=r("uo"),t=[a,"a",c,"ei",b,"ei",d,"ei",e,"o",f,"u",h,"i",g,"s",k,"s",n,"s",l,"k",p,"k",m,"t",u,"t",q,"f",A,"f",z,"o",y,"u"];return function(v,x){if(!v)return v;v=this.simple(v);2<v.length&&(v=Q(v,t));x||1<v.length&&(v=ca(v));return v}}(),extra:function(){const a=r("p"),c=r("z"),b=r("[cgq]"),d=r("n"),e=r("d"),f=r("[vw]"),h=r("[aeiouy]"),
g=[a,"b",c,"s",b,"k",d,"m",e,"t",f,"f",h,""];return function(k){if(!k)return k;k=this.advanced(k,!0);if(1<k.length){k=k.split(" ");for(let l=0;l<k.length;l++){const p=k[l];1<p.length&&(k[l]=p[0]+Q(p.substring(1),g))}k=k.join(" ");k=ca(k)}return k}}(),balance:va},ua=function(){function a(c){this.clear();this.H=!0!==c&&c}a.prototype.clear=function(){this.cache=B();this.count=B();this.index=B();this.s=[]};a.prototype.set=function(c,b){if(this.H&&C(this.cache[c])){let d=this.s.length;if(d===this.H){d--;
const e=this.s[d];delete this.cache[e];delete this.count[e];delete this.index[e]}this.index[c]=d;this.s[d]=c;this.count[c]=-1;this.cache[c]=b;this.get(c)}else this.cache[c]=b};a.prototype.get=function(c){const b=this.cache[c];if(this.H&&b){var d=++this.count[c];const f=this.index;let h=f[c];if(0<h){const g=this.s;for(var e=h;this.count[g[--h]]<=d&&-1!==h;);h++;if(h!==e){for(d=e;d>h;d--)e=g[d-1],g[d]=e,f[e]=d;g[h]=c;f[c]=h}}}return b};return a}();return w}(function(){const K={},R="undefined"!==typeof Blob&&
"undefined"!==typeof URL&&URL.createObjectURL;return function(w,L,S,W,P){S=R?URL.createObjectURL(new Blob(["("+S.toString()+")()"],{type:"text/javascript"})):w+".min.js";w+="-"+L;K[w]||(K[w]=[]);K[w][P]=new Worker(S);K[w][P].onmessage=W;return K[w][P]}}()),this);

9
static/fuse.min.js vendored

File diff suppressed because one or more lines are too long

1791
static/mermaid.min.js vendored

File diff suppressed because one or more lines are too long

1
static/svg/backward.svg Normal file
View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"/></svg>

After

Width:  |  Height:  |  Size: 198 B

1
static/svg/forward.svg Normal file
View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"/></svg>

After

Width:  |  Height:  |  Size: 195 B

View file

@ -9,7 +9,7 @@ homepage = "https://github.com/alex-shpak/hugo-book"
demosite = "https://hugo-book-demo.netlify.app" demosite = "https://hugo-book-demo.netlify.app"
tags = ["responsive", "clean", "documentation", "docs", "flexbox", "search", "mobile", "multilingual", "disqus"] tags = ["responsive", "clean", "documentation", "docs", "flexbox", "search", "mobile", "multilingual", "disqus"]
features = [] features = []
min_version = "0.124" min_version = "0.68"
[author] [author]
name = "Alex Shpak" name = "Alex Shpak"