Fix TOC page references and song page footer

- Move \label outside dedup guard so it survives the real pass
  (measurement pass labels are discarded inside vbox)
- Song page footer now shows MO/PfLB/Liederbuch table matching TOC
- Fix TEXINPUTS to include output/ for .songtoc file access

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
shahondin1624
2026-04-02 10:23:04 +02:00
parent 692be693e9
commit cae0c52b67

View File

@@ -54,7 +54,6 @@
chorus/named = false, chorus/named = false,
chorus/numbered = false, chorus/numbered = false,
after-song = \songendsection, after-song = \songendsection,
disable-measuring,
} }
\setchords{ \setchords{
@@ -74,7 +73,9 @@
\tl_new:N \l__sb_mo_tl \tl_new:N \l__sb_mo_tl
\tl_new:N \l__sb_pflb_tl \tl_new:N \l__sb_pflb_tl
\tl_new:N \l__sb_num_tl \tl_new:N \l__sb_num_tl
\tl_new:N \l__sb_songid_tl
\bool_new:N \g__sb_toc_opened_bool \bool_new:N \g__sb_toc_opened_bool
\seq_new:N \g__sb_written_seq
% Lazy-open: only truncate the file when first song writes to it % Lazy-open: only truncate the file when first song writes to it
% This ensures the TOC reads the PREVIOUS run's data before truncation % This ensures the TOC reads the PREVIOUS run's data before truncation
@@ -94,10 +95,14 @@
\cs_new_protected:Npn \writesongtoc \cs_new_protected:Npn \writesongtoc
{ {
% Use leadsheets song ID to skip duplicate calls (measurement pass)
\tl_set:NV \l__sb_songid_tl \l_leadsheets_current_song_id_tl
\seq_if_in:NVF \g__sb_written_seq \l__sb_songid_tl
{
\seq_gput_right:NV \g__sb_written_seq \l__sb_songid_tl
\__sb_ensure_toc_open: \__sb_ensure_toc_open:
\stepcounter{songnumber} \stepcounter{songnumber}
\tl_set:Nx \l__sb_num_tl { \int_use:N \c@songnumber } \tl_set:Nx \l__sb_num_tl { \int_use:N \c@songnumber }
\label{song:\tl_use:N \l__sb_num_tl}
\tl_set:Nx \l__sb_title_tl { \songproperty{title} } \tl_set:Nx \l__sb_title_tl { \songproperty{title} }
\tl_set:Nx \l__sb_mo_tl { \songproperty{mundorgel} } \tl_set:Nx \l__sb_mo_tl { \songproperty{mundorgel} }
\tl_set:Nx \l__sb_pflb_tl { \songproperty{pfadfinderliederbuch} } \tl_set:Nx \l__sb_pflb_tl { \songproperty{pfadfinderliederbuch} }
@@ -109,6 +114,11 @@
{ \l__sb_pflb_tl } { \l__sb_pflb_tl }
{ \exp_not:N \pageref { song: \l__sb_num_tl } } { \exp_not:N \pageref { song: \l__sb_num_tl } }
} }
}
% Label MUST be outside guard: measurement pass label is discarded (inside vbox),
% but the real pass label survives and gets written to .aux
\tl_set:Nx \l__sb_num_tl { \int_use:N \c@songnumber }
\label{song:\tl_use:N \l__sb_num_tl}
} }
\ExplSyntaxOff \ExplSyntaxOff
@@ -172,18 +182,13 @@
}% }%
\endgroup \endgroup
\vspace{3mm}% \vspace{3mm}%
\begingroup\footnotesize \begingroup\footnotesize\centering
\noindent \begin{tabular}{ccc}
\makebox[0.18\textwidth][c]{MO}% MO & PfLB & Liederbuch \\
\makebox[0.18\textwidth][c]{PfLB}% \ifsongproperty{mundorgel}{\songproperty{mundorgel}}{} &
\hfill\par\noindent \ifsongproperty{pfadfinderliederbuch}{\songproperty{pfadfinderliederbuch}}{} &
\makebox[0.18\textwidth][c]{% \thepage
\ifsongproperty{mundorgel}{\songproperty{mundorgel}}{}% \end{tabular}\par
}%
\makebox[0.18\textwidth][c]{%
\ifsongproperty{pfadfinderliederbuch}{\songproperty{pfadfinderliederbuch}}{}%
}%
\hfill
\endgroup \endgroup
\newpage \newpage
} }