-
-
Notifications
You must be signed in to change notification settings - Fork 595
Expand file tree
/
Copy pathbuild-docs.sh
More file actions
executable file
·67 lines (56 loc) · 1.8 KB
/
Copy pathbuild-docs.sh
File metadata and controls
executable file
·67 lines (56 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env bash
cd "$(dirname "$0")"
source ./script/setup.sh
adoc_site_args=()
while test $# -gt 0; do
case "$1" in
--release)
adoc_site_args+=(--attribute relfilesuffix) # Drop html suffix in links
shift;;
*) echo "Unknown arg $1" > /dev/stderr; exit 1;;
esac
done
./script/install-dep.sh --bundler
rm -rf .site && mkdir .site
rm -rf .man && mkdir .man
cp-docs() {
cp -r ./docs/*.adoc "$1"
cp -r ./docs/assets "$1"
cp -r ./docs/util "$1"
cp -r ./docs/config-examples "$1"
cp ./docs/docinfo-footer.html "$1"
}
build-site() {
cp-docs ./.site
cp ./docs/index.html ./.site
cd .site
# Delete "aerospace " prefifx in synopsis
sed -E -i '' '/tag::synopsis/, /end::synopsis/ s/^(aerospace | {10})//' aerospace*
bundler exec asciidoctor \
"${adoc_site_args[@]}" \
./guide.adoc \
./commands.adoc \
./goodies.adoc
cp goodies.html goodness.html # backwards compatibility
rm -rf ./*.adoc
cd - > /dev/null
git rev-parse HEAD > .site/version.html
if ! test -z "$(git status --porcelain)"; then
echo "git working directory is dirty" >> .site/version.html
fi
}
build-man() {
cp-docs .man
cd .man
bundler exec asciidoctor -b manpage aerospace*.adoc
# Comment by AI:
# gman (the g Dai client) renders bare .~ and /~ as ligatures (~ becomes ˜).
# We use groff's \[ti] escape (which produces a literal tilde) instead.
# Note: escaping .~ in asciidoc via pass:[] doesn't work because asciidoctor
# converts \\ to \(rs) before groff sees the input.
sed -E -i '' 's|\.~|\.\\[ti]|g; s|/~|/\\[ti]|g' aerospace-test.1
rm -rf -- *.adoc
cd - > /dev/null
}
build-site
build-man