@@ -3,23 +3,29 @@ set -euo pipefail
33
44# ------------------------------------------------------------------------------
55# MANIAC-MC Documentation Build Script
6- # ------------------------------------------------------------------------------
76# 1. Reads the version number from version.txt (repository root)
87# 2. Updates the 'release' variable in Sphinx conf.py
9- # 3. Builds the documentation using the Makefile (Doxygen + Sphinx)
8+ # 3. Builds the documentation using Sphinx
109# ------------------------------------------------------------------------------
1110
1211ROOT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) /.." && pwd) "
1312DOCS_DIR=" $ROOT_DIR /docs"
1413CONF_FILE=" $DOCS_DIR /source/conf.py"
1514VERSION_FILE=" $ROOT_DIR /version.txt"
1615
16+ # --- Step 0: Optional clean ---------------------------------------------------
17+ if [[ " ${1:- } " == " clean" ]]; then
18+ echo " Cleaning build directory..."
19+ rm -rf " $DOCS_DIR /build"
20+ echo " Clean complete."
21+ exit 0
22+ fi
23+
1724# --- Step 1: Read version number ---------------------------------------------
1825if [[ ! -f " $VERSION_FILE " ]]; then
1926 echo " Error: version.txt not found at $VERSION_FILE "
2027 exit 1
2128fi
22-
2329VERSION=$( tr -d ' [:space:]' < " $VERSION_FILE " )
2430echo " Using version: $VERSION "
2531
@@ -28,13 +34,11 @@ if [[ ! -f "$CONF_FILE" ]]; then
2834 echo " Error: conf.py not found at $CONF_FILE "
2935 exit 1
3036fi
31-
3237echo " Updating conf.py with version: $VERSION "
3338sed -i " s/^release = .*/release = '${VERSION} '/" " $CONF_FILE "
3439
3540# --- Step 3: Build documentation ---------------------------------------------
3641cd " $DOCS_DIR "
3742echo " Running 'make html'..."
3843make html
39-
4044echo " Documentation build complete."
0 commit comments