%! Copyright (C) 2014 The Songbook team (www.patacrep.com)
%!
%! This program is free software; you can redistribute it and/or
%! modify it under the terms of the GNU General Public License
%! as published by the Free Software Foundation; either version 2
%! of the License, or (at your option) any later version.
%!
%! This program is distributed in the hope that it will be useful,
%! but WITHOUT ANY WARRANTY; without even the implied warranty of
%! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%! GNU General Public License for more details.
%!
%! You should have received a copy of the GNU General Public License
%! along with this program; if not, write to the Free Software
%! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
%! MA  02110-1301, USA.
%!
%! The latest version of this program can be obtained from
%! https://github.com/patacrep/


(* extends "layout.tex" *)

(* block songbookpackages *)
\usepackage[((booktype)),
            (* for option in bookoptions *)((option)),
            (* endfor *)
            (* for instrument in instruments *)((instrument)),
            (* endfor *)]{SongbookUtils}
(* endblock *)

(* block songbookpreambule *)
   (( super() ))

   (* for lang in content.languages() *)
   \PassOptionsToPackage{((lang))}{babel}
   (* endfor *)
   \usepackage[((lang))]{babel}
   \lang{((lang))}

   \usepackage{graphicx}
   \graphicspath{{((datadir))/img/}}

   \makeatletter
   \@ifpackageloaded{hyperref}{}{\newcommand{\phantomsection}{}}
   \makeatother
(* endblock *)

(* block songs *)
   \phantomsection
   \addcontentsline{toc}{section}{\songlistname}

   \begin{songs}{((indexes|default('')))}
      (* for type, elem in content.content *)
      (* if type=="song" *)
        \input{((elem.path))}
      (* elif type=="section" *)
        \end{songs}
        \songsection{((elem))}
        \begin{songs}{((indexes|default('')))}
      (* endif *)
      (* endfor *)
   \end{songs}
(* endblock *)
