mdman: use `cargo build-man` everywhere

This commit is contained in:
Weihang Lo 2023-04-27 14:49:53 +01:00
parent c01bad9b20
commit e3dec38f4b
No known key found for this signature in database
GPG Key ID: D7DBF189825E82E7
4 changed files with 9 additions and 50 deletions

View File

@ -3,24 +3,25 @@
set -e
cd src/doc
cargo_man="src/doc"
mdman_man="crates/mdman/doc"
changes=$(git status --porcelain -- .)
changes=$(git status --porcelain -- $cargo_man $mdman_man)
if [ -n "$changes" ]
then
echo "git directory must be clean before running this script."
exit 1
fi
./build-man.sh
cargo build-man
changes=$(git status --porcelain -- .)
changes=$(git status --porcelain -- $cargo_man $mdman_man)
if [ -n "$changes" ]
then
echo "Detected changes of man pages in src/doc:"
echo "Detected changes of man pages:"
echo "$changes"
echo
echo "Please run './build-man.sh' in the src/doc directory to rebuild the"
echo "man pages, and commit the changes."
echo 'Please run `cargo build-man` to rebuild the man pages'
echo "and commit the changes."
exit 1
fi

View File

@ -1,7 +0,0 @@
#!/bin/bash
set -e
cargo run -- -t md -o doc/out doc/*.md
cargo run -- -t txt -o doc/out doc/*.md
cargo run -- -t man -o doc/out doc/*.md

View File

@ -50,11 +50,7 @@ directory) to three different formats:
3. Plain text (needed for embedded man pages on platforms without man such as
Windows), saved in [`src/doc/man/generated_txt/`](man/generated_txt).
To rebuild the man pages, run the script `build-man.sh` in the `src/doc` directory.
```console
$ ./build-man.sh
```
To rebuild the man pages, run `cargo build-man` inside the workspace.
### SemVer chapter tests

View File

@ -1,31 +0,0 @@
#!/bin/bash
#
# This script builds the Cargo man pages.
#
# The source for the man pages are located in src/doc/man/ in markdown format.
# These also are handlebars templates, see crates/mdman/README.md for details.
#
# The generated man pages are placed in the src/etc/man/ directory. The pages
# are also expanded into markdown (after being expanded by handlebars) and
# saved in the src/doc/src/commands/ directory. These are included in the
# Cargo book, which is converted to HTML by mdbook.
set -e
cd "$(dirname "${BASH_SOURCE[0]}")"
OPTIONS="--url https://doc.rust-lang.org/cargo/commands/ \
--man rustc:1=https://doc.rust-lang.org/rustc/index.html \
--man rustdoc:1=https://doc.rust-lang.org/rustdoc/index.html"
cargo run -p mdman -- \
-t md -o src/commands man/cargo*.md \
$OPTIONS
cargo run -p mdman -- \
-t txt -o man/generated_txt man/cargo*.md \
$OPTIONS
cargo run -p mdman -- \
-t man -o ../etc/man man/cargo*.md \
$OPTIONS