% The only document that takes the indexed route. With bib2gls=false,
% \loadglsdefs reads a TeX file of \newglossaryentry instead of a bib, turns
% \makeglossaries on and leaves the sorting to makeindex: a second program between
% two LaTeX runs, where the other three routes have none or another one.
%
% That route had no coverage at all. It surfaced while the dependencies were being
% cleared out: \makeglossaries hangs on a hook that moved from \AtEndPreamble to
% \AddToHook{begindocument/before}, and no document ever made that hook fire. What
% is read back here is therefore not only the list but also that this document
% really takes this route -- without that it could drift to bib2gls and the test
% would keep passing without measuring anything.
\IfDocumentMetadataTF{}{\DocumentMetadata{}}
\documentclass[12pt,dutch]{article}
\usepackage{babel}
\usepackage[bib2gls=false]{regulatory}

\newcommand\translation[2]{#2}

\hypersetup{pdftitle={Voorbeeld Geindexeerde definities}}

\loadglsdefs{index-defs}

% The name is worked out first and written afterwards: \typeout expands its
% argument and \ifthenelse is not expandable, which blows the run up rather than
% letting it fail on something readable.
\makeatletter
\AtBeginDocument{%
    \ifthenelse{\boolean{regulatory@indexeddefs}}%
        {\def\@indexroute{indexed}}%
        {\def\@indexroute{bib2gls}}%
    \typeout{INDEX route=\@indexroute}%
}
\makeatother

\begin{document}
    \begin{center}
        \Huge Voorbeeld Geindexeerde definities
    \end{center}

    \article{Definities}\label{art:defs}
    \printdefs{Authentieke akte}

    \article{Gebruik}\label{art:gebruik}
    \begin{paras}
        \item \label{lid:onderhands} Een \gls{onderhands} volstaat.
        \item \label{lid:authentiek} Voor de levering is een \gls{authentiek} vereist.
    \end{paras}
\end{document}
