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
fix(checker): harden spec_lock drift scanning and unify viewBox parsing
hugohe35ea056f6695b
diff --git a/skills/ppt-master/scripts/svg_editor/static/app.js b/skills/ppt-master/scripts/svg_editor/static/app.jsindex 47243548..c148f338 100644--- a/skills/ppt-master/scripts/svg_editor/static/app.js+++ b/skills/ppt-master/scripts/svg_editor/static/app.js@@ -624,7 +624,15 @@// is never touched.if (rootSvg) {var vb = (rootSvg.getAttribute("viewBox") || "").trim().split(/[\s,]+/);- if (vb.length === 4 && parseFloat(vb[2]) > 0 && parseFloat(vb[3]) > 0) {+ var vbWidth = Number(vb[2]);+ var vbHeight = Number(vb[3]);+ if (+ vb.length === 4 &&+ Number.isFinite(vbWidth) &&+ Number.isFinite(vbHeight) &&+ vbWidth > 0 &&+ vbHeight > 0+ ) {rootSvg.setAttribute("width", vb[2]);rootSvg.setAttribute("height", vb[3]);}diff --git a/skills/ppt-master/scripts/svg_quality_checker.py b/skills/ppt-master/scripts/svg_quality_checker.pyindex 8e51ee74..bbfa5bad 100644--- a/skills/ppt-master/scripts/svg_quality_checker.py+++ b/skills/ppt-master/scripts/svg_quality_checker.py@@ -404,8 +404,28 @@ class SVGQualityChecker:viewbox = viewbox_match.group(1)result['info']['viewbox'] = viewbox- # Check format- if not re.match(r'0 0 \d+ \d+', viewbox):+ parts = re.split(r'[\s,]+', viewbox.strip())+ if len(parts) != 4:+ result['errors'].append(+ f"viewBox must contain exactly four numeric values; got: {viewbox}"+ )+ return++ try:+ values = [float(part) for part in parts]+ except ValueError:+ result['errors'].append(+ f"viewBox must contain exactly four numeric values; got: {viewbox}"+ )+ return++ if values[2] <= 0 or values[3] <= 0:+ result['errors'].append(+ f"viewBox width/height must be positive; got: {viewbox}"+ )+ return++ if values[0] != 0 or values[1] != 0 or any(not part.isdigit() for part in parts):result['warnings'].append(f"Unusual viewBox format: {viewbox}")# Check if it matches expected format@@ -573,8 +593,17 @@ class SVGQualityChecker:@staticmethoddef _font_family_values(content: str) -> List[str]:"""Extract SVG font-family values from attributes and inline styles."""+ return SVGQualityChecker._svg_property_values(content, 'font-family')++ @staticmethod+ def _svg_property_values(content: str, property_name: str) -> List[str]:+ """Extract a SVG property from direct attributes and inline styles."""values: List[str] = []- for match in re.finditer(r'\bfont-family\s*=\s*(["\'])(.*?)\1', content, re.IGNORECASE):+ attr_re = re.compile(+ rf'\b{re.escape(property_name)}\s*=\s*(["\'])(.*?)\1',+ re.IGNORECASE | re.DOTALL,+ )+ for match in attr_re.finditer(content):values.append(html.unescape(match.group(2)).strip())for match in re.finditer(r'\bstyle\s*=\s*(["\'])(.*?)\1', content, re.IGNORECASE | re.DOTALL):@@ -583,7 +612,7 @@ class SVGQualityChecker:if ':' not in part:continuename, value = part.split(':', 1)- if name.strip().lower() == 'font-family':+ if name.strip().lower() == property_name.lower():values.append(value.strip())return [value for value in values if value]@@ -952,17 +981,15 @@ class SVGQualityChecker:# Scan SVG for used valuescolor_drifts = set()for attr in ('fill', 'stroke', 'stop-color'):- pattern = re.compile(rf'\b{attr}\s*=\s*["\'](#[0-9A-Fa-f]{{3,8}})["\']')- for m in pattern.finditer(content):- val = m.group(1).upper()+ for raw_value in self._svg_property_values(content, attr):+ if not HEX_VALUE_RE.fullmatch(raw_value):+ continue+ val = raw_value.upper()if val not in allowed_colors:color_drifts.add(val)font_drifts = set()- # Capture to the matching delimiter (group 1) so a double-quoted stack- # containing single-quoted family names is not truncated at the inner quote.- for m in re.finditer(r'font-family\s*=\s*(["\'])(.*?)\1', content):- val = m.group(2).strip()+ for val in self._font_family_values(content):if allowed_fonts and self._normalize_font_stack(val) not in allowed_fonts:font_drifts.add(val)@@ -974,8 +1001,8 @@ class SVGQualityChecker:size_drifts = set()used_sizes = []- for m in re.finditer(r'font-size\s*=\s*["\']([^"\']+)["\']', content):- val = self._normalize_size(m.group(1))+ for raw_value in self._svg_property_values(content, 'font-size'):+ val = self._normalize_size(raw_value)used_sizes.append(val)if not allowed_sizes or val in allowed_sizes:continue@@ -1567,12 +1594,16 @@ class SVGQualityChecker:if not match:return Noneparts = re.split(r'[\s,]+', match.group(1).strip())- if len(parts) < 4:+ if len(parts) != 4:return Nonetry:- return float(parts[2]), float(parts[3])+ width = float(parts[2])+ height = float(parts[3])except ValueError:return None+ if width <= 0 or height <= 0:+ return None+ return width, height@classmethoddef _has_off_canvas_reference(cls, refs: List[Tuple[Path, str]]) -> bool:diff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml_converter.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml_converter.pyindex 0f5032b5..be91352c 100644--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml_converter.py+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml_converter.py@@ -114,9 +114,14 @@ def _root_viewport_size(root: ET.Element) -> tuple[float, float]:"""Return the SVG root viewport size in user units."""view_box = root.get('viewBox')if view_box:- parts = [float(n) for n in re.findall(r'[-+]?(?:\d*\.\d+|\d+\.?)(?:[eE][-+]?\d+)?', view_box)]- if len(parts) == 4 and parts[2] > 0 and parts[3] > 0:- return parts[2], parts[3]+ raw_parts = re.split(r'[\s,]+', view_box.strip())+ if len(raw_parts) == 4:+ try:+ parts = [float(n) for n in raw_parts]+ except ValueError:+ parts = []+ if parts and parts[2] > 0 and parts[3] > 0:+ return parts[2], parts[3]width = parse_svg_length(root.get('width'), 1280.0)height = parse_svg_length(root.get('height'), 720.0)diff --git a/skills/ppt-master/scripts/svg_to_pptx/pptx_dimensions.py b/skills/ppt-master/scripts/svg_to_pptx/pptx_dimensions.pyindex 7fe0f989..da8ee79e 100644--- a/skills/ppt-master/scripts/svg_to_pptx/pptx_dimensions.py+++ b/skills/ppt-master/scripts/svg_to_pptx/pptx_dimensions.py@@ -111,7 +111,7 @@ def get_viewbox_dimensions(svg_path: Path) -> tuple[int, int] | None:return Noneparts = re.split(r'[\s,]+', match.group(1).strip())- if len(parts) < 4:+ if len(parts) != 4:return Nonewidth = float(parts[2])diff --git a/skills/ppt-master/templates/design_spec_reference.md b/skills/ppt-master/templates/design_spec_reference.mdindex c2b9a0ed..673c5b9a 100644--- a/skills/ppt-master/templates/design_spec_reference.md+++ b/skills/ppt-master/templates/design_spec_reference.md@@ -95,7 +95,7 @@> **Per-role families are expected, not optional.** Title / Body / Emphasis / Code may each use a different family (e.g., display serif title + geometric sans body). One family throughout is not required. See [strategist.md §g — Font Combinations](../references/strategist.md) for starting directions; you may propose a combination not listed.>-> **⚠️ PPT-safe stack discipline (HARD rule).** PPTX stores a single `typeface` per run — no runtime fallback. Every stack MUST end with a cross-platform pre-installed font: `"Microsoft YaHei", sans-serif` / `SimSun, serif` / `Arial, sans-serif` / `"Times New Roman", serif` / `Consolas, "Courier New", monospace`. Stacks led by a non-preinstalled font (Inter / Google Fonts / brand typefaces) are allowed only when this spec notes the font-install or embedding requirement.+> **⚠️ PPT-safe stack discipline (HARD rule).** PPTX stores concrete exported Latin / EA typefaces per run — no runtime fallback. Every stack's exported Latin / EA typefaces MUST resolve to cross-platform pre-installed fonts: `"Microsoft YaHei"` / `SimSun` / `Arial` / `"Times New Roman"` / `Consolas`. Stacks that export non-preinstalled typefaces (Inter / Google Fonts / brand typefaces) are allowed only when this spec notes the font-install or embedding requirement.**Typography direction**: [Fill in one phrase, e.g., "modern CJK sans" / "academic serif" / "brand-specific: McKinsey Bower (requires font install)"]diff --git a/skills/ppt-master/templates/spec_lock_reference.md b/skills/ppt-master/templates/spec_lock_reference.mdindex 561b0ffe..e1e5a7cd 100644--- a/skills/ppt-master/templates/spec_lock_reference.md+++ b/skills/ppt-master/templates/spec_lock_reference.md@@ -73,7 +73,7 @@>> **Size slots are anchors, not a closed menu.** Common slots (`title` / `subtitle` / `annotation`) cover frequent cases. Add role-specific slots (e.g. `cover_title: 88`, `hero_number: 56`, `subheading: 32`, `lead: 30`, `footnote: 16`, `chart_annotation: 16`) for the roles the deck actually uses — common for cover-heavy decks, consulting-style hero numbers, dense pages. **Mandatory — scan `§IX` and declare a slot for every role that recurs across pages, not just the four defaults.** A report / `text`-mode deck almost always recurs a per-page **core-message / lead line** and **page numbers / source credits / footnotes** → declare `lead` and `footnote` for them. `subheading` and `lead` sit between `subtitle` and `body` (their bands overlap `subtitle`) — pick by role, not size — and the core-message `lead` is a **primary** line, **always ≥ `body`**, never smaller. Leaving a recurring lead / footnote undeclared forces the Executor to improvise an unlocked size (and a core line improvised below `body` inverts the hierarchy). **Structural roles (title / body / subtitle / annotation / footnote) render at their locked size on every page — one role, one size, deck-wide.** Intermediate in-band sizes are for special / feature elements only (hero number, display title, one-off emphasis); declare a recurring one as its own slot so it stays consistent too.>-> **⚠️ PPT-safe stack discipline (HARD rule).** PPTX stores one `typeface` per run with no runtime fallback. Every stack MUST end with a cross-platform pre-installed font: `"Microsoft YaHei", sans-serif` / `SimSun, serif` / `Arial, sans-serif` / `"Times New Roman", serif` / `Consolas, "Courier New", monospace`. Non-preinstalled fonts (Inter / Google Fonts / brand typefaces) may lead the stack only when the Design Spec notes the font-install or embedding requirement.+> **⚠️ PPT-safe stack discipline (HARD rule).** PPTX stores concrete exported Latin / EA typefaces per run with no runtime fallback. Every stack's exported Latin / EA typefaces MUST resolve to cross-platform pre-installed fonts: `"Microsoft YaHei"` / `SimSun` / `Arial` / `"Times New Roman"` / `Consolas`. Stacks that export non-preinstalled typefaces (Inter / Google Fonts / brand typefaces) may be used only when the Design Spec notes the font-install or embedding requirement.>> **Stack length discipline.** 3-4 fonts per stack is the sweet spot. Converter only writes the **first** Latin and **first** CJK font into PPTX — everything after is silently dropped. macOS-only families (`Songti SC`, `Menlo`, `Monaco`, `Helvetica`) are auto-mapped to Windows equivalents via `FONT_FALLBACK_WIN` (see `scripts/svg_to_pptx/drawingml_utils.py`); stacking both is redundant. Lead with Windows-preinstalled fonts (`Microsoft YaHei` / `SimSun` / `Arial` / `Georgia` / `Consolas`); keep at most **one** macOS-exclusive family (typically `"PingFang SC"`) as a browser-preview nicety.