-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automate the generation of api docs toctree
Create a script to generate/update the api docs toctree and run it whenever `make docs-html` is run. Close #126
- Loading branch information
Showing
3 changed files
with
81 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# For each file found by `find`, generate a entry on the toctree in | ||
# `docs/api.rst`. | ||
# | ||
# NOTE: This script should be run from the repository docs directory. That is, | ||
# this script should be run from this script's ../docs directory. | ||
|
||
set -euo pipefail | ||
|
||
# Recreate the api toctree document with its header | ||
cat >"api.rst" <<EOF | ||
API Documentation | ||
================= | ||
This is the Camayoc API documentation. It is mostly auto generated from the | ||
source code. This section of the documentation should be treated as a handy | ||
reference for developers, not a gospel. | ||
.. toctree:: | ||
EOF | ||
|
||
# List every rst file on the toctree | ||
find api -type f -name '*.rst' | sed "s/.rst$//" | sort | while read file_name; do | ||
echo " ${file_name}" >>"api.rst" | ||
done |