#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Slide Generator - Generates HTML slides using design tokens ALL styles MUST use CSS variables from design-tokens.css NO hardcoded colors, fonts, or spacing allowed """ import argparse import json from html import escape from pathlib import Path from datetime import datetime def _e(value, default=''): """HTML-escape a user-supplied value for safe embedding in HTML content.""" return escape(str(value if value is not None else default)) def _safe_url(url, default='#'): """Validate and escape a URL for use in href attributes. Only allows http://, https://, #, and / schemes to prevent javascript: URI injection (CWE-79). """ if url and str(url).strip().lower().startswith(('http://', 'https://', '#', '/')): return escape(str(url), quote=True) return default # Paths SCRIPT_DIR = Path(__file__).parent DATA_DIR = SCRIPT_DIR.parent / "data" TOKENS_CSS = Path(__file__).resolve().parents[4] / "assets" / "design-tokens.css" TOKENS_JSON = Path(__file__).resolve().parents[4] / "assets" / "design-tokens.json" OUTPUT_DIR = Path(__file__).resolve().parents[4] / "assets" / "designs" / "slides" # ============ BRAND-COMPLIANT SLIDE TEMPLATE ============ # ALL values reference CSS variables from design-tokens.css SLIDE_TEMPLATE = '''