{% macro articles(_articles) %}
    {% for article in _articles %}
        <li class="chapter {% if article.path == file.path and not article.anchor %}active{% endif %}" data-level="{{ article.level }}" {% if article.path %}data-path="{{ article.path|resolveFile }}"{% endif %}>
            {% if article.path %}
                <a href="{{ article.path|resolveFile }}{{ article.anchor }}">
            {% elif article.url %}
                <a target="_blank" href="{{ article.url }}">
            {% else %}
                <span>
            {% endif %}
                    {% if article.level != "0" %}
                        <b>{{ article.level }}.</b>
                    {% endif %}
                    {{ article.title }}
            {% if article.path  or article.url %}
                </a>
            {% else %}
                </span>
            {% endif %}

            {% if article.articles.length > 0 %}
            <ul class="articles">
                {{ articles(article.articles) }}
            </ul>
            {% endif %}
        </li>
    {% endfor %}
{% endmacro %}

<div class="book-summary">
    {% block book_summary %}
    <nav role="navigation">
        <ul class="summary">
            {% for part in summary.parts %}
            {{ articles(part.articles) }}
            <li class="divider"></li>
            {% endfor %}
        </ul>
    </nav>
    {% endblock %}
</div>
