Skip to content

Commit efcfdec

Browse files
do man page translation outside of mdbook
1 parent af89757 commit efcfdec

File tree

8 files changed

+92
-31
lines changed

8 files changed

+92
-31
lines changed

.github/workflows/mdbook.yml

+10-15
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,12 @@ jobs:
3232
build:
3333
runs-on: ubuntu-latest
3434
env:
35-
MDBOOK_VERSION: 0.4.30
35+
MDBOOK_VERSION: 0.4.45
36+
MDBOOK_ADMONISH_VERSION: 1.19.0 # need to re-run mdbook-admonish install if updating version
3637
steps:
3738
- uses: actions/checkout@v4
38-
- name: Install mdBook and mdbook-cmdrun
39-
run: |
40-
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf -y | sh
41-
rustup update
42-
cargo install --version ${MDBOOK_VERSION} mdbook --locked
43-
cargo install --git https://github.com/tomeichlersmith/mdbook-cmdrun --branch 18-check-exit-status mdbook-cmdrun --locked
44-
- name: Install aha
45-
run: sudo apt install aha
46-
- name: Check Necessities
47-
run: |
48-
aha --version
49-
ul --version
50-
man --version
51-
mdbook --version
39+
- name: Install mdBook
40+
run: ./ci/install-mdbook
5241
- name: Setup Pages
5342
id: pages
5443
uses: actions/configure-pages@v5
@@ -57,6 +46,12 @@ jobs:
5746
working-directory: docs
5847
- name: Copy install script to website
5948
run: cp install uninstall ./docs/book/
49+
- name: Check Links
50+
id: lychee
51+
uses: lycheeverse/lychee-action@v2
52+
with:
53+
fail: true
54+
args: ./docs/book
6055
- name: Upload artifact
6156
uses: actions/upload-pages-artifact@v3
6257
with:

ci/build-docs

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/sh
2+
# build the docs website
3+
# DEPENDENCIES
4+
# mdbook
5+
# man
6+
# ul
7+
# aha
8+
9+
set -o nounset
10+
set -o errexit
11+
12+
# convert a man page into a corresponding html page
13+
#
14+
# We use the '.md' suffix rather than '.html' so that mdbook still
15+
# processes the html into its own style with the side bar and header.
16+
mkdir -p docs/src/manual
17+
for man_page in man/man1/*; do
18+
page_name="$(basename "${man_page}")"
19+
output_file="docs/src/manual/${page_name}.md"
20+
echo "<pre>" > "${output_file}"
21+
MAN_KEEP_FORMATTING=1 COLUMNS=80 man "${man_page}" | ul | aha --no-header >> "${output_file}"
22+
echo "</pre>" >> "${output_file}"
23+
done
24+
25+
cd docs
26+
mdbook build

ci/install-mdbook

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/sh
2+
3+
set -o errexit
4+
set -o nounset
5+
6+
# Assume the environment variables MDBOOK_VERSION and MDBOOK_ADMONISH_VERSION are set
7+
8+
# Download a tar ball and then unpack it into a destination
9+
# Arguments
10+
# 1 - URL for the .tar.gz to download
11+
# 2 - target directory to unpack into
12+
download() {
13+
wget -q -O - "${1}" | tar -xz --directory "${2}"
14+
}
15+
16+
help() {
17+
cat <<\HELP
18+
19+
USAGE:
20+
./.github/install-mdbook [target]
21+
22+
ARGUMENTS:
23+
target : directory to download mdbook and mdbook-admonish into
24+
25+
ENVIRONMENT:
26+
We assume that MDBOOK_VERSION and MDBOOK_ADMONISH_VERSION are set
27+
to the desired versions like how it is done in the CI workflow.
28+
29+
HELP
30+
}
31+
32+
target="${HOME}/.local/bin"
33+
while [ "${#}" -gt 0 ]; do
34+
case "${1}" in
35+
-h|--help)
36+
help
37+
exit 0
38+
;;
39+
*)
40+
target="${1}"
41+
;;
42+
esac
43+
shift
44+
done
45+
46+
mkdir -p "${target}"
47+
download \
48+
https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz \
49+
"${target}"
50+
download \
51+
https://github.com/tommilligan/mdbook-admonish/releases/download/v${MDBOOK_ADMONISH_VERSION}/mdbook-admonish-v${MDBOOK_ADMONISH_VERSION}-x86_64-unknown-linux-gnu.tar.gz \
52+
"${target}"

docs/src/SUMMARY.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
- [Sidebar on Operating Systems](./os-sidebar.md)
99
- [Tuning the denv](./tune.md)
1010
- [Command Reference Manual](./manual.md)
11-
- [denv](./manual/denv.md)
12-
- [denv-init](./manual/denv-init.md)
13-
- [denv-config](./manual/denv-config.md)
14-
- [denv-check](./manual/denv-check.md)
11+
- [denv](./manual/denv.1.md)
12+
- [denv-init](./manual/denv-init.1.md)
13+
- [denv-config](./manual/denv-config.1.md)
14+
- [denv-check](./manual/denv-check.1.md)
1515
- [Developing the Environment](./env_dev.md)
1616

1717
# Contributing

docs/src/manual/denv-check.md

-3
This file was deleted.

docs/src/manual/denv-config.md

-3
This file was deleted.

docs/src/manual/denv-init.md

-3
This file was deleted.

docs/src/manual/denv.md

-3
This file was deleted.

0 commit comments

Comments
 (0)