\startenvironment bib

% https://wiki.contextgarden.net/Question_marks_in_bibliography_entries
\def\gobblestop#1#2{#1}
\def\killstop{%
  \aftergroup\gobblestop
  }

\usebtxdefinitions[apa]
\usebtxdataset[../biblio.bib]
\usebtxdataset[../biblio-eigen.bib]
\usebtxdataset[../biblio-web.bib]

\setupbtx[apa:cite][etallimit=2,separator:4={ and }]
\startmode[zwartwit]
\setupbtx[apa:cite][interaction=stop]
\setupbtx[apa:cite:url][interaction=start]
\stopmode
\setupbtx[apa:list][interaction=stop] % interaction in de lijst lijkt stuk te zijn? Dus ik zet het uit
\setupbtxrendering[pagestate=start] % print wel de pagina nummers
%\setupbtxlist[apa][margin=1.75em]

% Remove hte p.s from page list
\startsetups btx:apa:list:page-or-pages
\stopsetups

% No editors, takes up too much space, imo
\starttexdefinition unexpanded btx:apa:editor-in
    \btxdoif {booktitle} {
        \btxlabeltext{In}\btxspace
        \texdefinition{btx:apa:composed-title}{booktitle}\btxperiod
    }
\stoptexdefinition

% Wel interactie in URLs en DOIs
\starttexdefinition unexpanded btx:apa:url
\begingroup
    \setbreakpoints[doi]
    \goto {\hyphenatedurl{\btxflush{url}}} [url(\btxflush{url})]
\endgroup
\stoptexdefinition
\starttexdefinition unexpanded btx:apa:doi
\begingroup
    \setbreakpoints[doi]
    \goto {\hyphenatedurl{doi:\btxflush{doi}}} [url(http://dx.doi.org/\btxflush{doi})]
\endgroup
\stoptexdefinition


% The dblp database ignores Pauls nice a-breve and s-comma
\btxremapauthor [Paul Fiterau{-}Brostean] [Paul Fiterău-Broștean]
\btxremapauthor [Daniela Petrisan] [Daniela Petrișan]

% The \l does not work well, but unicode is fine
\btxremapauthor [Michal Szynwelski] [Michał Szynwelski]
\btxremapauthor [Slawomir Lasota] [Sławomir Lasota]
\btxremapauthor [Eryk Kopczynski] [Eryk Kopczyński]
\btxremapauthor [Mikolaj Bojanczyk] [Mikołaj Bojańczyk]
\btxremapauthor [Szymon Torunczyk] [Szymon Toruńczyk]

% We use the short version, as he does himself
\btxremapauthor [Adenilso da Silva Simão] [Adenilso Simão]


\def\citenp[#1]{\cite[left=,right=][#1]}   % Bla and Foo, 2015
\def\citet[#1]{\cite[authoryears][#1]}     % Bla and Foo (2015)
\def\citep[#1]{\cite[authoryear][#1]}      % (Bla and Foo, 2015)
\def\citeurl[#1]{\cite[alternative=url,left=,right=][#1]} % url

\stopenvironment
