Skip to content

Commit

Permalink
xtask: Use mandown, not pandoc
Browse files Browse the repository at this point in the history
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 <walters@verbum.org>
  • Loading branch information
cgwalters committed Jan 18, 2024
1 parent afb34bd commit ffa527b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions xtask/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
11 changes: 6 additions & 5 deletions xtask/src/xtask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
Expand Down

0 comments on commit ffa527b

Please sign in to comment.