/ build.sh
build.sh
 1  #!/bin/bash
 2  # build_site.sh - Simple recursive version that excludes docs
 3  mkdir -p docs
 4  
 5  # Copy CSS files to docs root so they're accessible from any subdirectory
 6  find . -name "*.css" -not -path "./docs/*" -exec cp {} docs/ \;
 7  
 8  # Find all .rst files recursively, excluding the docs directory
 9  find . -name "*.rst" -type f -not -path "./docs/*" | while read -r file; do
10      # Calculate relative path and create directory structure
11      rel_path=$(dirname "$file" | sed 's|^\./||')
12  
13      # Skip if rel_path starts with "docs"
14      if [[ "$rel_path" == docs* ]]; then
15          continue
16      fi
17  
18      output_dir="docs/$rel_path"
19      mkdir -p "$output_dir"
20  
21      basename=$(basename "$file" .rst)
22      echo "Converting $file..."
23      rst2html5 \
24          --stylesheet=responsive.css,minimal.css,italic-field-names.css \
25          "$file" "$output_dir/$basename.html" || echo "Error details for $file - check include paths"
26  done
27  
28  echo "Site built in docs/ directory"