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/numbered = false,
after-song = \songendsection,
disable-measuring,
}
\setchords{
@@ -74,7 +73,9 @@
\tl_new:N \l__sb_mo_tl
\tl_new:N \l__sb_pflb_tl
\tl_new:N \l__sb_num_tl
\tl_new:N \l__sb_songid_tl
\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
% This ensures the TOC reads the PREVIOUS run's data before truncation
@@ -94,10 +95,14 @@
\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:
\stepcounter{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_mo_tl { \songproperty{mundorgel} }
\tl_set:Nx \l__sb_pflb_tl { \songproperty{pfadfinderliederbuch} }
@@ -109,6 +114,11 @@
{ \l__sb_pflb_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
@@ -172,18 +182,13 @@
}%
\endgroup
\vspace{3mm}%
\begingroup\footnotesize
\noindent
\makebox[0.18\textwidth][c]{MO}%
\makebox[0.18\textwidth][c]{PfLB}%
\hfill\par\noindent
\makebox[0.18\textwidth][c]{%
\ifsongproperty{mundorgel}{\songproperty{mundorgel}}{}%
}%
\makebox[0.18\textwidth][c]{%
\ifsongproperty{pfadfinderliederbuch}{\songproperty{pfadfinderliederbuch}}{}%
}%
\hfill
\begingroup\footnotesize\centering
\begin{tabular}{ccc}
MO & PfLB & Liederbuch \\
\ifsongproperty{mundorgel}{\songproperty{mundorgel}}{} &
\ifsongproperty{pfadfinderliederbuch}{\songproperty{pfadfinderliederbuch}}{} &
\thepage
\end{tabular}\par
\endgroup
\newpage
}