%% Chapter Template
%% Auto-generated by ggen from RDF ontology

\chapter{% raw %}{% if chapter_label %}[{{ chapter_short_title }}]{% endif %}{{{ chapter_title }}}{% endraw %}
\label{% raw %}{ch:{{ chapter_id }}}{% endraw %}

{% raw %}{% if chapter_epigraph %}
\epigraph{{{ chapter_epigraph }}}{{{ chapter_epigraph_source }}}
{% endif %}{% endraw %}

% Chapter introduction
{% raw %}{% if chapter_intro %}
{{ chapter_intro }}
{% endif %}{% endraw %}

% Sections
{% raw %}{% for section in sections %}
\section{{{ section.title }}}
\label{sec:{{ section.id }}}

{{ section.content }}

{% if section.subsections %}
{% for subsection in section.subsections %}
\input{subsection-{{ subsection.id }}}
{% endfor %}
{% endif %}

{% endfor %}{% endraw %}

% Chapter summary
{% raw %}{% if chapter_summary %}
\section*{Summary}
\addcontentsline{toc}{section}{Summary}
{{ chapter_summary }}
{% endif %}{% endraw %}

% Chapter exercises (if applicable)
{% raw %}{% if exercises %}
\section*{Exercises}
\addcontentsline{toc}{section}{Exercises}
\begin{enumerate}
{% for exercise in exercises %}
\item {{ exercise.question }}
{% if exercise.hint %}
\textit{Hint:} {{ exercise.hint }}
{% endif %}
{% endfor %}
\end{enumerate}
{% endif %}{% endraw %}
