docs-templates/templates/longtable.tex.jinja

84 lines
2.5 KiB
Django/Jinja

\begin{savenotes}
\sphinxatlongtablestart
\sphinxthistablewithglobalstyle
<% if 'booktabs' in table.styles -%>
\sphinxthistablewithbooktabsstyle
<% endif -%>
<% if 'borderless' in table.styles -%>
\sphinxthistablewithborderlessstyle
<% endif -%>
<% if 'standard' in table.styles -%>
\sphinxthistablewithstandardstyle
<% endif -%>
<% if 'vlines' in table.styles -%>
\sphinxthistablewithvlinesstyle
<% endif -%>
<% if 'novlines' in table.styles -%>
\sphinxthistablewithnovlinesstyle
<% endif -%>
<% if 'colorrows' in table.styles -%>
\sphinxthistablewithcolorrowsstyle
<% endif -%>
<% if 'nocolorrows' in table.styles -%>
\sphinxthistablewithnocolorrowsstyle
<% endif -%>
\makeatletter
<%- if table.align == 'default' %>
\LTleft 0cm
\LTright 0cm
<%- elif table.align == 'center' %>
\LTleft \@totalleftmargin plus1fill
\LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill
<%- elif table.align == 'left' %>
\LTleft \@totalleftmargin
\LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill
<%- elif table.align == 'right' %>
\LTleft \@totalleftmargin plus1fill
\LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax
<%- endif %>
\makeatother
<% set total_width = table.colwidths|sum %>
<% set colspec_parts = [] %>
<% for width in table.colwidths %>
<% set part = '>{{\\raggedright\\arraybackslash}}p{{{:.4f}\\textwidth}}'.format((width * 0.92) / total_width) %>
<% set colspec_parts = colspec_parts.append(part) %>
<% endfor %>
<% set colspec_string = ''.join(colspec_parts) %>
\begin{longtable}{<%= colspec_string %>}
<%- if table.caption -%>
\sphinxthelongtablecaptionisattop
\caption{<%= ''.join(table.caption) %>\strut}<%= labels %>\\*[\sphinxlongtablecapskipadjust]
<% elif labels -%>
\noalign{\phantomsection<%= labels %>}%
<% endif -%>
\sphinxtoprule
<%= ''.join(table.header) -%>
<%- if table.header -%>
\sphinxmidrule
<% endif -%>
\endfirsthead
\multicolumn{<%= table.colcount %>}{c}{\sphinxnorowcolor
\makebox[0pt]{\sphinxtablecontinued{\tablename\ \thetable{} \textendash{} <%= _('continued from previous page') %>}}%
}\\
\sphinxtoprule
<%= ''.join(table.header) -%>
<%- if table.header -%>
\sphinxmidrule
<% endif -%>
\endhead
\sphinxbottomrule
\multicolumn{<%= table.colcount %>}{r}{\sphinxnorowcolor
\makebox[0pt][r]{\sphinxtablecontinued{<%= _('continues on next page') %>}}%
}\\
\endfoot
\endlastfoot
\sphinxtableatstartofbodyhook
<%= ''.join(table.body) -%>
\sphinxbottomrule
\end{longtable}
\sphinxtableafterendhook
\sphinxatlongtableend
\end{savenotes}