From fa25307791c0e54782b4a1316efb86ae48516998 Mon Sep 17 00:00:00 2001 From: Thomas Hackner Date: Sat, 4 Jul 2026 12:39:36 +0200 Subject: [PATCH] Flatten a multi-line address in the cover-letter footer doc.text breaks on newlines, which stacked the street above the city in the footer contact strip. Split the address on newlines and commas and rejoin as one line. Co-Authored-By: Claude Opus 4.8 --- lib/documents.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/documents.js b/lib/documents.js index e503ab1..7f2c62c 100644 --- a/lib/documents.js +++ b/lib/documents.js @@ -1073,7 +1073,12 @@ function composeLetter(doc, S, dry, cur, { letter, header, job, anlagen, signatu // the reserved bottom margin so it never collides with the body. --- if (!dry) { const parts = []; - if (header.adresse) parts.push(String(header.adresse).replace(/\s*,\s*/g, ', ')); + // Flatten a possibly multi-line address (newlines and/or commas) to one + // line — doc.text breaks on \n, which would stack the street above the city. + if (header.adresse) { + const adr = String(header.adresse).split(/[\n,]/).map((s) => s.trim()).filter(Boolean).join(', '); + if (adr) parts.push(adr); + } if (header.telefon) parts.push(header.telefon); if (header.email) parts.push(header.email); if (parts.length) {