\ProvidesPackage{printLiederbuch}

\RequirePackage{liederbuch}
\RequirePackage{hyperref}

%toc @ begin
%\AtBeginDocument{\tableofcontents}

\ExplSyntaxOn


\newcommand{\printLiederbuch}[1]{
\section{#1}
  \fbox
   {
    \begin{tabular}{l l}
    Meta ~ data ~ name & Meta ~ data ~ value ~ \\
    \hline
    \tl_use:N \csuse{liederbuchMeta;#1}
    \end{tabular}
   }%fbox

\csuse{liederbuchBody;#1}
}


\RenewEnviron{Liederbuch}[2][]{
  \gdef\equals{=}
  \global\cslet{liederbuchBody;#2}\BODY
  \tl_set:Nn \l_tmpa_tl { #1 }
  \tl_replace_all:Nnn \l_tmpa_tl { & } { \\ }
  \tl_replace_all:Nnn \l_tmpa_tl { = } { & }
  \global\cslet{liederbuchMeta;#2}\l_tmpa_tl
}


\NewDocumentEnvironment{Lied}{O{}mm +b}
 {
  \subsection{#3\ --\ Variant:\ #2}
  \tl_set:Nn \l_tmpa_tl { #1 }
  \tl_replace_all:Nnn \l_tmpa_tl { & } { \\ }
  \tl_replace_all:Nnn \l_tmpa_tl { = } { & }
  \fbox
   {
    \begin{tabular}{l l}
    Meta ~ data ~ name & Meta ~ data ~ value ~ \\
    \hline
    \tl_use:N \l_tmpa_tl
    \end{tabular}
   }%fbox
  \par#4\par
}{}
\ExplSyntaxOff



