\JINJA{extends 'inc/document.tex'}
\JINJA{from 'inc/first_page.tex' import render_first_page}
\JINJA{from 'inc/contribution.tex' import render_contribution_condensed}


\JINJA{block document_class}
    \documentclass[a4paper, 11pt, oneside]{book} %% document type
\JINJA{endblock}


\JINJA{block header_extra}
    \usepackage{fancyhdr} %% headers

    \setlength{\headheight}{60pt}
    \pagestyle{fancy}
    \renewcommand{\headrulewidth}{0pt}

    \newenvironment{boa_text}
    {
       \cleardoublepage
       \thispagestyle{empty}
       \vspace*{\stretch{1}}
       \begin{minipage}[t]{0.66\textwidth}
    }%
    {
       \end{minipage}
       \vspace*{\stretch{3}}
       \clearpage
    }
\JINJA{endblock}


\JINJA{block content}
    \setcounter{tocdepth}{0} %% remove table of contents numbering

    %% first page
    \frontmatter
    \JINJA{block first_page}
        \VAR{render_first_page(event, _('Report of Abstracts'), show_dates=true, logo_img=logo_img, url=url, tz=tz)|rawlatex}
    \JINJA{endblock}


    \JINJA{if boa_text}
        \begin{boa_text}
            \thispagestyle{fancy}
            \fancyhead{}
            \vspace{1em}
            \normalsize {
                \rmfamily {
                    \VAR{boa_text|markdown}
                }
            }
            \fancyfoot[C]{\small \rmfamily \color{gray} \VAR{(_('Page {}')|latex(true)).format('\\thepage')|rawlatex }}
        \end{boa_text}
    \JINJA{endif}

    \JINJA{block table_of_contents}
    \JINJA{endblock}


    %% body
    \mainmatter
    \JINJA{block book_body}
        \fancyhead[L]{\small \rmfamily \color{gray} \truncateellipses{\VAR{event.title}}{300pt} / \VAR{_('Report of Abstracts')}}
        \fancyfoot[C]{\small \rmfamily \color{gray} \VAR{(_('Page {}')|latex(true)).format('\\thepage')|rawlatex }}
        \JINJA{for contrib in contribs if contrib.can_access(user)}
            \phantomsection
            \addcontentsline{toc}{chapter}{\VAR{contrib.title}}

            \vspace{3em}
            \VAR{render_contribution_condensed(contrib, affiliation_contribs, corresp_authors)|rawlatex}

        \JINJA{endfor}
    \JINJA{endblock}

    \JINJA{if boa_text_end}
        \begin{boa_text_end}
            \newpage
            \thispagestyle{fancy}
            \fancyhead{}
            \vspace{1em}
            \normalsize {
                \rmfamily {
                    \VAR{boa_text_end|markdown}
                }
            }
            \fancyfoot[C]{\small \rmfamily \color{gray} \VAR{(_('Page {}')|latex(true)).format('\\thepage')|rawlatex }}
        \end{boa_text_end}
    \JINJA{endif}
\JINJA{endblock}

