From 0bd34a781838f1dd5ec3621bc230d2401f4e74c6 Mon Sep 17 00:00:00 2001 From: Ewout ter Hoeven <15776622+EwoutH@users.noreply.github.com> Date: Sat, 7 Nov 2026 11:29:15 +0100 Subject: [PATCH 1/2] Q-20-2: quote only pandoc's version line in the too-old message The message quoted the whole `pandoc --version` stdout with `{:?}`, so it showed every feature line plus escaped `\r\n` on Windows: pandoc reported version "pandoc.exe 3.5\r\nFeatures: +server +lua\r\n...", which is older than the minimum required version 3.12. It now quotes the first line: pandoc reported version "pandoc.exe 3.5". Co-Authored-By: Claude Opus 5.5 --- .../quarto-core/src/pandoc_filters/version.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/crates/quarto-core/src/pandoc_filters/version.rs b/crates/quarto-core/src/pandoc_filters/version.rs index 7745efa474..055c343338 100644 --- a/crates/quarto-core/src/pandoc_filters/version.rs +++ b/crates/quarto-core/src/pandoc_filters/version.rs @@ -91,6 +91,8 @@ pub fn gate(found: Option<&str>) -> Result<(), DiagnosticMessage> { if at_least(version_str, floor) { Ok(()) } else { + // `pandoc --version` is multi-line; its first line names the version. + let version_str = version_str.lines().next().unwrap_or_default().trim(); Err(DiagnosticMessageBuilder::error("Pandoc Version Too Old") .with_code("Q-20-2") .problem(format!( @@ -143,6 +145,21 @@ mod tests { assert!(gate(Some(PANDOC_PIN)).is_ok()); } + /// The too-old message names the version line pandoc reported, not its + /// whole `--version` stdout (which is multi-line, and CRLF on Windows). + /// + /// Revert hunk: quoting `version_str` whole makes this RED. + #[test] + fn test_gate_too_old_message_shows_only_the_version_line() { + let stdout = "pandoc.exe 3.5\r\nFeatures: +server +lua\r\nScripting engine: Lua 5.4\r\n"; + let err = gate(Some(stdout)).expect_err("3.5 is below the floor"); + let problem = err.problem.as_ref().expect("a problem statement"); + let problem = problem.as_str(); + assert!(problem.contains("\"pandoc.exe 3.5\""), "got: {problem}"); + assert!(!problem.contains("Features"), "got: {problem}"); + assert!(!problem.contains('\r') && !problem.contains("\\r"), "got: {problem}"); + } + /// T7.3: the `None` arm in `gate`, carrying a code distinct from the /// too-old case. /// From 161f94716bdec830196c1810e0ac4ae8ddbbe4dd Mon Sep 17 00:00:00 2001 From: Carlos Scheidegger Date: Sat, 7 Nov 2026 11:37:00 -0600 Subject: [PATCH 2/2] rustfmt: wrap long assert in version.rs test Co-Authored-By: Claude Opus 5.5 --- crates/quarto-core/src/pandoc_filters/version.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/quarto-core/src/pandoc_filters/version.rs b/crates/quarto-core/src/pandoc_filters/version.rs index 055c343338..6bb792807d 100644 --- a/crates/quarto-core/src/pandoc_filters/version.rs +++ b/crates/quarto-core/src/pandoc_filters/version.rs @@ -157,7 +157,10 @@ mod tests { let problem = problem.as_str(); assert!(problem.contains("\"pandoc.exe 3.5\""), "got: {problem}"); assert!(!problem.contains("Features"), "got: {problem}"); - assert!(!problem.contains('\r') && !problem.contains("\\r"), "got: {problem}"); + assert!( + !problem.contains('\r') && !problem.contains("\\r"), + "got: {problem}" + ); } /// T7.3: the `None` arm in `gate`, carrying a code distinct from the