2022-12-26 17:25:11 +03:00

73 lines
2.0 KiB
Plaintext

---
layout: layout.njk
---
<header>
<h1>
{% if chapter > 0 %}
<sub-title>
Chapter {{ chapter }}
</sub-title>
{% endif %}
{{ title | safe }}
</h1>
{% set prev = search.previousPage(url, "chapter!=undefined", "chapter") %}
{% set next = search.nextPage(url, "chapter!=undefined", "chapter") %}
{% macro nav(show_toc=false) %}
<nav aria-label="Chapters navigation">
<div class="f-row flex-wrap:wrap justify-content:space-between">
{% if prev or part %}
<p>
Previous:
{% if part %}
<a class="italic" href="/book/{{ part_url }}">{{ part }}</a>
{% else %}
<a class="bold" href="{{ prev.data.url }}">{{ prev.data.title | safe }}</a>
{% endif %}
{% endif %}
{% if next %}
<p>
Next:
{% if next.data.part %}
<a class="italic" href="/book/{{ next.data.part_url }}">{{ next.data.part }}</a>
{% else %}
<a class="bold" href="{{ next.data.url }}">{{ next.data.title | safe }}</a>
{% endif %}
{% endif %}
</div>
{% if show_toc %}
<details>
<summary>Contents</summary>
{% macro toc(block) %}
<ul>
{% for sect in block.getSections() %}
<li>
<a href="#{{ sect.getId() }}">{{ sect.getTitle() | safe }}</a>
{{ toc(sect) if sect.getSections().length > 0 }}
</li>
{% endfor %}
</ul>
{% endmacro %}
{{ asciidoc and toc(asciidoc) }}
</details>
{% endif %}
</nav>
{% endmacro %}
{{ nav(show_toc=true) }}
</header>
<main>{{ content | safe }}</main>
<footer>
{{ nav() }}
<p>
{% include "global-footer.njk" %}
</p>
</footer>