{%- import 'macros.tex' as macros %}
{%- include 'head.tex' %}
{%- include 'titlepage.tex' %}
\tableofcontents
\newpage

{%- for sec_uid in data.sections %}
	{% with section=data.entries[sec_uid] %}
		\section{ {{ sec_uid }}: {{macros.latex_filter(section.heading)}} }
		{%- for req_uid in section.childs %}
			{% with item=data.entries[req_uid] %}
				\subsection{\xspace{}{{ req_uid }}: {{ macros.latex_filter(item.heading) }} }
				{%- if 'description' in item and item.description != '' %}
					{{ macros.latex_filter(item.description) }}
			 		{%- if 'reason' in item and item.reason != '' or 'fitcriterion' in item and item.fitcriterion != ''%}

						\begin{tabu}{lX}
						\toprule
						{%- if 'reason' in item and item.reason != '' %}
							\emph{Reason} & {{ macros.latex_filter(item.reason) }}\\
						{%- endif %}
						{%- if 'fitcriterion' in item and item.fitcriterion != '' %}
							\emph{Fitcriterion} & {{ macros.latex_filter(item.fitcriterion) }}\\
						{%- endif %}
						\bottomrule
						\end{tabu}
					{%- endif %}
		 		{%- endif %}
			{% endwith %}
		{%- endfor %}
	{% endwith %}
{%- endfor %}
{% include 'foot.tex' %}
