Skip to content

Commit ffa527b

Browse files
committed
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 <[email protected]>
1 parent afb34bd commit ffa527b

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

xtask/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ camino = "1.0"
1717
chrono = { version = "0.4.23", default_features = false, features = ["std"] }
1818
fn-error-context = "0.2.0"
1919
tempfile = "3.3"
20+
mandown = "0.1"
2021
xshell = { version = "0.2" }

xtask/src/xtask.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,12 @@ fn manpages(sh: &Shell) -> Result<()> {
104104
.file_stem()
105105
.and_then(|name| name.to_str())
106106
.ok_or_else(|| anyhow!("Expected filename in {srcpath:?}"))?;
107-
cmd!(
108-
sh,
109-
"pandoc -s --from=markdown --to=man --output=target/man/{base_filename}.5 {srcpath}"
110-
)
111-
.run()?;
107+
let src =
108+
std::fs::read_to_string(&srcpath).with_context(|| format!("Reading {srcpath:?}"))?;
109+
let section = 5;
110+
let buf = mandown::convert(&src, base_filename, section);
111+
let target = format!("target/man/{base_filename}.{section}");
112+
std::fs::write(&target, buf).with_context(|| format!("Writing {target}"))?;
112113
}
113114
Ok(())
114115
}

0 commit comments

Comments
 (0)