mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-03-12 02:06:14 -05:00
- Add validate-part-keys hook to .pre-commit-config.yaml - Create validate_part_keys.py script for comprehensive validation - Enhance inject-parts.lua with better error handling and pre-scan - Add documentation for part key validation system - Remove validation from GitHub workflow (moved to pre-commit) - Add utility scripts for key checking and build cleanup This catches invalid part keys before commit rather than in CI/CD
37 lines
971 B
Bash
Executable File
37 lines
971 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Test Lua Error Handling Script
|
|
# This script tests the inject-parts.lua error handling
|
|
|
|
echo "🧪 Testing Lua error handling..."
|
|
|
|
# Create a temporary test file with an invalid key
|
|
cat > test_invalid_key.qmd << 'EOF'
|
|
---
|
|
title: "Test Invalid Key"
|
|
format: pdf
|
|
---
|
|
|
|
# Test
|
|
|
|
\part{key:invalid_key}
|
|
|
|
Content here.
|
|
EOF
|
|
|
|
echo "📄 Created test file with invalid key 'invalid_key'"
|
|
|
|
# Try to render the test file
|
|
echo "🔨 Attempting to render test file..."
|
|
if quarto render test_invalid_key.qmd --to pdf 2>&1 | grep -q "CRITICAL ERROR"; then
|
|
echo "✅ Error handling working correctly - build stopped as expected"
|
|
echo "📋 Error output:"
|
|
quarto render test_invalid_key.qmd --to pdf 2>&1 | grep -A 10 "CRITICAL ERROR"
|
|
else
|
|
echo "❌ Error handling not working - build continued unexpectedly"
|
|
quarto render test_invalid_key.qmd --to pdf 2>&1
|
|
fi
|
|
|
|
# Clean up
|
|
rm -f test_invalid_key.qmd test_invalid_key.pdf
|
|
echo "🧹 Cleaned up test files" |