diff --git a/docs/Makefile b/docs/Makefile index 79e02f684f5e5b5ded47fd34b49c1e4aa92e0855..374679ad9e64c5440f74cf82e6fee85ac2c7b085 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -51,12 +51,12 @@ html: octez-gen docexes-gen ${MAKE} sphinx # Make all the doc in a single text file -octezdoc.txt: octez-gen docexes-gen +$(BUILDDIR)/octezdoc.txt: $(BUILDDIR)/index.html rm -fr $(BUILDDIRTXT) (echo ':orphan:'; echo ''; cat ../CHANGES.rst) > CHANGES-dev.rst touch CHANGES-dev.rst @$(SPHINXBUILD) --builder text "$(SOURCEDIR)" $(BUILDDIRTXT) $(SPHINXOPTS) - find $(BUILDDIRTXT) -name "*.txt" | xargs cat >$@ + $(SCRIPTSDIR)/octezdoc.sh >$@ # Build the manuals for a given protocol %/octez-client.html: @@ -312,7 +312,7 @@ fmt: black .PHONY: clean clean: - @-rm -Rf "$(BUILDDIR)" linkcheck odoc.log + @-rm -Rf "$(BUILDDIR)" "$(BUILDDIRTXT)" linkcheck odoc.log @-rm -f $(ERRDOCEXE) $(RPCDOCEXE) $(P2PDOCEXE) @-rm -Rf api/errors.rst developer/metrics.csv user/node-config.json alpha/rpc.rst shell/rpc.rst shell/p2p_api.rst user/default-acl.json CHANGES-dev.rst developer/rollup_metrics.csv octezdoc.txt @-rm -Rf api/octez-*.html api/octez-*.txt paris/octez-*.html alpha/octez-*.html quebec/octez-*.html diff --git a/docs/scripts/octezdoc-excludes.txt b/docs/scripts/octezdoc-excludes.txt new file mode 100644 index 0000000000000000000000000000000000000000..d872fbe98ae411944dee91a91cd5850f53253c2d --- /dev/null +++ b/docs/scripts/octezdoc-excludes.txt @@ -0,0 +1,13 @@ +^active/cli-commands.txt +^active/rpc.txt +^api/api-inline.txt +^api/errors.txt +^developer/openmetrics.txt +^developer/rollup_metrics.txt +^shell/p2p_api.txt +^.*/cli-commands.txt +^shell/rpc.txt +^alpha/ +^releases/ +^protocols/ +^developer/merkle-proof-formats/ diff --git a/docs/scripts/octezdoc.sh b/docs/scripts/octezdoc.sh new file mode 100755 index 0000000000000000000000000000000000000000..ed3fcbfcfb476b8e76ff4844cca157a1587da157 --- /dev/null +++ b/docs/scripts/octezdoc.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +# Generate a single-file text version of the documentation usable by bots + +MYDIR="$(dirname "$0")" +BUILDDIR="$MYDIR"/../_build + +# Extract order of pages from the HTML root index, +# then exclude blacklisted pages +grep 'toctree-l\d' "$BUILDDIR"/index.html | + sed 's|^.*href="||; s|.html">.*$|.txt|' | + grep -v -f "$MYDIR"/octezdoc-excludes.txt | + while read -r f; do + cat _build_txt/"$f" + # insert blank line at the end of each file + echo "" + done diff --git a/scripts/ci/doc_publish.sh b/scripts/ci/doc_publish.sh index 8d1c2e335161d909095ae034280c7be616430ede..ef0f17950fb519b166fd3bae1889a953a5161e0b 100755 --- a/scripts/ci/doc_publish.sh +++ b/scripts/ci/doc_publish.sh @@ -5,6 +5,8 @@ set -e cd "${CI_PROJECT_DIR}" || exit 1 if [ "${CI_COMMIT_REF_NAME}" == "master" ]; then + make -C docs _build/octezdoc.txt + git clone --depth 5 git@gitlab.com:"${CI_PROJECT_NAMESPACE}"/"${CI_PROJECT_NAMESPACE}".gitlab.io gitlab.io rsync --recursive --links --perms --delete --exclude=.doctrees --exclude={{main,alpha,zero}net,master}/index.html docs/_build/ gitlab.io/public/ cd gitlab.io || exit 2