From ffa527b440f671a4fca2f4d6dbf313bbcb0eb53b Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 17 Jan 2024 19:43:05 -0500 Subject: [PATCH] xtask: Use mandown, not pandoc I forgot that this direction of things is used when we're making a default tarball, and we didn't currently depend on pandoc there. Let's use this `mandown` crate instead which definitely does the trick. Signed-off-by: Colin Walters --- xtask/Cargo.toml | 1 + xtask/src/xtask.rs | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index b7c59d2c0..7e0d66437 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -17,4 +17,5 @@ camino = "1.0" chrono = { version = "0.4.23", default_features = false, features = ["std"] } fn-error-context = "0.2.0" tempfile = "3.3" +mandown = "0.1" xshell = { version = "0.2" } diff --git a/xtask/src/xtask.rs b/xtask/src/xtask.rs index 00bb0681b..cf0126431 100644 --- a/xtask/src/xtask.rs +++ b/xtask/src/xtask.rs @@ -104,11 +104,12 @@ fn manpages(sh: &Shell) -> Result<()> { .file_stem() .and_then(|name| name.to_str()) .ok_or_else(|| anyhow!("Expected filename in {srcpath:?}"))?; - cmd!( - sh, - "pandoc -s --from=markdown --to=man --output=target/man/{base_filename}.5 {srcpath}" - ) - .run()?; + let src = + std::fs::read_to_string(&srcpath).with_context(|| format!("Reading {srcpath:?}"))?; + let section = 5; + let buf = mandown::convert(&src, base_filename, section); + let target = format!("target/man/{base_filename}.{section}"); + std::fs::write(&target, buf).with_context(|| format!("Writing {target}"))?; } Ok(()) }