Dothem: allow using Asciidoctor

Junio C Hamano committed Oct 26, 2022 at 10:35 UTC 997a4e139f58f05bac5985f6152ff5024ae0b5e4
1 file changed +26 -5
Dothem
+26 -5
@@ -17,7 +17,7 @@ inst_prefix=$(
17 echo $HOME
18 )
19
20 -force= with_dash= test_long= M= install= nodoc= notest= bootstrap= branches= jobs=
20 +force= with_dash= test_long= M= install= doc= notest= bootstrap= branches= jobs=
21 scratch= noprove= memtrash=--memtrash with_cocci= san=
22 while case "$1" in
23 --pedantic | --locale=* | --loose) M="$M $1" ;;
@@ -27,7 +27,9 @@ while case "$1" in
27 --no-cocci) with_cocci= ;;
28 --long) test_long=--long ;;
29 --noinstall) install=noinstall ;;
30 - --nodoc) nodoc=y ;;
30 + --nodoc) doc=no ;;
31 + --asciidoc) doc=asciidoc ;;
32 + --asciidoctor) doc=ascidoctor ;;
33 --notest) notest=y ;;
34 --nomemtrash) memtrash= ;;
35 --memtrash) memtrash=--memtrash ;;
@@ -47,7 +49,25 @@ do
49 shift
50 done
51
50 -sh -c 'asciidoc --version >/dev/null 2>&1' || nodoc=y
52 +if test -n "$doc"
53 +then
54 + : ;# happy with whatever specified
55 +elif sh -c 'asciidoc --version >/dev/null 2>&1'
56 +then
57 + doc=asciidoc
58 +elif sh -c 'asciidoctor --version >/dev/null 2>&1'
59 +then
60 + doc=asciidoctor
61 +else
62 + doc=no
63 +fi
64 +
65 +if test "$doc" = asciidoctor
66 +then
67 + USE_ASCIIDOCTOR=YesPlease
68 +else
69 + USE_ASCIIDOCTOR=
70 +fi
71
72 GIT_TEST_CHAIN_LINT=1
73 export GIT_TEST_CHAIN_LINT
@@ -136,7 +156,8 @@ do
156 vtree=$(git rev-parse --verify "$version^{tree}")
157 rtree=$(git rev-parse --verify "$revision^{tree}")
158 (
139 - skip_test=$notest skip_doc=$nodoc
159 + skip_test=$notest
160 + case "$doc" in no) skip_doc=1 ;; *) skip_doc= ;; esac
161 case "$force" in
162 ?*)
163 ;;
@@ -231,7 +252,7 @@ do
252 if test "$save" = "$(git rev-parse HEAD)"
253 then
254 Meta/Make $M $jobs -- check-docs &&
234 - Meta/Make $M $jobs -- doc &&
255 + Meta/Make $M $jobs -- $USE_ASCIIDOCTOR doc &&
256 Meta/Make $M -- install-man install-html
257 else
258 echo >&2 "Head moved--not installing docs"