<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>{{ book.title }} | {{ chapter.front.title }}</title>
        <link rel="stylesheet" href="../style.css" type="text/css" media="all" />
        <link rel="shortcut icon" href="../favicon.ico" />
        <meta property="og:title" content="{{ book.title }}" />
        <meta property="og:site_name" content="{{ book.title }}" />
        <meta property="og:type" content="book" />
        <meta property="og:url" content="{{ book.url|safe }}/{{ chapter.front.url|safe }}" />
        {#<meta property="og:description" content="{{ book.description }}" />#}
        <meta property="book:author" content="{{ book.author }}" />
        <meta property="book:release_date" content="{{ book.pubdate|rfc3339_utc }}" />
        {% if include_katex_css %}<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css" integrity="sha384-zB1R0rpPzHqg7Kpt0Aljp8JPLqbXI3bhnPWROx27a9N0Ll6ZP/+DiW/UqRcLbRjq" crossorigin="anonymous">{% endif %}
    </head>
    <body>
        <nav class="big">
            <header>
                <h1><a href="../index.html">{{ book.title }}</a></h1>
                <h2>by {{ book.author }}</h2>
            </header>
            <ol>
                {% for chap in chapters %}
                <li>
                    <a href="../{{ chap.front.url|safe }}"{% if chapter.front.url == chap.front.url %} class = "current"{% endif %}>{{ chap.front.title }}</a>
                    {% if chap.sections.len() > 0 %}
                    <ol>
                        {% for section in chap.sections %}
                        <li><a href="../{{ section.front.url|safe }}"{% if chapter.front.url == section.front.url %} class = "current"{% endif %}>{{ section.front.title }}</a></li>
                        {% endfor %}
                    </ol>
                    {% endif %}
                </li>
                {% endfor %}
            </ol>
        </nav>
        <nav class="small">
            <span>
                <a href="../index.html" alt="Table of Contents">
                    <span class="icon">
                        <svg class="icon-list-ol">
                            <use xlink:href="../icons.svg#icon-list-ol">
                        </svg>
                    </span>
                </a>
                {% match prev_chapter %}
                    {% when Some with (chap) %}
                    <a href="../{{ chap.front.url }}" alt="{{ chap.front.title }}">
                        <span class="icon">
                            {% if chapter.sections.len() > 0 && chapter.front.url.ends_with("index.html") %}
                            <svg class="icon-arrow-up">
                                <use xlink:href="../icons.svg#icon-arrow-up">
                            </svg>
                            {% else %}
                            <svg class="icon-arrow-left">
                                <use xlink:href="../icons.svg#icon-arrow-left">
                            </svg>
                            {% endif %}
                        </span>
                    </a>
                    {% when None %}
                    <span class="placeholder"></span>
                {% endmatch %}
            </span>
            <span class="title">{{ chapter.front.title }}</span>
            <span>
                <span class="placeholder"></span>
                {% match next_chapter %}
                    {% when Some with (chapter) %}
                    <a href="../{{ chapter.front.url }}" alt="{{ chapter.front.title }}">
                        <span class="icon">
                            <svg class="icon-arrow-right">
                                <use xlink:href="../icons.svg#icon-arrow-right">
                            </svg>
                        </span>
                    </a>
                    {% when None %}
                    <span class="placeholder"></span>
                {% endmatch %}
            </span>
        </nav>
        <article>
            {{ content|safe }}
            {% match next_chapter %}
            {% when Some with (chapter) %}
            <div class="next-chapter">
                <a href="../{{ chapter.front.url }}">
                    <span>Next chapter: “{{ chapter.front.title }}”</span>
                    <span class="icon">
                        <svg class="icon-arrow-right">
                            <use xlink:href="../icons.svg#icon-arrow-right">
                        </svg>
                    </span>
                </a>
            </div>
            {% when None %}
        {% endmatch %}
        <footer><p>&copy; {{ book.pubdate|year }} {{ book.author }}</p></footer>
        </article>
        {% if include_reload_script %}
        {% include "reload.html" %}
        {% endif %}
    </body>
</html>