AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He
feat(template): extract large vector blobs to project icons for readability
hugohe31add19b76255
diff --git a/skills/ppt-master/scripts/README.md b/skills/ppt-master/scripts/README.mdindex 3f72e27b..a51ccee2 100644--- a/skills/ppt-master/scripts/README.md+++ b/skills/ppt-master/scripts/README.md@@ -42,7 +42,7 @@ python3 scripts/update_repo.py|------|-----------------|---------------|| Conversion | `source_to_md/pdf_to_md.py`, `source_to_md/doc_to_md.py`, `source_to_md/excel_to_md.py`, `source_to_md/ppt_to_md.py`, `source_to_md/web_to_md.py` | [docs/conversion.md](./docs/conversion.md) || Project management | `project_manager.py`, `batch_validate.py`, `generate_examples_index.py`, `error_helper.py`, `pptx_template_import.py`, `template_fill_pptx.py` | [docs/project.md](./docs/project.md) |-| SVG pipeline | `finalize_svg.py`, `svg_to_pptx.py`, `total_md_split.py`, `svg_quality_checker.py`, `animation_config.py`, `notes_to_audio.py` | [docs/svg-pipeline.md](./docs/svg-pipeline.md) |+| SVG pipeline | `finalize_svg.py`, `svg_to_pptx.py`, `total_md_split.py`, `svg_quality_checker.py`, `extract_svg_assets.py`, `animation_config.py`, `notes_to_audio.py` | [docs/svg-pipeline.md](./docs/svg-pipeline.md) || Spec maintenance | `update_spec.py` | [docs/update_spec.md](./docs/update_spec.md) || Image tools | `image_gen.py`, `latex_render.py`, `analyze_images.py`, `gemini_watermark_remover.py` | [docs/image.md](./docs/image.md) || Repo maintenance | `update_repo.py` | README install/update section |@@ -91,6 +91,7 @@ python3 scripts/template_fill_pptx.py apply <project_path>/sources/<source.pptx>Post-processing and export:```bash+python3 scripts/extract_svg_assets.py <svg_dir> --icons-dir <icons_dir> --inplace --id-prefix <prefix> # optional: shrink imported/reference SVGs before AI reviewpython3 scripts/total_md_split.py <project_path>python3 scripts/finalize_svg.py <project_path>python3 scripts/svg_to_pptx.py <project_path>diff --git a/skills/ppt-master/scripts/extract_svg_assets.py b/skills/ppt-master/scripts/extract_svg_assets.pynew file mode 100644index 00000000..2f97e09f--- /dev/null+++ b/skills/ppt-master/scripts/extract_svg_assets.py@@ -0,0 +1,601 @@+#!/usr/bin/env python3+"""+PPT Master - Large Vector Asset Extractor++Factor large inline vector groups (complex illustrations) out of working SVGs+into project icon assets, leaving a one-line `<use data-icon="id"/>`+placeholder behind — so the working SVG stays readable (structure, not a wall of+`<path>`). Visually lossless and reversible: the existing icon embedding path+re-inlines each asset before export, so the exported PPTX remains native shapes,+not an embedded picture.++Because re-inlining restores the extracted vector subtree, the detection+threshold is a readability convenience — it changes which blobs are factored+out, not whether the export stays editable.++Usage:+ python3 scripts/extract_svg_assets.py <svg_dir> [--icons-dir <icons_dir>] [--min-drawables N] [--min-bytes N] [--min-decoration-bytes N] [--inplace] [--clean-stale]++Examples:+ python3 scripts/extract_svg_assets.py import_ws/svg --icons-dir import_ws/icons --inplace --id-prefix layered --clean-stale+ python3 scripts/extract_svg_assets.py project/svg_output --inplace --min-drawables 40++Dependencies:+ None (standard library only).++See workflows/create-template.md and svg_finalize/embed_icons.py.+"""++from __future__ import annotations++import argparse+import copy+import json+import re+import sys+from pathlib import Path+from typing import Optional+from xml.etree import ElementTree as ET++SVG_NS = "http://www.w3.org/2000/svg"+DRAWABLE = {"path", "polygon", "polyline", "rect", "circle", "ellipse", "line"}+SEMANTIC_CONTENT = {"text", "tspan", "foreignObject"}+DEFAULT_MIN_DRAWABLES = 20+DEFAULT_MIN_BYTES = 3000+DEFAULT_MIN_DECORATION_BYTES = 3000+URL_REF_RE = re.compile(r"url\(\s*(['\"]?)#([^)'\"]\S*?)\1\s*\)")+++def _local(tag: object) -> str:+ return tag.rsplit("}", 1)[-1] if isinstance(tag, str) else ""+++def _drawable_count(elem: ET.Element) -> int:+ return sum(1 for e in elem.iter() if _local(e.tag) in DRAWABLE)+++def _xml_size(elem: ET.Element) -> int:+ return len(ET.tostring(elem, encoding="utf-8"))+++def _large_enough(elem: ET.Element, min_drawables: int, min_bytes: int) -> bool:+ return _drawable_count(elem) >= min_drawables or _xml_size(elem) >= min_bytes+++def _has_semantic_content(elem: ET.Element) -> bool:+ """Text-bearing groups must stay readable/editable in the working SVG."""+ return any(_local(e.tag) in SEMANTIC_CONTENT for e in elem.iter())+++def _is_existing_placeholder(elem: ET.Element) -> bool:+ return _local(elem.tag) == "use" and elem.get("data-icon") is not None+++def _is_extractable_subtree(elem: ET.Element) -> bool:+ """Pure vector subtrees can be moved; semantic content must stay inline."""+ if _is_existing_placeholder(elem) or _is_chart_group(elem) or _has_semantic_content(elem):+ return False+ return _drawable_count(elem) > 0+++def _is_chart_group(elem: ET.Element) -> bool:+ """Charts are handled separately (data + calibration) — never extract them."""+ gid = (elem.get("id") or "").lower()+ if "chart" in gid:+ return True+ return any("chart" in (e.get("id") or "").lower() for e in elem.iter())+++def _tag_histogram(elem: ET.Element) -> dict[str, int]:+ hist: dict[str, int] = {}+ for e in elem.iter():+ name = _local(e.tag)+ if name in DRAWABLE:+ hist[name] = hist.get(name, 0) + 1+ return hist+++def _is_descendant(container: ET.Element, candidate: ET.Element) -> bool:+ return any(elem is candidate for elem in container.iter())+++def _id_index(root: ET.Element) -> dict[str, ET.Element]:+ return {elem_id: elem for elem in root.iter() if (elem_id := elem.get("id"))}+++def _referenced_ids(elem: ET.Element) -> set[str]:+ refs: set[str] = set()+ for item in elem.iter():+ for attr_name, value in item.attrib.items():+ refs.update(match.group(2) for match in URL_REF_RE.finditer(value))+ if _local(attr_name) == "href" and value.startswith("#") and len(value) > 1:+ refs.add(value[1:])+ return refs+++def _dependency_elements(root: ET.Element, asset_group: ET.Element) -> list[ET.Element]:+ """+ Return external definition elements referenced by the extracted subtree.++ Gradients, patterns, filters, clip paths, and markers often live in the+ source SVG root <defs>. The extracted asset must carry these dependencies+ itself; otherwise the standalone icon and later re-inline can lose styling.+ """+ by_id = _id_index(root)+ dependencies: list[ET.Element] = []+ seen: set[str] = set()+ queue = list(_referenced_ids(asset_group))++ while queue:+ ref_id = queue.pop(0)+ if ref_id in seen:+ continue+ seen.add(ref_id)++ target = by_id.get(ref_id)+ if target is None or _is_descendant(asset_group, target):+ continue++ dependencies.append(target)+ for nested_ref in sorted(_referenced_ids(target)):+ if nested_ref not in seen:+ queue.append(nested_ref)++ return dependencies+++def _collect_id_mapping(asset_id: str, group: ET.Element, dependencies: list[ET.Element]) -> dict[str, str]:+ mapping: dict[str, str] = {}+ for root in [group, *dependencies]:+ for elem in root.iter():+ elem_id = elem.get("id")+ if elem_id and elem_id not in mapping:+ mapping[elem_id] = f"{asset_id}_{elem_id}"+ return mapping+++def _rewrite_references(elem: ET.Element, id_mapping: dict[str, str]) -> None:+ def rewrite_url(match: re.Match[str]) -> str:+ quote, ref_id = match.group(1), match.group(2)+ new_id = id_mapping.get(ref_id, ref_id)+ return f"url({quote}#{new_id}{quote})"++ for item in elem.iter():+ elem_id = item.get("id")+ if elem_id in id_mapping:+ item.set("id", id_mapping[elem_id])++ for attr_name, value in list(item.attrib.items()):+ rewritten = URL_REF_RE.sub(rewrite_url, value)+ if _local(attr_name) == "href" and value.startswith("#") and value[1:] in id_mapping:+ rewritten = f"#{id_mapping[value[1:]]}"+ if rewritten != value:+ item.set(attr_name, rewritten)+++def _find_extractable(root: ET.Element, min_drawables: int, min_bytes: int) -> list[ET.Element]:+ """Outermost <g> groups whose drawable count clears the threshold (no nesting)."""+ found: list[ET.Element] = []++ def walk(elem: ET.Element) -> None:+ for child in list(elem):+ if _local(child.tag) != "g":+ walk(child)+ continue+ if (+ not _is_chart_group(child)+ and not _has_semantic_content(child)+ and child.get("data-icon") is None+ and _large_enough(child, min_drawables, min_bytes)+ ):+ found.append(child) # outermost qualifying — do not descend+ else:+ walk(child)++ walk(root)+ return found+++def _find_extractable_runs(+ root: ET.Element,+ min_drawables: int,+ min_bytes: int,+ min_decoration_bytes: int,+) -> list[tuple[ET.Element, list[ET.Element]]]:+ """+ Consecutive pure-vector children inside mixed groups.++ PPT exports often flatten text and large vector decorations as siblings+ under the same parent. Whole-group extraction would hide text, so only the+ contiguous vector runs are factored out.+ """+ found: list[tuple[ET.Element, list[ET.Element]]] = []++ def flush(parent: ET.Element, run: list[ET.Element]) -> None:+ byte_threshold = min_decoration_bytes if _has_semantic_content(parent) else min_bytes+ if run and (+ sum(_drawable_count(child) for child in run) >= min_drawables+ or sum(_xml_size(child) for child in run) >= byte_threshold+ ):+ found.append((parent, list(run)))++ def walk(elem: ET.Element) -> None:+ run: list[ET.Element] = []+ for child in list(elem):+ if _is_extractable_subtree(child):+ run.append(child)+ continue+ flush(elem, run)+ run = []+ walk(child)+ flush(elem, run)++ walk(root)+ return found+++def _asset_svg(+ group: ET.Element,+ dependencies: list[ET.Element],+ view_box: str | None,+ width: str | None,+ height: str | None,+) -> bytes:+ """Standalone, independently-viewable SVG carrying the group in page coords."""+ svg = ET.Element(f"{{{SVG_NS}}}svg")+ svg.set("data-icon-style", "preserve-color")+ if view_box:+ svg.set("viewBox", view_box)+ if width:+ svg.set("width", width)+ if height:+ svg.set("height", height)+ if dependencies:+ defs = ET.SubElement(svg, f"{{{SVG_NS}}}defs")+ for dependency in dependencies:+ defs.append(dependency)+ svg.append(group)+ return ET.tostring(svg, encoding="utf-8", xml_declaration=True)+++def _asset_group(nodes: list[ET.Element]) -> ET.Element:+ group = ET.Element(f"{{{SVG_NS}}}g")+ for node in nodes:+ group.append(node)+ return group+++def _asset_id(svg_path: Path, index: int, id_prefix: str) -> str:+ prefix = f"{id_prefix}_" if id_prefix else ""+ return f"{prefix}{svg_path.stem}_ill{index:02d}"+++def _generated_asset_re(svg_stems: list[str], id_prefix: str) -> re.Pattern[str] | None:+ if not svg_stems:+ return None+ prefix = f"{re.escape(id_prefix)}_" if id_prefix else ""+ stems = "|".join(re.escape(stem) for stem in svg_stems)+ return re.compile(rf"^{prefix}(?:{stems})_ill\d+\.svg$")+++def _clean_stale_assets(icons_dir: Path, svg_paths: list[Path], id_prefix: str, keep_assets: set[str]) -> list[str]:+ pattern = _generated_asset_re([path.stem for path in svg_paths], id_prefix)+ if pattern is None:+ return []++ removed: list[str] = []+ for asset_path in sorted(icons_dir.glob("*.svg")):+ if asset_path.name in keep_assets or not pattern.match(asset_path.name):+ continue+ asset_path.unlink()+ removed.append(asset_path.name)+ return removed+++def _referenced_icon_assets(svg_paths: list[Path]) -> set[str]:+ assets: set[str] = set()+ for svg_path in svg_paths:+ try:+ root = ET.parse(svg_path).getroot()+ except ET.ParseError:+ continue+ for elem in root.iter():+ if _local(elem.tag) != "use":+ continue+ icon_name = elem.get("data-icon")+ if icon_name and "/" not in icon_name:+ assets.add(f"{icon_name}.svg")+ return assets+++def _existing_placeholder_entries(+ svg_paths: list[Path],+ icons_dir: Path,+ known_assets: set[str],+) -> list[dict]:+ by_asset: dict[str, dict] = {}+ for svg_path in svg_paths:+ try:+ root = ET.parse(svg_path).getroot()+ except ET.ParseError:+ continue++ for elem in root.iter():+ if _local(elem.tag) != "use":+ continue+ icon_name = elem.get("data-icon")+ if not icon_name or "/" in icon_name:+ continue++ asset = f"{icon_name}.svg"+ if asset in known_assets:+ continue++ entry = by_asset.setdefault(+ asset,+ {+ "svg": svg_path.name,+ "svgs": [],+ "id": icon_name,+ "icon": icon_name,+ "asset": asset,+ "source": "existing-placeholder",+ "asset_exists": (icons_dir / asset).exists(),+ },+ )+ if svg_path.name not in entry["svgs"]:+ entry["svgs"].append(svg_path.name)++ entries: list[dict] = []+ for asset, entry in sorted(by_asset.items()):+ asset_path = icons_dir / asset+ if asset_path.exists():+ try:+ root = ET.parse(asset_path).getroot()+ except ET.ParseError:+ pass+ else:+ entry["drawable_count"] = _drawable_count(root)+ entry["byte_count"] = _xml_size(root)+ entry["elements"] = _tag_histogram(root)+ entry["dependencies"] = sorted(+ elem_id+ for elem in root.iter()+ if _local(elem.tag) == "defs"+ for child in elem+ if (elem_id := child.get("id"))+ )+ entries.append(entry)+ return entries+++def _rewritten_path(svg_path: Path, rewritten_dir: Path | None, inplace: bool) -> Path:+ if inplace:+ return svg_path+ if rewritten_dir is None:+ return svg_path.parent.parent / f"{svg_path.parent.name}-rewritten" / svg_path.name+ return rewritten_dir / svg_path.name+++def extract_file(+ svg_path: Path,+ icons_dir: Path,+ min_drawables: int,+ min_bytes: int,+ min_decoration_bytes: int,+ inplace: bool,+ id_prefix: str = "",+ rewritten_dir: Path | None = None,+) -> list[dict]:+ """Extract qualifying groups from one SVG. Returns inventory entries."""+ ET.register_namespace("", SVG_NS)+ tree = ET.parse(svg_path)+ root = tree.getroot()+ view_box = root.get("viewBox")+ width = root.get("width")+ height = root.get("height")++ targets: list[tuple[ET.Element, list[ET.Element]]] = []+ parents = {child: parent for parent in root.iter() for child in parent}+ group_targets = _find_extractable(root, min_drawables, min_bytes)+ selected_groups = set(group_targets)++ def inside_selected_group(elem: ET.Element) -> bool:+ current = elem+ while current in parents:+ current = parents[current]+ if current in selected_groups:+ return True+ return False++ for group in group_targets:+ parent = parents.get(group)+ if parent is not None:+ targets.append((parent, [group]))++ for parent, run in _find_extractable_runs(root, min_drawables, min_bytes, min_decoration_bytes):+ if (+ parent not in selected_groups+ and not inside_selected_group(parent)+ and not any(child in selected_groups for child in run)+ and all(child in parent for child in run)+ ):+ targets.append((parent, run))++ if not targets:+ if not inplace:+ rewritten = _rewritten_path(svg_path, rewritten_dir, inplace)+ rewritten.parent.mkdir(parents=True, exist_ok=True)+ tree.write(rewritten, encoding="utf-8", xml_declaration=True)+ return []++ icons_dir.mkdir(parents=True, exist_ok=True)+ entries = []++ for index, (parent, nodes) in enumerate(targets, start=1):+ if not nodes or not all(node in parent for node in nodes):+ continue+ asset_id = _asset_id(svg_path, index, id_prefix)+ pos = list(parent).index(nodes[0])+ group = nodes[0] if len(nodes) == 1 and _local(nodes[0].tag) == "g" else _asset_group(nodes)++ dependencies = [copy.deepcopy(elem) for elem in _dependency_elements(root, group)]+ dependency_source_ids = sorted({+ elem_id+ for dependency in dependencies+ for elem in dependency.iter()+ if (elem_id := elem.get("id"))+ })+ id_mapping = _collect_id_mapping(asset_id, group, dependencies)+ _rewrite_references(group, id_mapping)+ for dependency in dependencies:+ _rewrite_references(dependency, id_mapping)++ # Asset keeps the group in original page coordinates and carries its defs.+ asset_bytes = _asset_svg(group, dependencies, view_box, width, height)+ (icons_dir / f"{asset_id}.svg").write_bytes(asset_bytes)++ placeholder = ET.Element(f"{{{SVG_NS}}}use")+ placeholder.set("data-icon", asset_id)+ for node in nodes:+ if node in parent:+ parent.remove(node)+ parent.insert(pos, placeholder)++ entries.append({+ "svg": svg_path.name,+ "id": asset_id,+ "icon": asset_id,+ "asset": f"{asset_id}.svg",+ "drawable_count": _drawable_count(group),+ "byte_count": _xml_size(group),+ "dependencies": [id_mapping.get(elem_id, elem_id) for elem_id in dependency_source_ids],+ "elements": _tag_histogram(group),+ })++ rewritten = _rewritten_path(svg_path, rewritten_dir, inplace)+ rewritten.parent.mkdir(parents=True, exist_ok=True)+ tree.write(rewritten, encoding="utf-8", xml_declaration=True)+ return entries+++def build_parser() -> argparse.ArgumentParser:+ parser = argparse.ArgumentParser(+ description="Factor large inline vector groups out of SVGs into reusable assets.",+ formatter_class=argparse.RawDescriptionHelpFormatter,+ )+ parser.add_argument("svg_dir", help="Directory of working SVGs (e.g. import_ws/svg or project/svg_output)")+ parser.add_argument("-o", "--output", dest="icons_dir", help="Project icon dir (default: <svg_dir>/../icons)")+ parser.add_argument("--icons-dir", dest="icons_dir", help="Project icon dir (default: <svg_dir>/../icons)")+ parser.add_argument(+ "--rewritten-dir",+ help="Directory for rewritten SVGs when not using --inplace (default: <svg_dir>/../<svg_dir-name>-rewritten)",+ )+ parser.add_argument(+ "--inventory",+ help="Inventory JSON path (default: <svg_dir>/../<svg_dir-name>_vector_asset_inventory.json)",+ )+ parser.add_argument(+ "--id-prefix",+ default="",+ help="Optional prefix for generated asset IDs, useful when processing layered and flat SVG dirs into one icons dir",+ )+ parser.add_argument(+ "--min-drawables", type=int, default=DEFAULT_MIN_DRAWABLES,+ help=f"Min drawable elements for a group to be extracted (default: {DEFAULT_MIN_DRAWABLES})",+ )+ parser.add_argument(+ "--min-bytes", type=int, default=DEFAULT_MIN_BYTES,+ help=f"Min XML bytes for a pure-vector group/run to be extracted (default: {DEFAULT_MIN_BYTES})",+ )+ parser.add_argument(+ "--min-decoration-bytes", type=int, default=DEFAULT_MIN_DECORATION_BYTES,+ help=(+ "Min XML bytes for pure-vector decoration runs inside text-bearing groups "+ f"(default: {DEFAULT_MIN_DECORATION_BYTES})"+ ),+ )+ parser.add_argument(+ "--inplace", action="store_true",+ help="Rewrite the source SVGs in place instead of writing to --rewritten-dir",+ )+ parser.add_argument(+ "--clean-stale",+ action="store_true",+ help=(+ "Remove stale generated assets for the current svg filenames/id prefix "+ "that are not referenced by this run's inventory"+ ),+ )+ return parser+++def main(argv: Optional[list[str]] = None) -> int:+ args = build_parser().parse_args(argv)+ svg_dir = Path(args.svg_dir)+ if not svg_dir.is_dir():+ print(f"[ERROR] svg_dir not found: {svg_dir}", file=sys.stderr)+ return 1++ icons_dir = Path(args.icons_dir) if args.icons_dir else svg_dir.parent / "icons"+ icons_dir.mkdir(parents=True, exist_ok=True)+ rewritten_dir = Path(args.rewritten_dir) if args.rewritten_dir else None+ inventory_path = Path(args.inventory) if args.inventory else svg_dir.parent / f"{svg_dir.name}_vector_asset_inventory.json"+ svg_paths = sorted(svg_dir.glob("*.svg"))++ inventory: list[dict] = []+ for svg_path in svg_paths:+ try:+ inventory.extend(+ extract_file(+ svg_path,+ icons_dir,+ args.min_drawables,+ args.min_bytes,+ args.min_decoration_bytes,+ args.inplace,+ args.id_prefix,+ rewritten_dir,+ )+ )+ except ET.ParseError as exc:+ print(f"[WARN] skip unparseable {svg_path.name}: {exc}", file=sys.stderr)++ extracted_count = len(inventory)+ known_assets = {str(entry["asset"]) for entry in inventory}+ inventory.extend(_existing_placeholder_entries(svg_paths, icons_dir, known_assets))++ stale_removed: list[str] = []+ if args.clean_stale:+ keep_assets = {str(entry["asset"]) for entry in inventory}+ keep_assets.update(_referenced_icon_assets(svg_paths))+ stale_removed = _clean_stale_assets(+ icons_dir,+ svg_paths,+ args.id_prefix,+ keep_assets,+ )++ manifest = {+ "schema": "vector_asset_inventory.v1",+ "svg_dir": str(svg_dir),+ "icons_dir": str(icons_dir),+ "rewritten_dir": None if args.inplace else str(_rewritten_path(svg_dir / "_sample.svg", rewritten_dir, False).parent),+ "min_drawables": args.min_drawables,+ "min_bytes": args.min_bytes,+ "min_decoration_bytes": args.min_decoration_bytes,+ "extracted_count": extracted_count,+ "asset_count": len(inventory),+ "stale_removed": stale_removed,+ "assets": inventory,+ }+ inventory_path.parent.mkdir(parents=True, exist_ok=True)+ inventory_path.write_text(json.dumps(manifest, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")+ print(f"[OK] extracted {extracted_count} new asset(s), inventoried {len(inventory)} asset(s) -> {icons_dir}", file=sys.stderr)+ if stale_removed:+ print(f"[OK] removed {len(stale_removed)} stale generated asset(s)", file=sys.stderr)+ return 0+++if __name__ == "__main__":+ raise SystemExit(main())diff --git a/skills/ppt-master/scripts/svg_finalize/embed_icons.py b/skills/ppt-master/scripts/svg_finalize/embed_icons.pyindex 959d2f95..7c504526 100644--- a/skills/ppt-master/scripts/svg_finalize/embed_icons.py+++ b/skills/ppt-master/scripts/svg_finalize/embed_icons.py@@ -9,6 +9,7 @@ Placeholder syntax (new SVGs must include a library prefix):<use data-icon="tabler-filled/home" x="100" y="200" width="48" height="48" fill="#0076A8"/><use data-icon="tabler-outline/home" x="100" y="200" width="48" height="48" fill="#0076A8"/><use data-icon="tabler-outline/home" x="100" y="200" width="48" height="48" fill="#0076A8" stroke-width="3"/>+ <use data-icon="layered_slide_06_ill01"/>Legacy compatibility accepted by the resolver:<use data-icon="rocket" .../> -> chunk-filled/rocket@@ -29,6 +30,7 @@ Icon libraries (subdirectories of templates/icons/):tabler-outline/ - 5000+ stroke icons, 24x24 viewBox (use prefix: tabler-outline/name)phosphor-duotone/ - 1200+ duotone icons, 256x256 viewBox (single color + 0.2-opacity backplate)simple-icons/ - 3400+ brand logos, 24x24 viewBox (brand-inset library — used alongside the chosen primary library, NOT as a standalone library for generic icons)+ <asset_id>.svg - project-local extracted vector illustrations with data-icon-style="preserve-color"; preserve source colors and natural viewBox aspect ratioUsage:python3 scripts/svg_finalize/embed_icons.py <svg_file> [svg_file2] ...@@ -40,6 +42,8 @@ Options:--verbose Show detailed information"""+from __future__ import annotations+import osimport reimport sys@@ -61,6 +65,7 @@ ICON_BASE_SIZES = {'simple-icons': 24,}DEFAULT_ICON_BASE_SIZE = 24+BaseGeometry = float | tuple[float, float, float, float]def _get_viewbox_size(content: str) -> float:@@ -71,6 +76,47 @@ def _get_viewbox_size(content: str) -> float:return 0+def _get_viewbox_geometry(content: str) -> tuple[float, float, float, float] | None:+ """Extract full viewBox geometry as (min_x, min_y, width, height)."""+ match = re.search(r'viewBox=["\']([^"\']+)["\']', content)+ if not match:+ return None+ parts = re.split(r'[\s,]+', match.group(1).strip())+ if len(parts) < 4:+ return None+ try:+ min_x, min_y, width, height = [float(part) for part in parts[:4]]+ except ValueError:+ return None+ if width <= 0 or height <= 0:+ return None+ return min_x, min_y, width, height+++def _format_number(value: object) -> str:+ """Format SVG numeric values compactly without losing meaningful precision."""+ if isinstance(value, float):+ return f'{value:g}'+ return str(value)+++def _base_geometry(base_size: BaseGeometry) -> tuple[float, float, float, float]:+ """Normalize legacy square icon size and full viewBox geometry."""+ if isinstance(base_size, tuple):+ return base_size+ return 0.0, 0.0, float(base_size), float(base_size)+++def _is_preserve_color_asset(content: str) -> bool:+ """Project illustrations are vector assets, not recolorable monochrome icons.++ The `data-icon-style="preserve-color"` marker is stamped by+ extract_svg_assets.py and is the single source of truth — hand-authored+ multi-color assets must carry it to keep their colors and aspect ratio.+ """+ return 'data-icon-style="preserve-color"' in content++def _detect_icon_style(content: str) -> str:"""Detect whether an icon is fill-based or stroke-based."""# stroke="currentColor" with fill="none" → stroke style@@ -79,6 +125,15 @@ def _detect_icon_style(content: str) -> str:return 'fill'+def _extract_svg_body(content: str) -> list[str]:+ """Return the root SVG body for preserve-color assets without editing attrs."""+ match = re.search(r'<svg\b[^>]*>(.*)</svg>\s*$', content, re.DOTALL)+ if not match:+ return []+ body = match.group(1).strip()+ return [body] if body else []++def _extract_shape_elements(content: str, color: str) -> list[str]:"""Extract all drawable shape elements from an icon SVG, replacing@@ -143,19 +198,24 @@ def resolve_icon_path(icon_name: str, icons_dir: Path, fallback_dir: Path | Nonereturn icon_path, base_size-def extract_paths_from_icon(icon_path: Path, target_color: str = '#000000') -> tuple[list[str], str, float]:+def extract_paths_from_icon(icon_path: Path, target_color: str = '#000000') -> tuple[list[str], str, BaseGeometry]:"""Extract drawable elements from an icon SVG file.Returns:(elements, style, base_size)- style: 'fill' or 'stroke'- base_size: detected from viewBox+ style: 'fill', 'stroke', or 'preserve'+ base_size: square icon size, or full viewBox geometry for preserve assets"""if not icon_path.exists():return [], 'fill', 16content = icon_path.read_text(encoding='utf-8')+ if _is_preserve_color_asset(content):+ geometry = _get_viewbox_geometry(content) or (0.0, 0.0, DEFAULT_ICON_BASE_SIZE, DEFAULT_ICON_BASE_SIZE)+ elements = _extract_svg_body(content)+ return elements, 'preserve', geometry+style = _detect_icon_style(content)base_size = _get_viewbox_size(content) or 16elements = _extract_shape_elements(content, target_color)@@ -215,6 +275,9 @@ def parse_use_element(use_match: str) -> dict[str, str | float]:def resolve_icon_color(attrs: dict[str, str | float], style: str) -> str:"""Resolve the caller-provided color for fill or stroke icon libraries."""+ if style == 'preserve':+ return 'preserve'+fill = str(attrs.get('fill', '')).strip()stroke = str(attrs.get('stroke', '')).strip()@@ -232,42 +295,55 @@ def resolve_icon_color(attrs: dict[str, str | float], style: str) -> str:return '#000000'-def generate_icon_group(attrs: dict[str, str | float], elements: list[str], style: str, base_size: float) -> str:+def generate_icon_group(attrs: dict[str, str | float], elements: list[str], style: str, base_size: BaseGeometry) -> str:"""Generate the icon's <g> element.Args:attrs: Attributes of the use elementelements: List of drawable SVG elements- style: 'fill' or 'stroke'- base_size: Icon's natural size (viewBox width)+ style: 'fill', 'stroke', or 'preserve'+ base_size: Icon's natural size, or full viewBox geometry for preserve assetsReturns:Complete <g> element string"""+ min_x, min_y, base_width, base_height = _base_geometry(base_size)x = attrs.get('x', 0)y = attrs.get('y', 0)- width = attrs.get('width', base_size)- height = attrs.get('height', base_size)+ width = attrs.get('width', base_width)+ height = attrs.get('height', base_height)color = resolve_icon_color(attrs, style)icon_name = attrs.get('icon', 'unknown')- scale_x = width / base_size- scale_y = height / base_size+ scale_x = float(width) / base_width+ scale_y = float(height) / base_heightif attrs.get('transform'):# This transform is authoritative: the editor computes it from the# expanded <g>, so composing it with x/y would apply placement twice.transform = str(attrs['transform'])elif abs(scale_x - 1) < 1e-6 and abs(scale_y - 1) < 1e-6:- transform = f'translate({x}, {y})'+ transform = f'translate({_format_number(x)}, {_format_number(y)})'elif abs(scale_x - scale_y) < 1e-6:- transform = f'translate({x}, {y}) scale({scale_x})'+ transform = f'translate({_format_number(x)}, {_format_number(y)}) scale({_format_number(scale_x)})'else:- transform = f'translate({x}, {y}) scale({scale_x}, {scale_y})'+ transform = (+ f'translate({_format_number(x)}, {_format_number(y)}) '+ f'scale({_format_number(scale_x)}, {_format_number(scale_y)})'+ )elements_str = '\n '.join(elements)+ if style == 'preserve':+ if min_x or min_y:+ inner_transform = f'translate({_format_number(-min_x)}, {_format_number(-min_y)})'+ elements_str = f'<g transform="{inner_transform}">\n {elements_str}\n </g>'+ return f'''<!-- icon: {icon_name} -->+ <g transform="{transform}">+ {elements_str}+ </g>'''+if style == 'stroke':# Default to 2 — matches the source stroke-width baked into tabler-outline# (and any other stroke library) so omitting the attribute reproducesdiff --git a/skills/ppt-master/workflows/beautify-pptx.md b/skills/ppt-master/workflows/beautify-pptx.mdindex c0ff1d1c..afda4f62 100644--- a/skills/ppt-master/workflows/beautify-pptx.md+++ b/skills/ppt-master/workflows/beautify-pptx.md@@ -26,6 +26,8 @@ Re-lays-out an existing `.pptx`: the text is preserved **verbatim**, the source**Distinct from mirror templates**: `replication_mode: mirror` (executor §1.1) keeps layout + visuals verbatim and edits text. Beautify is the inverse — content verbatim, layout redone, identity inherited.+**When this is the wrong route — re-architecture belongs to the main pipeline**: beautify preserves the source's page count and page order 1:1. It is for "keep this deck, just lay it out better". When the user instead wants the original page breakdown reconsidered — merge / split / reorder pages, re-outline the structure, build a *better deck* from the same content rather than a prettier version of the same pages — that is not beautify. Convert the deck with [`ppt_to_md`](../scripts/source_to_md/ppt_to_md.py) and run the main SKILL.md pipeline, where the Strategist re-architects the outline freely from the extracted content. The deciding question: is the source's page split information to preserve, or just the previous author's structure to improve? Preserve → beautify (here); improve → `ppt_to_md` + main pipeline.+---## 2. Inputs@@ -90,6 +92,21 @@ python3 ${SKILL_DIR}/scripts/template_fill_pptx.py analyze <project_path>/source**Hard rule — regenerate visuals, do not carry them over**: charts / tables / images are rebuilt from their data in the inherited style, never spliced in byte-for-byte. This keeps the deck style-consistent and natively editable. **Data values are frozen** (categories / series / cell text / numbers unchanged); only their rendering is the deck's own. Pictures (`ppt_to_md`-extracted files) are reused but re-laid-out — position / crop / size follow the new layout, not the source slot. A user who wants an original element verbatim copies it across themselves.+**Optional source-SVG visual reference**: when the source deck has complex vector decoration, distinctive page chrome, or a visual language that cannot be captured by `identity.json` colors/fonts alone, create a read-only SVG reference package under `analysis/`. This is for understanding style only; it is not a carry-over asset path.++```bash+python3 ${SKILL_DIR}/scripts/pptx_to_svg.py <project_path>/sources/<source.pptx> -o <project_path>/analysis/source_svg_import+python3 ${SKILL_DIR}/scripts/extract_svg_assets.py <project_path>/analysis/source_svg_import/svg-flat \+ --icons-dir <project_path>/analysis/source_svg_import/icons \+ --inplace --id-prefix source_flat --min-decoration-bytes 3000 --clean-stale+```++Use the cleaned `analysis/source_svg_import/svg-flat/slide_*.svg` files plus `analysis/source_svg_import/svg-flat_vector_asset_inventory.json` in Step 5/Strategist. Extraction is required for inspection when complex vectors exist: it creates a candidate pool the AI can index, compare, and judge for possible reuse without reading every heavy vector body. Read an individual `analysis/source_svg_import/icons/*.svg` only when the cleaned page and inventory indicate that candidate may be promoted or materially affects the style decision. These candidates are analysis artifacts first, not automatic output assets.++Default: do **not** copy these candidates into the project `icons/`, do **not** list them as reusable output assets, and do **not** preserve original vector decorations byte-for-byte in the beautified deck. The Executor still regenerates fresh native shapes from the confirmed plan.++Optional reuse gate: if a candidate is a non-text brand/logo/motif/decorative asset that should survive the beautification, list it in the Step 5 plan with source slide, candidate filename, intended reuse, and dependency notes from the inventory. Wait for user confirmation. Only confirmed candidates may be promoted into `<project_path>/icons/` and referenced from generated SVGs with `<use data-icon="..."/>`; `finalize_svg.py` then re-inlines them as native shapes. Never promote text-bearing groups, charts/tables, source page layouts, or dense slide composites as reusable assets.+**Assemble the inventory** — the deterministic join into one per-slide ledger, `analysis/beautify_inventory.json`, the contract Step 5 confirms and Step 7 verifies against:```bashdiff --git a/skills/ppt-master/workflows/create-template.md b/skills/ppt-master/workflows/create-template.mdindex 4f88b1c7..a52aad72 100644--- a/skills/ppt-master/workflows/create-template.md+++ b/skills/ppt-master/workflows/create-template.md@@ -81,13 +81,27 @@ Import fidelity rules:It is a reconstruction aid, not a final direct template conversion.+**Vector illustration readability pass**:++Before the Template_Designer reads imported SVGs, factor large decorative vector groups into project icon assets so the working SVGs stay readable while export remains native shapes. Run this on the SVG view that will feed the selected replication path:++```bash+# standard / fidelity analysis path+python3 skills/ppt-master/scripts/extract_svg_assets.py "<import_workspace>/svg" --icons-dir "<import_workspace>/icons" --inplace --id-prefix layered --min-decoration-bytes 3000 --clean-stale++# mirror path+python3 skills/ppt-master/scripts/extract_svg_assets.py "<import_workspace>/svg-flat" --icons-dir "<import_workspace>/icons" --inplace --id-prefix flat --min-decoration-bytes 3000 --clean-stale+```++The source SVGs in `<import_workspace>/svg/` / `<import_workspace>/svg-flat/` are rewritten in place with compact `<use data-icon="..."/>` placeholders. Extracted assets live directly under `<import_workspace>/icons/`; `icons/` must contain only icon/vector assets, not rewritten page SVGs or inventories. The inventory is written beside the processed SVG directory (for example `<import_workspace>/svg_vector_asset_inventory.json`). The existing icon embedding path re-inlines the extracted assets before final export, preserving multi-color artwork and non-square viewBox geometry as native SVG shapes. Text-bearing groups are never extracted; text must stay readable/editable in the working SVG. Extraction triggers on either many drawable elements or a large pure-vector XML block, so long single-path illustrations are factored out too. Pure-vector decoration runs inside text-bearing groups use a lower size threshold, allowing card borders and decorative paths to be extracted without hiding text. Referenced defs (`gradient` / `pattern` / `filter` / `clipPath` / `marker`) are copied into each asset and namespaced so the asset is self-contained after re-inline. If both layered and flat views are processed into the same icon directory, keep distinct `--id-prefix` values to avoid asset ID collisions. `--clean-stale` removes only stale generated assets for the current SVG filenames and prefix; it is safe in this import workspace but should not be used against a shared hand-curated icon directory without a specific prefix.+**Read order during analysis** (read everything below before composing Step 2):1. `manifest.json` (factual metadata: slide size, theme, assets, layouts, masters, slide page-types)-2. `svg/master_*.svg` and `svg/layout_*.svg` — read these **before** any slide SVG; they show the deck's shared visual language (background, headers, footers, decorative bars). This is what the new template's fixed structure should adapt from.+2. cleaned `svg/master_*.svg` and `svg/layout_*.svg` — read these **before** any slide SVG; they show the deck's shared visual language (background, headers, footers, decorative bars). This is what the new template's fixed structure should adapt from.3. `svg/inheritance.json` — confirms which slide uses which layout/master4. exported `assets/`-5. cleaned slide SVG references `svg/slide_NN.svg` — content unique to each slide; consult after the master/layout language is understood+5. cleaned slide SVG references from `svg/` — content unique to each slide; consult after the master/layout language is understood6. `summary.md` only as a quick orientation aid7. user-provided screenshots or the original PPTX only for visual cross-checking@@ -96,26 +110,33 @@ Interpretation rule (carries forward into Steps 2 and 4):- `manifest.json` is the source of truth for slide size, theme colors, fonts, background inheritance, reusable asset inventory, unique layout/master structure, and slide reuse relationships- `summary.md` is a quick scan; never treat it as the canonical fact source — go back to `manifest.json` if anything is unclear- exported `assets/` are the canonical reusable image pool — `<image>` references in `svg/` already point at these files directly-- `svg/master_*.svg` / `svg/layout_*.svg` are the **primary source for fixed structural design** — recurring backgrounds, page chrome, decorative motifs that the template should preserve. The new template's `01_cover` / `02_chapter` / `03_content` / `04_ending` typically inherit elements from these layers.-- `svg/slide_NN.svg` shows page-specific content — useful for judging composition rhythm and content density, not for fixed structure. Read every slide regardless of count.-- `svg-flat/slide_NN.svg` is for human preview and screenshot comparison; do not treat duplicated master/layout chrome inside flat slides as separate reusable template structure.+- exported `icons/*.svg` are the canonical reusable vector illustration pool, but they are **not** part of the default read set. Read the cleaned SVGs and `*_vector_asset_inventory.json` first; open a specific icon SVG only when the cleaned page or inventory shows that the extracted asset is relevant to the current design decision. This is what makes the SVG work surface smaller.+- cleaned `svg/master_*.svg` / `svg/layout_*.svg` are the **primary source for fixed structural design** — recurring backgrounds, page chrome, decorative motifs that the template should preserve. The new template's `01_cover` / `02_chapter` / `03_content` / `04_ending` typically inherit elements from these layers.+- cleaned `svg/slide_NN.svg` shows page-specific content — useful for judging composition rhythm and content density, not for fixed structure. Read every slide regardless of count.+- cleaned `svg-flat/slide_NN.svg` is for human preview and screenshot comparison; do not treat duplicated master/layout chrome inside flat slides as separate reusable template structure.- screenshots remain useful for judging composition and style, but should not override extracted factual metadata unless the import result is clearly incomplete**Hard read gate** (`standard` / `fidelity` modes — `mirror` differs, see below):-- The agent MUST finish reading every `svg/master_*.svg`, `svg/layout_*.svg`, and `svg/slide_*.svg` file under `<import_workspace>/svg/` before moving on to Step 2+- The agent MUST finish reading every cleaned `master_*.svg`, `layout_*.svg`, and `slide_*.svg` file from the layered `svg/` view before moving on to Step 2- The agent MUST list the read master / layout / slide filenames inside the Step 2 brief proposal as proof of the gateDo **not** treat the imported PPTX or exported slide SVGs as direct final template assets — Step 4 reconstructs them as a clean, maintainable PPT Master template package, not a 1:1 shape translation.> **Mirror-mode fast path** — when the user has indicated mirror replication (verbatim copy of every source slide):-> - Read **only** `svg-flat/slide_*.svg` (the self-contained, what-PowerPoint-shows view) and `manifest.json` (for theme colors, fonts, asset inventory).+> - Run the vector illustration readability pass on `svg-flat/`, then read **only** the cleaned flat `slide_*.svg` files (the self-contained, what-PowerPoint-shows view) and `manifest.json` (for theme colors, fonts, asset inventory).> - Skip `svg/master_*.svg` / `svg/layout_*.svg` / `svg/inheritance.json` — chrome / content separation is irrelevant in mirror mode (no placeholder insertion happens).-> - Mirror is explicitly a verbatim copy flow — every slide becomes a template page as-is. The "reconstruct, don't translate" rule applies to `standard` / `fidelity` only.+> - Mirror is explicitly a visual-verbatim copy flow: every slide becomes a template page as-is, except that large vector illustrations may be factored into `icons/` placeholders for maintainability. The "reconstruct, don't translate" rule applies to `standard` / `fidelity` only.### 1B. Existing SVG assets-`ls` the directory and `Read` every `*.svg` to extract:+If the source SVG directory contains complex vector blobs, first copy the SVG files into a throwaway analysis workspace and run the same readability pass there. Do **not** rewrite the user's original source directory in place.++```bash+python3 skills/ppt-master/scripts/extract_svg_assets.py "<svg_analysis_workspace>/svg" --icons-dir "<svg_analysis_workspace>/icons" --inplace --id-prefix source --min-decoration-bytes 3000 --clean-stale+```++Then `ls` the analysis workspace and `Read` every cleaned `*.svg` to extract:- canvas size (`viewBox` on the root `<svg>`)- recurring colors (`fill` / `stroke` values; identify the dominant 2–4 hex codes as candidate theme colors)@@ -123,6 +144,8 @@ Do **not** treat the imported PPTX or exported slide SVGs as direct final templa- placeholder usage (existing `{{...}}` strings, if any)- structural decoration (recurring `<rect>` bars, `<path>` motifs, embedded `<image>` references)+Read the generated `*_vector_asset_inventory.json` before opening individual `<svg_analysis_workspace>/icons/*.svg`; do not bulk-read extracted icons unless a specific asset affects a design decision or is selected for mirror preservation.+If a `design_spec.md` or `spec_lock.md` accompanies the SVGs, `Read` it too — it is a higher-confidence source than re-deriving from the SVG alone. Record the equivalent of a `manifest.json`'s factual fields in your own analysis notes (no actual file written) so Step 2 can label them `[fact]`.### 1C. Image / visual references@@ -172,7 +195,7 @@ Items to surface:For type A, also include in this message:-- the exact `svg/master_*.svg`, `svg/layout_*.svg`, `svg/slide_*.svg` filenames you read (proof of the hard read gate)+- the exact cleaned `master_*.svg`, `layout_*.svg`, `slide_*.svg` filenames you read from the layered `svg/` view (proof of the hard read gate)- a one-line summary of the master / layout structure you extractedThe user replies with corrections, additions, or "all good".@@ -226,10 +249,11 @@ If the input source is type A, pass the following internal package to the role:- `manifest.json`- `summary.md` (orientation only)- exported `assets/`-- cleaned slide SVG references from `svg/`+- `*_vector_asset_inventory.json`, when the vector readability pass extracted assets; do not bulk-read `icons/*.svg`+- cleaned SVG references from `svg/`- optional screenshots, if available-For type B, pass the SVG file list, any companion `design_spec.md` / `spec_lock.md`, and the analysis notes.+For type B, pass the cleaned SVG file list from the analysis workspace, `*_vector_asset_inventory.json` if extraction ran, any companion `design_spec.md` / `spec_lock.md`, and the analysis notes. Do not bulk-read extracted icons; open individual `icons/*.svg` only when needed.For type C, pass the image file list and the visual analysis notes.For type D, pass only the finalized brief.@@ -241,18 +265,19 @@ The role uses the analysis bundle to anchor objective facts such as theme colors**Mirror-mode override** (type A or B): when `Replication mode: mirror`, this step is a **verbatim copy** rather than a reconstruction. The Template_Designer role:-1. **Copies the source pages** into the template directory **without any modification** — no placeholder insertion, no decorative simplification, no chrome/content reorganization. The SVG that ships in the template is byte-for-byte the source page (modulo filename change and asset path rewrites).- - Type A: source is `<import_workspace>/svg-flat/slide_NN.svg`- - Type B: source is each `*.svg` in the input directory (already self-contained)+1. **Copies the cleaned source pages** into the template directory **without reconstruction** — no content placeholder insertion, no decorative simplification, no chrome/content reorganization. The SVG that ships in the template is the cleaned source page, modulo filename changes, asset path rewrites, and the vector illustration placeholders created by the readability pass.+ - Type A: source is the cleaned flat `<import_workspace>/svg-flat/slide_NN.svg`+ - Type B: source is each cleaned `*.svg` in the analysis workspace when extraction ran; otherwise each `*.svg` in the input directory (already self-contained)2. **Renames each file** using the source-order-first convention `<NNN>_<page_type>.svg`, where `<NNN>` is the source-order index zero-padded to 3 digits and `<page_type>` is typically `cover` / `toc` / `chapter` / `content` / `ending` (fall back to `content` when the type cannot be confidently classified). Examples: `001_cover.svg`, `002_toc.svg`, `003_content.svg`, ..., `050_ending.svg`.- Type A: derive `<page_type>` from `manifest.json.pageTypeCandidates`- Type B: derive `<page_type>` from the source filename when it follows the PPT Master convention (`01_cover.svg` → `cover`, `03a_content_two_col.svg` → `content`); otherwise infer from page content or fall back to `content`3. **Copies bundled assets** into the template directory and rewrites the `<image href="...">` paths inside each copied SVG to point at the local copies. Asset filenames may be renamed to semantic names (`brand_emblem.png` instead of `image3.png`) when it improves readability — but the rewrite must be consistent across every page.- Type A: assets come from `<import_workspace>/assets/`- Type B: resolve relative paths in source `<image href="...">` against the source SVG location and copy each unique asset; if the source already follows PPT Master conventions (assets co-located with SVGs in the same directory), copy the whole asset set and then rewrite paths-4. Writes `design_spec.md` per [template-designer.md](../references/template-designer.md) §1 — the **§V Page Roster description per page is the load-bearing artifact** because mirror has no placeholders to advertise the per-page contract; downstream Strategist selects pages purely from these descriptions.+4. **Copies `icons/` when present** and preserves every extracted `<use data-icon="..."/>` reference. Do not inline these assets manually in the template working SVGs; the shared icon embedding path owns re-inlining before export.+5. Writes `design_spec.md` per [template-designer.md](../references/template-designer.md) §1 — the **§V Page Roster description per page is the load-bearing artifact** because mirror has no placeholders to advertise the per-page contract; downstream Strategist selects pages purely from these descriptions.-Mirror mode does **not** invoke the "reconstruct into clean SVG" pathway. The sprite-sheet preservation rule still applies (because the flat SVGs already contain the original sprite wrappers — do not flatten them when copying).+Mirror mode does **not** invoke the "reconstruct into clean SVG" pathway. The sprite-sheet preservation rule still applies (because the flat SVGs already contain the original sprite wrappers — do not flatten them when copying). Vector illustration placeholders are the only allowed maintainability rewrite.**Expected outputs from this step** (full spec → [template-designer.md](../references/template-designer.md)):@@ -292,8 +317,9 @@ python3 skills/ppt-master/scripts/svg_quality_checker.py "skills/ppt-master/temp- [ ] SVG viewBox matches the chosen canvas format (for `ppt169`: `0 0 1280 720`)- [ ] Placeholder names follow the canonical convention where applicable; templates with intentionally different vocabularies (e.g. `{{KEY_MESSAGE}}` instead of `{{PAGE_TITLE}}`) should declare a `placeholders:` frontmatter block to silence advisory warnings- [ ] Asset files referenced by SVGs actually exist in the template package+- [ ] If any SVG references an extracted vector `data-icon`, the corresponding SVG asset exists directly under the package's `icons/` directory; do not add a separate illustration embedding script- [ ] For `fidelity` mode: every sprite-sheet asset retains its nested `<svg viewBox=...>` crop wrapper; no image whose file aspect differs from its on-page aspect was flattened to a bare `<image>`-- [ ] For `mirror` mode: file count equals source page count (type A: `ls templates/layouts/<id>/*_*.svg | wc -l` matches `<import_workspace>/svg-flat/slide_*.svg | wc -l`; type B: matches the source SVG count); filenames follow the `<NNN>_<page_type>.svg` convention; **no `{{...}}` placeholder strings appear in any copied SVG** (`grep -l "{{" templates/layouts/<id>/*.svg` should return nothing — if the type B source itself contains placeholders, the user should be in `standard` mode, not `mirror`); §V Page Roster in `design_spec.md` lists every emitted file with a one-line description of what the page contains and what content slot it suits+- [ ] For `mirror` mode: file count equals source page count (type A: `ls templates/layouts/<id>/*_*.svg | wc -l` matches the cleaned flat `<import_workspace>/svg-flat/slide_*.svg | wc -l`; type B: matches the source SVG count); filenames follow the `<NNN>_<page_type>.svg` convention; **no `{{...}}` placeholder strings appear in any copied SVG** (`grep -l "{{" templates/layouts/<id>/*.svg` should return nothing — if the type B source itself contains placeholders, the user should be in `standard` mode, not `mirror`); §V Page Roster in `design_spec.md` lists every emitted file with a one-line description of what the page contains and what content slot it suitsThis step is a **hard gate**. Do not register the template into the library index until validation passes.