Refactor figures to SVG; enhance validation logic

Converts numerous inline TikZ diagrams to external SVG files across the book's content. This improves rendering performance, streamlines figure management, and ensures consistent visual presentation.

Enhances CLI validation by:
- Ignoring cross-reference IDs when checking for multiplication to prevent false positives.
- Stripping inline math spans before currency checks to avoid misinterpreting mathematical expressions as currency.
- Applying hex literal exclusions to pre-processed lines for more accurate validation.

Adds optional Matplotlib import to the plotting module for improved flexibility in environments where the library may not be available.
This commit is contained in:
Vijay Janapa Reddi
2026-03-02 11:59:41 -05:00
parent d21e34ab73
commit e42c8bc4ea
2 changed files with 17 additions and 4 deletions

View File

@@ -3,7 +3,12 @@
# Ensures all generated figures across Vol 1 & 2 share a consistent,
# MIT Press-ready aesthetic.
import matplotlib.pyplot as plt
try:
import matplotlib.pyplot as plt
_matplotlib_available = True
except ImportError:
plt = None
_matplotlib_available = False
# --- Brand & Book Palette ---
COLORS = {