Compare commits

...

61 commits

Author SHA1 Message Date
55b1193ecd
try importing via hugo modules 2024-07-12 12:30:17 +02:00
Alex Shpak
7c26d9b8b7 Update minimum hugo version in README 2024-05-18 13:14:20 +02:00
Alex Shpak
e104a11f42 #582, use time.Format for date formatting 2024-05-18 12:48:43 +02:00
Alex Shpak
90eab4a917 #591, hide search field if JS is not enabled 2024-05-18 12:44:13 +02:00
Alex Shpak
ecbe879801 Set minimum hugo version to 0.124 2024-05-18 12:36:23 +02:00
Rajesh Duggal
eff55ecd56
Change "config.toml" to "hugo.toml" in the README.md documentation (#596) 2024-05-18 12:32:29 +02:00
Eitan Adler
1c78b920b0
replace .Site.IsMultiLingual with hugo.IsMultilingual (#609)
# Problem

The warning
```
INFO  deprecated: .Site.IsMultiLingual was deprecated in Hugo v0.124.0
and will be removed in a future release. Use hugo.IsMultilingual
instead.``

shows up

# Solution

Follow the deprecation warning
2024-05-18 12:31:58 +02:00
wenbingzhang
1c42a96572
Replace flexsearch with fusejs (#600)
Co-authored-by: 张文兵 <wenbing@mgtv.com>
2024-05-18 12:29:55 +02:00
Essa Alshammri
f8a0fc4e24
Add direction ltr to pre > code and highlight (#611)
* Add direction ltr to pre > code and highlight
* Add unicode-bidi: embed;
2024-04-13 11:19:59 +02:00
Leo Heitmann Ruiz
0baec34596
Use null alt text when icon is next to action (#610) 2024-04-13 11:18:14 +02:00
Leo Heitmann Ruiz
2dffe0bc7a
Make image path absolute (#593) 2024-03-11 14:12:18 +01:00
Leo Heitmann Ruiz
da22a41f60
Update link to hugo themes (#590) 2024-03-11 14:11:32 +01:00
Alex Shpak
a8b156250b #589, change hugo extended url 2024-03-11 13:42:39 +01:00
Alex Shpak
a111041867 #583, fix katex and mermaid examples with raw html 2024-02-17 18:57:02 +01:00
Alex Shpak
01645fc56d #521: add canonical url to the header 2024-02-17 18:04:57 +01:00
Alex Shpak
cba1eb611a Upgrade mermaidjs to 10.8.0 2024-02-17 17:36:33 +01:00
Andreas Deininger
5e15ddb4f4
Fix typos (#575) 2024-01-10 12:40:24 +01:00
Andreas Deininger
2d7ce27f77
Fix: make use of .Site.Params.BookFavicon (#576) 2024-01-10 12:39:18 +01:00
Alex Shpak
118997fa92 #524: Disable numbered plugin for non-article pages 2023-12-05 00:33:41 +01:00
李宗英
14e14f60ae
fix server worker is blocked (#565)
* fix server worker is blocked

* Also use relURL in manifest

---------

Co-authored-by: Alex Shpak <alex-shpak@users.noreply.github.com>
2023-12-04 22:25:48 +01:00
Alex Shpak
3f1bcccbfb #543, Add summary param for section shortcode 2023-08-08 13:39:20 +02:00
auwsom
e7155b473a
Themes dir correction and peaceiris deploy to GitHub Pages (#506)
* commit

* commit

* remove push to /public

---------

Co-authored-by: Alex Shpak <alex-shpak@users.noreply.github.com>
2023-08-08 13:08:03 +02:00
Alex Shpak
16f6203f90 #455, add BookFavicon parameter 2023-08-08 12:40:46 +02:00
nobu1308
1cebd589f6
Update meta theme-color in html-head.html (#527)
theme-color that works in both light and dark mode
2023-08-08 12:10:07 +02:00
Miguel Pimentel
36a7e32815
Update es.yaml (#547)
Added translation for 'Expand'.
Should be 'Expandir' instead.
2023-08-08 12:09:31 +02:00
Alex Shpak
d86d5e70c7 Reset generated CSS in example site 2023-04-24 15:41:11 +02:00
Alex Shpak
26fee5551f #528: hotfix for search, until we find a reason 2023-04-24 15:40:42 +02:00
Kanematsu Gaku
12de4671e3
Add "word-break" to list. (#534) 2023-04-24 13:07:08 +02:00
Kanematsu Gaku
9c8210d99b
Format CSS (#535) 2023-04-24 13:06:20 +02:00
Kenta Nakase
036e037a63
Update step for creating site from scratch to use content.en path (#508)
Co-authored-by: parroty <parroty@users.noreply.github.com>
Co-authored-by: Alex Shpak <alex-shpak@users.noreply.github.com>
2023-02-13 23:05:05 +01:00
Alex Shpak
61bb57f32e #496, update content folder name in readme 2023-02-13 22:23:42 +01:00
Gerasimos (Makis) Maropoulos
d5b75f4fb3
README.md: fix link path to content.en (#497) 2022-11-11 11:08:54 +01:00
Alex Shpak
3d2bfec186 #445, Upgrade mermaid to 9.2.0 2022-11-03 00:28:15 +01:00
Alex Shpak
412f140762 Bump minimal hugo version to 0.79 2022-11-03 00:11:38 +01:00
Alex Shpak
1318a717ed #441, add menu.params.class support 2022-11-02 23:42:10 +01:00
Alex Shpak
9013a1f457 #352: move english content to content.en 2022-11-02 23:28:30 +01:00
Alex Shpak
6e1b44c4c4 #452: Put double comments on shortcodes 2022-11-02 23:09:40 +01:00
Mikey Lombardi (He/Him)
6090fddebd
(MAINT) Respect LinkTitle in page metadata (#483)
Prior to this commit, the partial for determining a page title used the
`Title` property of a page, if present, or humanized and titleized the
file name if not.

It did not use the `LinkTitle` property at all (defined in the
[front matter][01]). According to the [menu documentation][02]:

> The following order is used to determine an Identifier:
>
> `.Name > .LinkTitle > .Title`
>
> This means that `.Title` will be used unless `.LinkTitle is present,
> etc.

Similar, the documentation for [menu entry variables][03] states:

> The `name` key, if set for the menu entry, sets this value. If that
> key is not set, and if the menu entry is set in a page front-matter,
> this value defaults to the page's `.LinkTitle`.

Together, these imply that if `.LinkTitle` is specified, it should be
preferred over `.Title` for the generated nav menu.

[01]: https://gohugo.io/content-management/front-matter/
[02]: https://gohugo.io/content-management/menus/#nesting
[03]: https://gohugo.io/variables/menus/#menu-entry-variables
2022-10-05 10:01:03 +02:00
Dongliang Yin
317ccae23b
Remove left pagination spacing (#467) 2022-08-02 12:57:40 +02:00
Alexander Danilov
c024538604
Ignore code block clicks with active selection (#448) 2022-07-04 08:55:54 +02:00
Alex Shpak
4ef38f3bbf Add .hugo_build.lock to .gitignore 2022-04-26 13:43:10 +02:00
Alex Shpak
1852b16d93 #440L Adjust bookHref, check .Content again, add redirect 2022-04-26 13:14:22 +02:00
Horea Christian
c2014a08a5
Add BookHref, set explicit URL for the menu (#440) 2022-04-26 13:10:39 +02:00
Leone G
faede5e749
Add Amharic language translations (#444) 2022-04-26 11:35:50 +02:00
Giuseppe Masino
98d19b8e95
Make menu entries' link relative (#421)
This change allows hugo to build pages correcly when
`canonifyURLs = false` and `relativeURLs = true`.
Otherwise the links on the menu will be canonicalized regardless of
configuration.
This results in broken sites in a number of situations, such as sites
served behind a reverse-proxy that don't want to account for the prefix
they're served under.
2022-02-18 17:35:02 +01:00
Andreas Deininger
5581ec0845
REDAME: Katex to KaTeX (#416) 2022-02-14 15:44:11 +01:00
Alex Shpak
3a65df3a76 #408, #410: Use LanguageCode in templates if specified 2022-01-13 19:20:02 +01:00
shawn.ye
fb0863a27a
Prevent breaked-lines in <p> (#404) 2022-01-13 16:52:03 +01:00
Samuel Redai
2f60f0919f
Updating book to hugo-book in README (#394)
Looks like the path `/book/` in the readme should be `/hugo-book/`.
2021-12-01 10:43:39 +01:00
Alex Shpak
2e693816ae #385: Do not focus search field if current element has value 2021-11-19 14:24:28 +01:00
QIN2DIM
c47eb7388a
Rename theme in readmin to hugo-book (#386)
* Update README.md
* Update README.md

Co-authored-by: Alex Shpak <alex-shpak@users.noreply.github.com>
2021-11-19 13:33:01 +01:00
Alex Shpak
8bb6d7ebec #369, switch to google_analytics.html internal template 2021-10-19 22:05:41 +02:00
Nikolay Raspopov
6c3d1e942a
Removed extra Google Analitics include (#389)
It's already included via "docs/html-head" partial.
2021-10-19 21:56:36 +02:00
Jack Morgan
9d4916fcc2
Allow site title to be customised via parital (#384)
* Allow site title to be customised via parital
* Modify readme to highlight available partials
* Rename template for consistency
* Move title tags to head partial
2021-09-27 09:36:02 +02:00
xhdix
f2fb37b1ad
add color-scheme to head-html (#387) 2021-09-26 21:47:58 +02:00
Alex Shpak
d6087bd32d Add hugo init to install instructions 2021-09-11 21:27:19 +02:00
Alex Shpak
15ef744c94 Rollback flexsearch for now 2021-09-08 23:41:49 +02:00
Michael T Lombardi (He/Him)
6aef8ef1c7
(GH-375) Enable use as a hugo module (#376)
This commit does the minimal work to make the Book theme a functional
hugo module by adding the go.mod file and including instructions in
the project README for use.

Resolves #375
2021-09-07 22:05:33 +02:00
Alex Shpak
a656d711bf Upgrade flexsearch and mermaid 2021-08-30 14:47:27 +02:00
Alex Shpak
0cde2e461d #370: Allow markdown in details shortcode, also change markdownify to RenderString in other shortcodes 2021-08-30 14:32:11 +02:00
Alex Shpak
4c1de2b3de #374: set auto height for images in markdown 2021-08-30 14:15:57 +02:00
74 changed files with 1999 additions and 206 deletions

View file

@ -1,24 +0,0 @@
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,3 +1,4 @@
public/
exampleSite/public/
.DS_Store
.hugo_build.lock

View file

@ -1,12 +1,12 @@
# Hugo Book Theme
[![Hugo](https://img.shields.io/badge/hugo-0.68-blue.svg)](https://gohugo.io)
[![Hugo](https://img.shields.io/badge/hugo-0.124-blue.svg)](https://gohugo.io)
[![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)
### [Hugo](https://gohugo.io) documentation theme as simple as plain book
![Screenshot](https://github.com/alex-shpak/hugo-book/blob/master/images/screenshot.png)
![Screenshot](https://raw.githubusercontent.com/alex-shpak/hugo-book/master/images/screenshot.png)
- [Features](#features)
- [Requirements](#requirements)
@ -33,21 +33,46 @@
## Requirements
- Hugo 0.68 or higher
- Hugo extended version, read more [here](https://gohugo.io/news/0.48-relnotes/)
- Hugo 0.124 or higher
- Hugo extended version, [Installation Instructions](https://gohugo.io/installation/)
## Installation
### Install as git submodule
Navigate to your hugo project root and run:
```
git submodule add https://github.com/alex-shpak/hugo-book themes/book
git submodule add https://github.com/alex-shpak/hugo-book themes/hugo-book
```
Then run hugo (or set `theme = "book"`/`theme: book` in configuration file)
Then run hugo (or set `theme = "hugo-book"`/`theme: hugo-book` in configuration file)
```
hugo server --minify --theme book
hugo server --minify --theme hugo-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
@ -57,12 +82,12 @@ Below is an example on how to create a new site from scratch:
```sh
hugo new site mydocs; cd mydocs
git init
git submodule add https://github.com/alex-shpak/hugo-book themes/book
cp -R themes/book/exampleSite/content .
git submodule add https://github.com/alex-shpak/hugo-book themes/hugo-book
cp -R themes/hugo-book/exampleSite/content.en/* ./content
```
```sh
hugo server --minify --theme book
hugo server --minify --theme hugo-book
```
## Menu
@ -72,7 +97,7 @@ hugo server --minify --theme book
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.
### Leaf bundle menu
### Leaf bundle menu (Deprecated, to be removed in June 2022)
You can also use leaf bundle and the content of its `index.md` file as menu.
Given you have the following file structure:
@ -102,7 +127,7 @@ headless = true
And Enable it by setting `BookMenuBundle: /menu` in Site configuration.
- [Example menu](https://github.com/alex-shpak/hugo-book/blob/master/exampleSite/content/menu/index.md)
- [Example menu](https://github.com/alex-shpak/hugo-book/blob/master/exampleSite/content.en/menu/index.md)
- [Example config file](https://github.com/alex-shpak/hugo-book/blob/master/exampleSite/config.yaml)
- [Leaf bundles](https://gohugo.io/content-management/page-bundles/)
@ -115,7 +140,7 @@ A blog is not the primary usecase of this theme, so it has only minimal features
### Site Configuration
There are a few configuration options that you can add to your `config.toml` file.
There are a few configuration options that you can add to your `hugo.toml` file.
You can also see the `yaml` example [here](https://github.com/alex-shpak/hugo-book/blob/master/exampleSite/config.yaml).
```toml
@ -154,6 +179,7 @@ disableKinds = ['taxonomy', 'taxonomyTerm']
# (Optional, default none) Set leaf bundle to render as side menu
# When not specified file structure and weights will be used
# Deprecated, to be removed in June 2022
BookMenuBundle = '/menu'
# (Optional, default docs) Specify section of content to render as menu
@ -235,13 +261,18 @@ bookComments = true
# (Optional) Set to 'false' to exclude page from search index.
bookSearchExclude = true
# (Optional) Set explicit href attribute for this page in a menu (if BookMenuBundle not set)
bookHref = ''
```
### Partials
There are few empty partials you can override in `layouts/partials/`
There are layout partials available for you to easily override components of the theme in `layouts/partials/`.
| Partial | Placement |
In addition to this, there are several empty partials you can override to easily add/inject code.
| Empty Partial | Placement |
| -------------------------------------------------- | ------------------------------------------- |
| `layouts/partials/docs/inject/head.html` | Before closing `<head>` tag |
| `layouts/partials/docs/inject/body.html` | Before closing `<body>` tag |
@ -265,7 +296,7 @@ There are few empty partials you can override in `layouts/partials/`
### Plugins
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.
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.
| Plugin | Description |
| --------------------------------- | ----------------------------------------------------------- |

View file

@ -69,6 +69,7 @@ ul.pagination {
display: flex;
justify-content: center;
list-style-type: none;
padding-inline-start: 0px;
.page-item a {
padding: $padding-16;

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,9 @@
[
{{- $pages := where .Site.Pages "Kind" "in" (slice "page" "section") -}}
{{- $pages = where $pages "Params.booksearchexclude" "!=" true -}}
{{- $pages = where $pages "Content" "not in" (slice nil "") -}}
{{/* 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" "!=" "" -}}
{{ range $index, $page := $pages }}
{{ if gt $index 0}},{{end}} {

View file

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

View file

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

View file

@ -1,28 +1,35 @@
---
title: KaTeX
---
# KaTeX
KaTeX shortcode let you render math typesetting in markdown document. See [KaTeX](https://katex.org/)
## Example
{{< columns >}}
<div class="book-columns flex flex-wrap">
<div class="flex-even markdown-inner">
```latex
{{</* katex [display] [class="text-center"] */>}}
{{</* katex display=true class="optional" >}}
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 >}}
{{< katex display=true class="optional" >}}
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
{{< /katex >}}
{{< /columns >}}
</div>
</div>
## 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`
{{< katex display >}}
{{< katex display=true >}}
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
{{< /katex >}}
Text continues here.

View file

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

View file

@ -0,0 +1,15 @@
---
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

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

View file

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

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/'
title = 'Hugo Book'
@ -23,7 +23,7 @@ enableGitInfo = true
[languages]
[languages.en]
languageName = 'English'
contentDir = 'content'
contentDir = 'content.en'
weight = 1
[languages.ru]
@ -45,7 +45,7 @@ enableGitInfo = true
[[menu.after]]
name = "Hugo Themes"
url = "https://themes.gohugo.io/hugo-book/"
url = "https://themes.gohugo.io/themes/hugo-book/"
weight = 20
[params]
@ -58,8 +58,12 @@ enableGitInfo = true
# You can also specify this parameter per page in front matter.
BookToC = true
# (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
# (Optional, default favicon.png) Set the path to a favicon file.
# If the favicon is /static/favicon.png then the path would be favicon.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'
# (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/
title: Hugo Book
@ -23,7 +23,7 @@ markup:
languages:
en:
languageName: English
contentDir: content
contentDir: content.en
weight: 1
ru:
languageName: Russian
@ -41,7 +41,7 @@ menu:
url: "https://github.com/alex-shpak/hugo-book"
weight: 10
- name: "Hugo Themes"
url: "https://themes.gohugo.io/hugo-book/"
url: "https://themes.gohugo.io/themes/hugo-book/"
weight: 20
params:
@ -54,8 +54,12 @@ params:
# You can also specify this parameter per page in front matter.
BookToC: true
# (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
# (Optional, default favicon.png) Set the path to a favicon file.
# If the favicon is /static/favicon.png then the path would be favicon.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
# (Optional, default none) Set leaf bundle to render as side menu

File diff suppressed because one or more lines are too long

View file

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

View file

@ -1 +0,0 @@
{"Target":"book.min.8599444fcc48ee6b435b5b62c955ab7d914fa1e2a453df90c4b97cc9769665d1.css","MediaType":"text/css","Data":{"Integrity":"sha256-hZlET8xI7mtDW1tiyVWrfZFPoeKkU9+QxLl8yXaWZdE="}}

3
go.mod Normal file
View file

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

14
i18n/am.yaml Normal file
View file

@ -0,0 +1,14 @@
- 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
- id: Expand
translation: Expand
translation: Expandir
- id: bookSearchConfig
translation: '{ cache: true }'

View file

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

View file

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

View file

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

View file

@ -5,7 +5,7 @@
{{- $date := partial "docs/date" (dict "Date" .GitInfo.AuthorDate.Local "Format" .Site.Params.BookDateFormat) -}}
{{- $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">
<img src="{{ "svg/calendar.svg" | relURL }}" class="book-icon" alt="Calendar" />
<img src="{{ "svg/calendar.svg" | relURL }}" class="book-icon" alt="" />
<span>{{ $date }}</span>
</a>
</div>
@ -14,7 +14,7 @@
{{ 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">
<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>
</a>
</div>

View file

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

View file

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

View file

@ -28,15 +28,19 @@
{{ $current := eq .CurrentPage .Page }}
{{ $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 }} />
<label for="section-{{ md5 .Page }}" class="flex justify-between">
<a {{ if .Page.Content }}href="{{ .Page.Permalink }}"{{ else }}role="button"{{ end }} class="{{ if $current }}active{{ end }}">
<a {{ if .Page.Content }}href="{{ .Page.RelPermalink }}"{{ else }}role="button"{{ end }} class="{{ if $current }}active{{ end }}">
{{- partial "docs/title" .Page -}}
</a>
</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 }}
<a href="{{ .Page.Permalink }}" class="{{ if $current }} active{{ end }}">
<a href="{{ .Page.RelPermalink }}" class="{{ if $current }}active{{ end }}">
{{- partial "docs/title" .Page -}}
</a>
{{ else }}

View file

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

View file

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

View file

@ -1,7 +1,8 @@
{{ if default true .Site.Params.BookSearch }}
<div class="book-search">
<div class="book-search hidden">
<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>
<ul id="book-search-results"></ul>
</div>
<script>document.querySelector(".book-search").classList.remove("hidden")</script>
{{ end }}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

File diff suppressed because one or more lines are too long

View file

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

View file

@ -1,42 +0,0 @@
/*
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 Normal file

File diff suppressed because one or more lines are too long

1789
static/mermaid.min.js vendored

File diff suppressed because one or more lines are too long

View file

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