Compare commits
61 commits
feature/pr
...
master
Author | SHA1 | Date | |
---|---|---|---|
55b1193ecd | |||
|
7c26d9b8b7 | ||
|
e104a11f42 | ||
|
90eab4a917 | ||
|
ecbe879801 | ||
|
eff55ecd56 | ||
|
1c78b920b0 | ||
|
1c42a96572 | ||
|
f8a0fc4e24 | ||
|
0baec34596 | ||
|
2dffe0bc7a | ||
|
da22a41f60 | ||
|
a8b156250b | ||
|
a111041867 | ||
|
01645fc56d | ||
|
cba1eb611a | ||
|
5e15ddb4f4 | ||
|
2d7ce27f77 | ||
|
118997fa92 | ||
|
14e14f60ae | ||
|
3f1bcccbfb | ||
|
e7155b473a | ||
|
16f6203f90 | ||
|
1cebd589f6 | ||
|
36a7e32815 | ||
|
d86d5e70c7 | ||
|
26fee5551f | ||
|
12de4671e3 | ||
|
9c8210d99b | ||
|
036e037a63 | ||
|
61bb57f32e | ||
|
d5b75f4fb3 | ||
|
3d2bfec186 | ||
|
412f140762 | ||
|
1318a717ed | ||
|
9013a1f457 | ||
|
6e1b44c4c4 | ||
|
6090fddebd | ||
|
317ccae23b | ||
|
c024538604 | ||
|
4ef38f3bbf | ||
|
1852b16d93 | ||
|
c2014a08a5 | ||
|
faede5e749 | ||
|
98d19b8e95 | ||
|
5581ec0845 | ||
|
3a65df3a76 | ||
|
fb0863a27a | ||
|
2f60f0919f | ||
|
2e693816ae | ||
|
c47eb7388a | ||
|
8bb6d7ebec | ||
|
6c3d1e942a | ||
|
9d4916fcc2 | ||
|
f2fb37b1ad | ||
|
d6087bd32d | ||
|
15ef744c94 | ||
|
6aef8ef1c7 | ||
|
a656d711bf | ||
|
0cde2e461d | ||
|
4c1de2b3de |
74 changed files with 1999 additions and 206 deletions
24
.github/workflows/main.yml
vendored
24
.github/workflows/main.yml
vendored
|
@ -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
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
public/
|
||||
exampleSite/public/
|
||||
.DS_Store
|
||||
.hugo_build.lock
|
||||
|
|
63
README.md
63
README.md
|
@ -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 |
|
||||
| --------------------------------- | ----------------------------------------------------------- |
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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}} {
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
if (navigator.serviceWorker) {
|
||||
navigator.serviceWorker.register(
|
||||
"{{ $swJS.RelPermalink }}",
|
||||
{ scope: "{{ "/" | relURL }}" }
|
||||
{ scope: "{{ "./" | relURL }}" }
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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.
|
|
@ -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>
|
15
exampleSite/content.en/docs/shortcodes/section/_index.md
Normal file
15
exampleSite/content.en/docs/shortcodes/section/_index.md
Normal 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 >}}
|
|
@ -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 />
|
|
@ -1,15 +0,0 @@
|
|||
---
|
||||
bookCollapseSection: true
|
||||
---
|
||||
|
||||
# Section
|
||||
|
||||
Section renders pages in section as definition list, using title and description.
|
||||
|
||||
## Example
|
||||
|
||||
```tpl
|
||||
{{</* section */>}}
|
||||
```
|
||||
|
||||
{{<section>}}
|
|
@ -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
|
|
@ -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
|
@ -0,0 +1 @@
|
|||
{"Target":"book.min.309b7ed028807cdb68d8d61e26d609f48369c098dbf5e4d8c0dcf4cdf49feafc.css","MediaType":"text/css","Data":{"Integrity":"sha256-MJt+0CiAfNto2NYeJtYJ9INpwJjb9eTYwNz0zfSf6vw="}}
|
File diff suppressed because one or more lines are too long
|
@ -1 +0,0 @@
|
|||
{"Target":"book.min.8599444fcc48ee6b435b5b62c955ab7d914fa1e2a453df90c4b97cc9769665d1.css","MediaType":"text/css","Data":{"Integrity":"sha256-hZlET8xI7mtDW1tiyVWrfZFPoeKkU9+QxLl8yXaWZdE="}}
|
3
go.mod
Normal file
3
go.mod
Normal file
|
@ -0,0 +1,3 @@
|
|||
module code.lila.network/adoralaura/hugo-book-theme
|
||||
|
||||
go 1.22.2
|
14
i18n/am.yaml
Normal file
14
i18n/am.yaml
Normal 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 }'
|
|
@ -8,7 +8,7 @@
|
|||
translation: Última modificación por
|
||||
|
||||
- id: Expand
|
||||
translation: Expand
|
||||
translation: Expandir
|
||||
|
||||
- id: bookSearchConfig
|
||||
translation: '{ cache: true }'
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
</main>
|
||||
|
||||
{{ partial "docs/inject/body" . }}
|
||||
{{ template "_internal/google_analytics_async.html" . }}
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
@ -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 }}
|
||||
|
|
|
@ -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) -}}
|
||||
|
|
|
@ -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>
|
||||
|
|
1
layouts/partials/docs/html-head-title.html
Normal file
1
layouts/partials/docs/html-head-title.html
Normal file
|
@ -0,0 +1 @@
|
|||
{{ partial "docs/title" . }} | {{ .Site.Title -}}
|
|
@ -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" -}}
|
||||
|
|
|
@ -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 }}
|
||||
|
|
|
@ -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 }}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<nav>
|
||||
{{ partial "docs/brand" . }}
|
||||
{{ partial "docs/search" . }}
|
||||
{{ if .Site.IsMultiLingual }}
|
||||
{{ if hugo.IsMultilingual }}
|
||||
{{ partial "docs/languages" . }}
|
||||
{{ end }}
|
||||
|
||||
|
|
|
@ -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 }}
|
||||
|
|
|
@ -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 }}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{{ define "main" }}
|
||||
<article class="markdown">
|
||||
<article class="markdown book-post">
|
||||
<h1>
|
||||
<a href="{{ .RelPermalink }}">{{ partial "docs/title.html" . }}</a>
|
||||
</h1>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<blockquote class="book-hint {{ .Get 0 }}">
|
||||
{{ .Inner | markdownify }}
|
||||
{{ .Inner | .Page.RenderString }}
|
||||
</blockquote>
|
||||
|
|
1
layouts/shortcodes/html.html
Normal file
1
layouts/shortcodes/html.html
Normal file
|
@ -0,0 +1 @@
|
|||
{{- .Inner -}}
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
{{- $tab.Name -}}
|
||||
</label>
|
||||
<div class="book-tabs-content markdown-inner">
|
||||
{{- .Content | markdownify -}}
|
||||
{{- .Content | $.Page.RenderString -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
</div>
|
||||
|
|
|
@ -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
|
@ -0,0 +1 @@
|
|||
{"Target":"book.min.309b7ed028807cdb68d8d61e26d609f48369c098dbf5e4d8c0dcf4cdf49feafc.css","MediaType":"text/css","Data":{"Integrity":"sha256-MJt+0CiAfNto2NYeJtYJ9INpwJjb9eTYwNz0zfSf6vw="}}
|
42
static/flexsearch.min.js
vendored
42
static/flexsearch.min.js
vendored
|
@ -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
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
1789
static/mermaid.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue