\ProvidesPackage{europasscv-bibliography}
  [Additional macros for bibliography support in europasscv]

\RequirePackage{biblatex-ext-tabular}
\RequirePackage{longtable}

\newrobustcmd*{\defecvbibtabulartwocolumn}[5]{%
  \long\csdef{extblxtab@env@#1}{#2}%
  \long\csdef{extblxtab@endenv@#1}{#3}%
  \long\csdef{extblxtab@tabrow@format@#1}{%
    \if@ecvdebug\cellcolor{yellow!25}\fi\anchorlang{#4} & \if@ecvdebug\cellcolor{blue!25}\fi \driver{#5}\\
  }%
}

\defecvbibtabulartwocolumn{bibtabular}
  {\setlength{\LTpre}{\medskipamount}%
   \setlength{\LTpost}{\medskipamount}%
   \renewcommand*{\arraystretch}{1.2}%
\begin{longtable}[t]{@{}R{\ecv@leftcolwidth}@{\hspace{\ecv@colsep}}p{\ecv@rightcolwidth}@{}}}%
  {\end{longtable}}
  {\selectecvfont\printtext[labelalphawidth]{%
        \printfield{labelprefix}%
        \printfield{labelalpha}%
        \printfield{extraalpha}}%
   \printtext[labelnumberwidth]{%
        \printfield{labelprefix}%
        \printfield{labelnumber}}}{\selectecvfont}

\newcommand*{\ecvbibhighlight}[3]{%
  \edef\lastname{#1}%
  \edef\firstname{#2}%
  \edef\firstinit{#3}}
\ecvbibhighlight{}{}{}

% Patch new definitions
\makeatletter
\renewcommand{\mkbibnamegiven}[1]{%
  \begingroup
    \def\bibnamedelima{ }%
    \def\bibnamedelimi{ }%
    \def~{ }%
    \edef\adn@tmp@lastname{\lastname}%
    \edef\adn@tmp@firstname{\firstname}%
    \edef\adn@tmp@firstinit{\firstinit}%
    \edef\adn@tmp@namepartfamily{\namepartfamily}%
    \edef\adn@tmp@namepartgiven{\namepartgiven}%
    \ifboolexpr{ ( test {\ifcsequal{adn@tmp@firstname}{adn@tmp@namepartgiven}} or test {\ifcsequal{adn@tmp@firstinit}{adn@tmp@namepartgiven}} ) and test {\ifcsequal{adn@tmp@lastname}{adn@tmp@namepartfamily}} }
    {\mkbibbold{#1}}
    {#1}%
  \endgroup
}
\makeatother

\renewcommand{\mkbibnamefamily}[1]{%
  \mkbibnamegiven{#1}
}

\endinput
