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(svg-authoring): enforce transform contracts and template order
hugohe325e7bca85f66
diff --git a/docs/templates-guide.md b/docs/templates-guide.mdindex 0d4ed3e0..2d44365e 100644--- a/docs/templates-guide.md+++ b/docs/templates-guide.md@@ -203,11 +203,11 @@ Library and project scopes use the same core structure; substitute either `skill├── templates/│ ├── design_spec.md│ ├── 01_cover.svg-│ ├── 02_chapter.svg-│ ├── 02_toc.svg # optional-│ ├── 03_content.svg-│ ├── 03a_content_two_col.svg # fidelity variant-│ ├── 04_ending.svg+│ ├── 02_toc.svg # optional; without it: 02_chapter, 03_content, 04_ending+│ ├── 03_chapter.svg+│ ├── 04_content.svg+│ ├── 04a_content_two_col.svg # fidelity variant+│ ├── 05_ending.svg│ └── icons/ # package/validation copy when used├── images/ # optional│ └── *.png / *.jpg # SVG references use ../images/<name>diff --git a/docs/zh/templates-guide.md b/docs/zh/templates-guide.mdindex 2e737dd4..515c4d06 100644--- a/docs/zh/templates-guide.md+++ b/docs/zh/templates-guide.md@@ -203,11 +203,11 @@ PPT Master 的“模板”是一份**结构 + 风格**的预设包:每张 SVG├── templates/│ ├── design_spec.md│ ├── 01_cover.svg-│ ├── 02_chapter.svg-│ ├── 02_toc.svg # 可选-│ ├── 03_content.svg-│ ├── 03a_content_two_col.svg # fidelity 变体-│ ├── 04_ending.svg+│ ├── 02_toc.svg # 可选;不含时为 02_chapter、03_content、04_ending+│ ├── 03_chapter.svg+│ ├── 04_content.svg+│ ├── 04a_content_two_col.svg # fidelity 变体+│ ├── 05_ending.svg│ └── icons/ # 使用时的 package / 校验副本├── images/ # 可选│ └── *.png / *.jpg # SVG 统一引用 ../images/<name>diff --git a/skills/ppt-master/references/shared-standards.md b/skills/ppt-master/references/shared-standards.mdindex 8926a61e..07943229 100644--- a/skills/ppt-master/references/shared-standards.md+++ b/skills/ppt-master/references/shared-standards.md@@ -835,18 +835,30 @@ modes, generated effects, and text-image knockouts are outside editable text.|---|---|| `rotate(angle[, cx, cy])` | Geometry/image/text/ordinary group; `Native-normalized` || `translate(x y)` | Geometry/image/group; pure translation also safe on text; `Native-normalized` |-| Positive scale / negative mirror | Geometry/image only; explicit pivot; `Native-normalized` |-| `matrix(a b c d e f)` | Geometry/image only; transformed axes finite, non-zero, orthogonal; excludes rounded rects; `Native-normalized` |+| Positive scale / negative mirror | Geometry/image or a group/use whose expanded visual subtree is geometry/image only; explicit pivot; `Native-normalized` |+| `matrix(a b c d e f)` | Geometry/image or the same geometry/image-only group/use; transformed axes finite, non-zero, orthogonal; excludes rounded rectangles and subtrees containing them; `Native-normalized` || Source order | Back-to-front PPT z-order; `Native-stable` || `<g opacity>` | Compatible approximate mapping; generated SVG prefers descendant alpha, §2.2 || Local `<use>` | §1.3 compile-time reuse; `Native-normalized` |-Set text size/position directly; do not scale or general-matrix text. `skewX`,-`skewY`, zero/non-orthogonal axes, and shear matrices are forbidden. Native-chart/table markers allow translate/scale only. The §6.10 thick-circle shortcut-does not inherit general transform support. Positive rotation is clockwise and-pivoted rotation normalizes the native frame. A legal transform sequence can-still produce non-orthogonal axes; importer/live-editor matrices do not expand+**Hard rule — closed transform grammar**: Use only lowercase `translate`,+`scale`, `rotate`, and `matrix` with exact finite unitless argument counts:+`translate` 1/2, `scale` 1/2, `rotate` 1/3, and `matrix` 6. Separate arguments+and operations with whitespace or one comma. Leading/trailing/repeated commas,+adjacent operations without a separator, units, unknown functions, and+incomplete input fail quality check and export. Generated numeric tokens use+ordinary decimals; a supported leading `+`, exponent, or trailing decimal point+remains compatible input and receives a non-blocking normalization warning.++Set text size/position directly. A text transform is either a translate-only+list or one rotate operation; do not scale, matrix-transform, or mix operations+on text. A group containing text follows the same translate-only/single-rotate+limit. `skewX`, `skewY`, zero/non-orthogonal axes, and shear matrices are+forbidden. Native chart/table markers allow translate/scale only. The §6.10+thick-circle shortcut does not inherit general transform support. Positive+rotation is clockwise and pivoted rotation normalizes the native frame. Every+cumulative matrix, including transforms split across ancestors, must remain+finite, non-zero, and orthogonal; importer/live-editor matrices do not expandthe hand-authored contract.Mirror around vertical pivot `cx` with`translate(cx 0) scale(-1 1) translate(-cx 0)`; use the analogous Y sequence@@ -943,7 +955,8 @@ compound ring.**Thick-circle shorthand — `Approximate`, non-position-sensitive only**:-- One circle per segment; `fill="none"`; no element transform or ancestor full-matrix.+- One circle per segment; `fill="none"`; the circle may use one `rotate` for its+ start angle, and ancestor transforms must be translate-only.- Exactly two non-preset finite unitless values (`dash gap`); finite unitless `stroke-dashoffset`.- `0 < stroke-width < 2r`, `stroke-width/r >= 0.15`,`0 < dash < 2πr`, `gap >= 0`, and `dash + gap >= 2πr`.diff --git a/skills/ppt-master/references/template-designer.md b/skills/ppt-master/references/template-designer.mdindex 070eea6a..c97132a3 100644--- a/skills/ppt-master/references/template-designer.md+++ b/skills/ppt-master/references/template-designer.md@@ -81,7 +81,7 @@ The output page set is determined by **replication mode**, declared in the final| Mode | When to use | Roster ||------|-------------|--------|-| `standard` (default) | Most templates — clean, reusable, balanced coverage | `01_cover`, `02_chapter`, `03_content`, `04_ending`, optional `02_toc` |+| `standard` (default) | Most templates — clean, reusable, balanced coverage | `01_cover`, `02_chapter`, `03_content`, `04_ending`; with the optional TOC the roster is `01_cover`, `02_toc`, `03_chapter`, `04_content`, `05_ending` || `fidelity` | User wants a broader, source-aligned but newly designed template | Standard roster + intentionally designed variants that cover useful reference compositions || `mirror` | User wants the source template restored | One SVG prototype restored from the lossless source per source slide, named `<NNN>_<page_type>.svg` by source order |@@ -99,7 +99,7 @@ The output page set is determined by **replication mode**, declared in the final**Design philosophy**: Templates define visual consistency and structural pages; content pages maintain maximum flexibility.-**Naming note**: TOC page keeps `02_toc.svg` naming for template library compatibility and sort order.+**Naming note**: The numeric prefix is the template's own presentation order and stays contiguous with no duplicate index. When the optional TOC page is included it takes `02_toc.svg` and the later types shift by one: `01_cover`, `02_toc`, `03_chapter`, `04_content`, `05_ending`. Numbers carry no meaning across templates — tooling derives the page type from the token after the underscore, so both spellings of each type are equivalent.### Fidelity mode@@ -113,7 +113,7 @@ When the brief sets `Replication mode: fidelity`, design a broader reusable rost| Content | `03a_content_two_col.svg`, `03b_content_data_card.svg`, `03c_content_quote.svg` || Ending | `04a_ending_thanks.svg`, `04b_ending_contact.svg` |-Extension page types beyond the canonical four (transition / appendix / disclaimer / divider) take the next free index: `05_section_break.svg`, `06_appendix.svg`, `07_disclaimer.svg`.+Extension page types beyond the canonical four (transition / appendix / disclaimer / divider) take the next free index after the roster: `05_section_break.svg`, `06_appendix.svg`, `07_disclaimer.svg` in a four-page roster (one higher when `02_toc` is present).**Roster decision**:@@ -411,10 +411,10 @@ Standard mode (default):├── templates/│ ├── design_spec.md│ ├── 01_cover.svg-│ ├── 02_chapter.svg-│ ├── 02_toc.svg # Optional-│ ├── 03_content.svg-│ ├── 04_ending.svg+│ ├── 02_toc.svg # Optional; without it: 02_chapter, 03_content, 04_ending+│ ├── 03_chapter.svg+│ ├── 04_content.svg+│ ├── 05_ending.svg│ └── icons/ # Package/validation copy, when used├── images/ # Optional; omit when unused│ └── *.png / *.jpg # SVG href is ../images/<name>@@ -430,14 +430,14 @@ Fidelity mode changes only the roster under `templates/`, e.g.:<template_workspace>/templates/├── design_spec.md├── 01_cover.svg-├── 02a_chapter_full.svg-├── 02b_chapter_minimal.svg├── 02_toc.svg-├── 03a_content_two_col.svg-├── 03b_content_data_card.svg-├── 03c_content_quote.svg-├── 04_ending.svg-└── 05_section_break.svg+├── 03a_chapter_full.svg+├── 03b_chapter_minimal.svg+├── 04a_content_two_col.svg+├── 04b_content_data_card.svg+├── 04c_content_quote.svg+├── 05_ending.svg+└── 06_section_break.svg```Mirror mode emits one SVG per source slide, named by source order:diff --git a/skills/ppt-master/scripts/svg_quality_checker.py b/skills/ppt-master/scripts/svg_quality_checker.pyindex ea974484..cda4371c 100644--- a/skills/ppt-master/scripts/svg_quality_checker.py+++ b/skills/ppt-master/scripts/svg_quality_checker.py@@ -61,13 +61,16 @@ try:font_px_to_hpt as _font_px_to_hpt,is_canonical_project_geometry_length as _is_canonical_project_geometry_length,iter_project_geometry_lengths as _iter_project_geometry_lengths,+ iter_project_transforms as _iter_project_transforms,matrix_multiply as _matrix_multiply,+ noncanonical_transform_numbers as _noncanonical_transform_numbers,parse_transform_matrix as _parse_transform_matrix,parse_font_family as _parse_export_font_family,parse_inline_style as _parse_inline_style,parse_project_geometry_length as _parse_project_geometry_length,parse_svg_color as _parse_export_color,parse_svg_length as _parse_export_length,+ project_transform_errors as _project_transform_errors,rect_to_dml_xfrm as _rect_to_dml_xfrm,validate_dml_shape_matrix as _validate_dml_shape_matrix,)@@ -79,13 +82,16 @@ except ImportError:_font_px_to_hpt = None_is_canonical_project_geometry_length = None_iter_project_geometry_lengths = None+ _iter_project_transforms = None_matrix_multiply = None+ _noncanonical_transform_numbers = None_parse_transform_matrix = None_parse_export_font_family = None_parse_inline_style = None_parse_project_geometry_length = None_parse_export_color = None_parse_export_length = None+ _project_transform_errors = None_rect_to_dml_xfrm = None_validate_dml_shape_matrix = None@@ -984,13 +990,19 @@ class SVGQualityChecker:# or build content variants with bespoke slot vocabularies.## Variants reuse the parent type's expectation (`03a_content_two_col.svg`- # is matched by the same `03_content` rules as `03_content.svg`).+ # is matched by the same `content` rules as `03_content.svg`).+ #+ # Keys are page-type tokens, not numbered stems: template numbering is+ # presentation order within one template and shifts when the optional+ # TOC page is present (`02_chapter` in a four-page roster, `03_chapter`+ # in a five-page roster with `02_toc`), so the defaults must apply to+ # both spellings.DEFAULT_PLACEHOLDER_CONVENTION = {- "01_cover": ("{{TITLE}}",), # only the title is universally expected- "02_chapter": ("{{CHAPTER_TITLE}}",),- "02_toc": (), # TOC layouts vary too widely to assert anything- "03_content": ("{{PAGE_TITLE}}",),- "04_ending": (), # ending pages legitimately use varied vocabularies+ "cover": ("{{TITLE}}",), # only the title is universally expected+ "chapter": ("{{CHAPTER_TITLE}}",),+ "toc": (), # TOC layouts vary too widely to assert anything+ "content": ("{{PAGE_TITLE}}",),+ "ending": (), # ending pages legitimately use varied vocabularies}def __init__(self, *, template_mode: bool = False):@@ -1063,12 +1075,6 @@ class SVGQualityChecker:# produce misleading errors on a broken document.root = self._parse_xml_root(content, result)if root is not None:- if root.get('transform'):- result['errors'].append(- 'Root <svg> transform is unsupported; apply transforms '- 'to child elements or groups'- )-# 1. Check viewBoxself._check_viewbox(root, result, expected_format)@@ -1081,7 +1087,10 @@ class SVGQualityChecker:# 2b. Validate complete path-data and point-list grammar.self._check_freeform_geometry_values(root, result)- # 2c. Validate the closed authoring-property surface and+ # 2c. Validate complete transform grammar and native mappings.+ self._check_transform_values(root, result)++ # 2d. Validate the closed authoring-property surface and# conditional definition interfaces before export.self._check_authoring_property_contract(root, result)self._check_paint_compatibility(root, result)@@ -1090,10 +1099,10 @@ class SVGQualityChecker:self._check_marker_contract(root, result)self._check_clip_path_contract(root, result)- # 2c. Validate the supported shadow/glow filter interface.+ # 2e. Validate the supported shadow/glow filter interface.self._check_filter_effects(root, result)- # 2d. Validate gradient definitions, stops, and coordinates.+ # 2f. Validate gradient definitions, stops, and coordinates.self._check_gradient_interfaces(root, result)# 3. Check font-size values@@ -2224,6 +2233,68 @@ class SVGQualityChecker:f"decimal spelling {normalized!r}. No change is required for export.")+ def _check_transform_values(+ self,+ root: ET.Element,+ result: Dict,+ ) -> None:+ """Reject invalid transforms and advise ordinary decimal spelling."""+ helpers = (+ _format_project_geometry_length,+ _iter_project_transforms,+ _noncanonical_transform_numbers,+ _project_transform_errors,+ )+ if any(helper is None for helper in helpers):+ result['warnings'].append(+ "Unable to import svg_to_pptx transform validators; "+ "native export will still validate transform syntax."+ )+ return++ transform_errors = set(_project_transform_errors(root))+ if (+ not transform_errors+ and _expand_local_use_references is not None+ and _UseExpansionError is not None+ ):+ expanded_root = copy.deepcopy(root)+ try:+ _expand_local_use_references(expanded_root)+ except _UseExpansionError:+ # The local-reference check owns the actionable diagnostic.+ pass+ else:+ transform_errors.update(_project_transform_errors(expanded_root))+ result['errors'].extend(+ f'Invalid SVG transform: {error}'+ for error in sorted(transform_errors)+ )++ recommendations: Counter[tuple[str, str]] = Counter()+ examples: Dict[tuple[str, str], List[str]] = defaultdict(list)+ for elem, raw in _iter_project_transforms(root):+ try:+ compatible_numbers = _noncanonical_transform_numbers(raw)+ except ValueError:+ continue+ for number in compatible_numbers:+ normalized = _format_project_geometry_length(float(number))+ key = (number, normalized)+ recommendations[key] += 1+ label = _element_label(elem)+ if label not in examples[key] and len(examples[key]) < 3:+ examples[key].append(label)++ for (raw, normalized), count in sorted(recommendations.items()):+ shown_examples = ', '.join(examples[(raw, normalized)])+ result['warnings'].append(+ f"Recommendation: transform numeric token {raw!r} is "+ f"converter-compatible in {count} occurrence(s) "+ f"({shown_examples}); generated SVG should prefer the ordinary "+ f"decimal spelling {normalized!r}. No change is required for export."+ )+def _check_font_size_values(self, content: str, result: Dict):"""Keep supported font-size units compatible and recommend unitless px."""canonical_re = re.compile(r'^(?:\d+(?:\.\d+)?|\.\d+)$')@@ -4676,7 +4747,9 @@ class SVGQualityChecker:2. ``overrides[<page_type_prefix>]`` — frontmatter entry for thevariant's parent type (e.g. ``03_content`` for``03a_content_two_col``)- 3. ``DEFAULT_PLACEHOLDER_CONVENTION[<page_type_prefix>]``+ 3. ``DEFAULT_PLACEHOLDER_CONVENTION[<page_type>]`` — keyed by the+ type token alone, so it applies regardless of where the type+ lands in the template's presentation-order numberingReturns ``None`` for stems with no matching convention or override —e.g. extension pages like ``05_section_break``. ``()`` (empty tuple)@@ -4696,7 +4769,7 @@ class SVGQualityChecker:key = f"{num}_{kind}"if key in overrides:return overrides[key]- return cls.DEFAULT_PLACEHOLDER_CONVENTION.get(key)+ return cls.DEFAULT_PLACEHOLDER_CONVENTION.get(kind)def _print_result(self, result: Dict):"""Print check result for a single file"""diff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml/converter.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml/converter.pyindex efe94345..3518e397 100644--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml/converter.py+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml/converter.py@@ -36,9 +36,13 @@ from .utils import (_extract_inheritable_styles,_get_attr,parse_svg_length,+ parse_transform_operations,parse_transform_matrix,project_geometry_length_errors,+ project_transform_errors,resolve_url_id,+ supports_full_project_transform,+ validate_dml_shape_matrix,)from .styles import (build_effect_xml, build_fill_xml,@@ -79,6 +83,22 @@ def _require_project_freeform_geometry()+def _require_project_transforms(+ root: ET.Element,+ svg_path: Path | str,+) -> None:+ """Reject invalid project transform syntax and mappings before conversion."""+ errors = project_transform_errors(root)+ if not errors:+ return+ preview = '; '.join(errors[:8])+ suffix = '' if len(errors) <= 8 else f'; +{len(errors) - 8} more'+ raise SvgNativeConversionError(+ f'{Path(svg_path).name}: invalid project transform(s): '+ f'{preview}{suffix}'+ )++# ---------------------------------------------------------------------------# Transform & layout helpers# ---------------------------------------------------------------------------@@ -91,17 +111,17 @@ def parse_transform(transform_str: str) -> tuple[float, float, float, float, flo``translate(cx cy) scale(-1 -1) translate(-cx -cy)`` which encode a fliparound a non-origin pivot.- When the composed matrix has no shear and no rotation, the decomposition is- exact (sx/sy may be negative to represent flips). When rotation is present- without shear, sx/sy default to the column magnitudes and angle_deg is the- rotation. Shear is not representable in this 5-tuple and silently- collapses; callers that need exact fidelity should consume the full matrix- via ``parse_transform_matrix``.+ When the composed matrix has no rotation, the decomposition preserves+ signed scale for flips. With rotation, scale uses the column magnitudes and+ angle uses the first transformed axis. Zero or non-orthogonal axes fail+ before decomposition because this tuple cannot represent them faithfully."""if not transform_str:return 0.0, 0.0, 1.0, 1.0, 0.0- a, b, c, d, e, f = parse_transform_matrix(transform_str)+ matrix = parse_transform_matrix(transform_str)+ validate_dml_shape_matrix(matrix)+ a, b, c, d, e, f = matrix# No shear / rotation: direct decomposition preserves the original signs of# sx / sy. ctx_x / ctx_y use the simple ``val * sx + tx`` formula, so this@@ -127,11 +147,6 @@ def parse_transform(transform_str: str) -> tuple[float, float, float, float, flo# around (cx, cy). DrawingML grpSp ``rot`` always rotates around the group's# own bounding-box centre — we need the SVG pivot so ``convert_g`` can# compensate for the offset between those two centres.-_ROTATE_RE = re.compile(- r'rotate\(\s*([-\d.eE+]+)(?:[\s,]+([-\d.eE+]+)[\s,]+([-\d.eE+]+))?\s*\)'-)--def _root_viewport_size(root: ET.Element) -> tuple[float, float]:"""Return the SVG root viewport size in user units."""view_box = root.get('viewBox')@@ -159,14 +174,12 @@ def _extract_rotate_pivot(transform_str: str) -> tuple[float, float] | None:"""if not transform_str:return None- ops = [op for op in re.findall(r'(\w+)\s*\(', transform_str) if op]- if ops != ['rotate']:+ operations = parse_transform_operations(transform_str)+ if len(operations) != 1 or operations[0][0] != 'rotate':return None- match = _ROTATE_RE.search(transform_str)- if not match:- return None- cx = float(match.group(2)) if match.group(2) is not None else 0.0- cy = float(match.group(3)) if match.group(3) is not None else 0.0+ args = operations[0][1]+ cx = args[1] if len(args) == 3 else 0.0+ cy = args[2] if len(args) == 3 else 0.0return cx, cy@@ -347,8 +360,11 @@ def convert_g(elem: ET.Element, ctx: ConvertContext) -> ShapeResult | None:child for child in elemif child.tag.replace(f'{{{SVG_NS}}}', '') not in _NON_VISUAL_TAGS]- matrix_supported = not native_subtree_active and bool(transform) and visual_children and all(- _supports_matrix_transform(child) for child in visual_children+ matrix_supported = (+ not native_subtree_active+ and bool(transform)+ and visual_children+ and supports_full_project_transform(elem))# A pure ``rotate(angle [cx cy])`` falls through to the fallback path# below (children are rect/text/path/etc. that don't consume a full@@ -603,30 +619,6 @@ def convert_g(elem: ET.Element, ctx: ConvertContext) -> ShapeResult | None:_NON_VISUAL_TAGS = frozenset(('defs', 'title', 'desc', 'metadata', 'style'))--def _supports_matrix_transform(elem: ET.Element) -> bool:- """Return whether this subtree can consume a full affine matrix directly."""- tag = elem.tag.replace(f'{{{SVG_NS}}}', '')- if tag in {'rect', 'circle', 'ellipse', 'line', 'path', 'polygon', 'polyline', 'image'}:- return True- if tag == 'svg':- visual_children = [- child for child in elem- if child.tag.replace(f'{{{SVG_NS}}}', '') not in _NON_VISUAL_TAGS- ]- return len(visual_children) == 1 and (- visual_children[0].tag.replace(f'{{{SVG_NS}}}', '') == 'image'- )- if tag == 'g':- visual_children = [- child for child in elem- if child.tag.replace(f'{{{SVG_NS}}}', '') not in _NON_VISUAL_TAGS- ]- return bool(visual_children) and all(- _supports_matrix_transform(child) for child in visual_children- )- return False-_CONVERTERS = {'rect': convert_rect,'circle': convert_circle,@@ -1105,11 +1097,6 @@ def convert_svg_to_slide_shapes("""tree = ET.parse(str(svg_path))root = tree.getroot()- if root.get('transform'):- raise SvgNativeConversionError(- 'Root <svg> transform is unsupported; apply transforms to child '- 'elements or groups'- )authored_errors = validate_authored_preset_tree(root)if authored_errors:raise SvgNativeConversionError(@@ -1156,6 +1143,7 @@ def convert_svg_to_slide_shapes()_require_project_freeform_geometry(root, svg_path)+ _require_project_transforms(root, svg_path)viewport_width, viewport_height = _root_viewport_size(root)@@ -1213,6 +1201,9 @@ def convert_svg_to_slide_shapes(if verbose:print(f' Expanded {expanded_local} local <use href="#..."/> instance(s)')+ # Recheck compiler-injected icon/use wrappers and cloned definition trees.+ _require_project_transforms(root, svg_path)+# Flatten positional <tspan> (those with x/y/non-zero dy) into independent# <text> elements. DrawingML runs cannot reposition mid-paragraph, so a# dy-stacked block of tspans would otherwise collapse onto one baseline,diff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml/elements.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml/elements.pyindex 0aaf1553..3f2bdba1 100644--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml/elements.py+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml/elements.py@@ -29,7 +29,7 @@ from .context import ConvertContext, ShapeResultfrom .theme_colors import color_node_xmlfrom .theme_fonts import theme_font_tokensfrom .utils import (- SVG_NS, XLINK_NS, ANGLE_UNIT, FONT_PX_TO_HUNDREDTHS_PT, DASH_PRESETS,+ SVG_NS, XLINK_NS, ANGLE_UNIT, FONT_PX_TO_HUNDREDTHS_PT,px_to_emu, _f, _get_attr, parse_svg_length,svg_length_x, svg_length_y, svg_length_size,ctx_x, ctx_y, ctx_w, ctx_h,@@ -38,7 +38,9 @@ from .utils import (resolve_url_id, get_effective_filter_id,parse_inline_style, parse_font_family, is_cjk_char, estimate_text_width,detect_text_lang, font_px_to_hpt, resolve_text_run_fonts,- matrix_multiply, parse_transform_matrix, transform_point, _xml_escape,+ is_thick_circle_shorthand,+ matrix_multiply, parse_transform_matrix, parse_transform_operations,+ transform_point, _xml_escape,)from .styles import (build_solid_fill, build_gradient_fill,@@ -1020,27 +1022,10 @@ def _build_arc_ring_path(def _is_donut_circle(elem: ET.Element, ctx: ConvertContext) -> bool:"""Detect if a circle uses stroke-dasharray to simulate an arc segment."""dasharray = _get_attr(elem, 'stroke-dasharray', ctx)- if not dasharray or dasharray == 'none':- return Falsestroke = _get_attr(elem, 'stroke', ctx)- if not stroke or stroke == 'none':- return False-sw = svg_length_size(_get_attr(elem, 'stroke-width', ctx), ctx, 0)r = svg_length_size(elem.get('r'), ctx, 0)- if sw <= 0 or r <= 0:- return False-- # Standard dash presets are not donut segments- if dasharray.strip() in DASH_PRESETS:- return False-- # Thin strokes relative to radius are decorative dashed rings, not donut arcs.- # Real donut arcs need sw/r >= 0.15 (e.g. sw=40 on r=100 → 0.40).- if sw / r < 0.15:- return False-- return True+ return is_thick_circle_shorthand(dasharray, stroke, sw, r)def convert_circle(elem: ET.Element, ctx: ConvertContext) -> ShapeResult | None:@@ -1063,9 +1048,13 @@ def convert_circle(elem: ET.Element, ctx: ConvertContext) -> ShapeResult | None:rotate_deg = 0.0transform = elem.get('transform', '')- r_match = re.search(r'rotate\(\s*([-\d.]+)', transform)- if r_match:- rotate_deg = float(r_match.group(1))+ if transform:+ operations = parse_transform_operations(transform)+ if len(operations) != 1 or operations[0][0] != 'rotate':+ raise ValueError(+ 'Thick-circle arc transform must be one rotate operation'+ )+ rotate_deg = operations[0][1][0]geom, min_x, min_y, w_emu, h_emu = _build_arc_ring_path(ctx_x(cx_, ctx) / ctx.scale_x,@@ -2351,16 +2340,26 @@ def convert_text(elem: ET.Element, ctx: ConvertContext) -> ShapeResult | None:box_h = text_height + paddingtext_transform = elem.get('transform', '')- if text_transform and 'rotate' not in text_transform and not ctx.use_transform_matrix:- try:- a, b, c, d, e, f = parse_transform_matrix(text_transform)- except Exception:- a, b, c, d, e, f = 1.0, 0.0, 0.0, 1.0, 0.0, 0.0+ text_operations = (+ parse_transform_operations(text_transform)+ if text_transform else ()+ )+ translate_only = bool(text_operations) and all(+ name == 'translate' for name, _args in text_operations+ )+ rotate_only = (+ len(text_operations) == 1+ and text_operations[0][0] == 'rotate'+ )+ if text_operations and not (translate_only or rotate_only):+ raise ValueError(+ 'Text transform must be a translate-only list or one rotate operation'+ )+ if translate_only and not ctx.use_transform_matrix:+ a, b, c, d, e, f = parse_transform_matrix(text_transform)# A pure-translate transform on a text element (hand-authored, or written# by a live-preview move) was otherwise ignored here, drifting the text.- # Absorb the translation into the frame position; a scaling transform- # would also need to scale font size / line metrics, so leave- # non-translate transforms alone.+ # Absorb the translation into the frame position.if (abs(a - 1.0) < 1e-9 and abs(b) < 1e-9and abs(c) < 1e-9 and abs(d - 1.0) < 1e-9@@ -2378,26 +2377,22 @@ def convert_text(elem: ET.Element, ctx: ConvertContext) -> ShapeResult | None:# box so its center lands where SVG would place the rotated visual center —# otherwise rotated y-axis labels etc. drift to the wrong location.text_rot = 0- if text_transform:- rot_match = re.search(- r'rotate\(\s*([-\d.]+)(?:[\s,]+([-\d.]+)[\s,]+([-\d.]+))?',- text_transform,- )- if rot_match:- angle_deg = float(rot_match.group(1))- text_rot = int(angle_deg * ANGLE_UNIT)- if rot_match.group(2) is not None:- pivot_x = ctx_x(float(rot_match.group(2)), ctx)- pivot_y = ctx_y(float(rot_match.group(3)), ctx)- cx_box = box_x + box_w / 2- cy_box = box_y + box_h / 2- rad = math.radians(angle_deg)- dx = cx_box - pivot_x- dy = cy_box - pivot_y- new_cx = pivot_x + dx * math.cos(rad) - dy * math.sin(rad)- new_cy = pivot_y + dx * math.sin(rad) + dy * math.cos(rad)- box_x = new_cx - box_w / 2- box_y = new_cy - box_h / 2+ if rotate_only:+ rotate_args = text_operations[0][1]+ angle_deg = rotate_args[0]+ text_rot = int(angle_deg * ANGLE_UNIT)+ if len(rotate_args) == 3:+ pivot_x = ctx_x(rotate_args[1], ctx)+ pivot_y = ctx_y(rotate_args[2], ctx)+ cx_box = box_x + box_w / 2+ cy_box = box_y + box_h / 2+ rad = math.radians(angle_deg)+ dx = cx_box - pivot_x+ dy = cy_box - pivot_y+ new_cx = pivot_x + dx * math.cos(rad) - dy * math.sin(rad)+ new_cy = pivot_y + dx * math.sin(rad) + dy * math.cos(rad)+ box_x = new_cx - box_w / 2+ box_y = new_cy - box_h / 2# Alignmentalgn_map = {'start': 'l', 'middle': 'ctr', 'end': 'r'}diff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.pyindex cab0e2a7..acc0c0ec 100644--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.py+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.py@@ -1,4 +1,8 @@-"""Coordinate helpers, color parsing, and font utilities for DrawingML conversion."""+"""Coordinate, transform, color, and font helpers for DrawingML conversion.++See references/shared-standards.md §2.1 and §6.8 for project geometry and+transform authoring contracts.+"""from __future__ import annotations@@ -142,6 +146,24 @@ DASH_PRESETS = {}+def is_thick_circle_shorthand(+ dasharray: str | None,+ stroke: str | None,+ stroke_width: float,+ radius: float,+) -> bool:+ """Return whether one circle uses the converter's thick-arc shorthand."""+ if not dasharray or dasharray.strip().lower() == 'none':+ return False+ if not stroke or stroke.strip().lower() == 'none':+ return False+ if dasharray.strip() in DASH_PRESETS:+ return False+ if stroke_width <= 0 or radius <= 0:+ return False+ return stroke_width / radius >= 0.15++# ---------------------------------------------------------------------------# Coordinate helpers# ---------------------------------------------------------------------------@@ -312,8 +334,39 @@ def svg_length_size(val: str | None, ctx: ConvertContext, default: float = 0.0)# SVG transform matrix helpers# ----------------------------------------------------------------------------_TRANSFORM_RE = re.compile(r'([a-zA-Z]+)\(([^)]*)\)')-_NUMBER_RE = re.compile(r'[-+]?(?:\d*\.\d+|\d+\.?)(?:[eE][-+]?\d+)?')+_TRANSFORM_NUMBER_PATTERN = (+ r'[-+]?(?:\d*\.\d+|\d+\.?)(?:[eE][-+]?\d+)?'+)+_TRANSFORM_NUMBER_RE = re.compile(_TRANSFORM_NUMBER_PATTERN)+_CANONICAL_TRANSFORM_NUMBER_RE = re.compile(+ r'-?(?:\d+(?:\.\d+)?|\.\d+)$'+)+_TRANSFORM_OPERATION_RE = re.compile(r'([A-Za-z]+)\(([^()]*)\)')+_TRANSFORM_WHITESPACE_RE = re.compile(r'[ \t\r\n]*')+_TRANSFORM_SEPARATOR_PATTERN = (+ r'(?:[ \t\r\n]+|[ \t\r\n]*,[ \t\r\n]*)'+)+_TRANSFORM_SEPARATOR_RE = re.compile(_TRANSFORM_SEPARATOR_PATTERN)+_TRANSFORM_ARGUMENTS_RE = re.compile(+ rf'[ \t\r\n]*{_TRANSFORM_NUMBER_PATTERN}'+ rf'(?:{_TRANSFORM_SEPARATOR_PATTERN}{_TRANSFORM_NUMBER_PATTERN})*'+ r'[ \t\r\n]*'+)+_TRANSFORM_ARITIES = {+ 'matrix': frozenset({6}),+ 'translate': frozenset({1, 2}),+ 'scale': frozenset({1, 2}),+ 'rotate': frozenset({1, 3}),+}+_FULL_TRANSFORM_TAGS = frozenset({+ 'rect', 'circle', 'ellipse', 'line', 'path', 'polygon', 'polyline',+ 'image',+})+_TRANSFORM_CONTAINER_TAGS = frozenset({'g', 'use'})+_TRANSFORM_DEFINITION_BOUNDARIES = frozenset({'clipPath', 'marker', 'pattern'})+_NON_VISUAL_TRANSFORM_CHILD_TAGS = frozenset({+ 'defs', 'title', 'desc', 'metadata', 'style',+})def matrix_multiply(left: AffineMatrix, right: AffineMatrix) -> AffineMatrix:@@ -351,70 +404,129 @@ def _rotate_matrix(angle_deg: float, cx: float | None = None, cy: float | None =)-def _skew_matrix(angle_deg: float, *, x_axis: bool) -> AffineMatrix:- radians = math.radians(angle_deg)- if abs(math.cos(radians)) <= 1e-12:- raise ValueError(f'Invalid SVG skew angle {angle_deg!r}')- tangent = math.tan(radians)- if x_axis:- return (1.0, 0.0, tangent, 1.0, 0.0, 0.0)- return (1.0, tangent, 0.0, 1.0, 0.0, 0.0)---def parse_transform_matrix(transform_str: str) -> AffineMatrix:- """Parse a complete SVG transform list into one affine matrix.-- Unsupported or malformed operations fail closed. Treating an unknown- operation as the identity would silently discard a visible SVG edit.- """+def _parse_transform_operations(+ transform_str: str,+) -> tuple[+ tuple[tuple[str, tuple[float, ...]], ...],+ tuple[str, ...],+]:+ """Parse a complete project transform list and retain numeric tokens."""if not transform_str:- return IDENTITY_MATRIX+ return (), ()- matrix = IDENTITY_MATRIX+ operations: list[tuple[str, tuple[float, ...]]] = []+ number_tokens: list[str] = []cursor = 0- matched = False- for match in _TRANSFORM_RE.finditer(transform_str):- if re.fullmatch(r'[\s,]*', transform_str[cursor:match.start()]) is None:- raise ValueError(f'Invalid SVG transform syntax {transform_str!r}')- matched = True+ matches = list(_TRANSFORM_OPERATION_RE.finditer(transform_str))+ if not matches:+ if _TRANSFORM_WHITESPACE_RE.fullmatch(transform_str):+ raise ValueError('SVG transform must not be empty')+ raise ValueError(f'Invalid SVG transform syntax {transform_str!r}')++ for index, match in enumerate(matches):+ gap = transform_str[cursor:match.start()]+ gap_pattern = (+ _TRANSFORM_WHITESPACE_RE+ if index == 0 else _TRANSFORM_SEPARATOR_RE+ )+ if gap_pattern.fullmatch(gap) is None:+ if index > 0 and not gap:+ raise ValueError(+ f'SVG transform operations require a separator at '+ f'offset {cursor}'+ )+ raise ValueError(+ f'Invalid SVG transform syntax at offset {cursor}: '+ f'{gap!r}'+ )name, raw_args = match.groups()- if re.fullmatch(r'(?:[\s,]*' + _NUMBER_RE.pattern + r')*[\s,]*', raw_args) is None:- raise ValueError(f'Invalid arguments for SVG transform {name!r}')- args = [float(n) for n in _NUMBER_RE.findall(raw_args)]- if not all(math.isfinite(value) for value in args):+ if name not in _TRANSFORM_ARITIES:+ raise ValueError(+ f'Unsupported SVG transform operation {name!r}; use lowercase '+ 'matrix, translate, scale, or rotate'+ )+ if raw_args.strip() and _TRANSFORM_ARGUMENTS_RE.fullmatch(raw_args) is None:+ raise ValueError(+ f'Invalid arguments for SVG transform {name!r}: {raw_args!r}'+ )+ tokens = tuple(_TRANSFORM_NUMBER_RE.findall(raw_args))+ values = tuple(float(token) for token in tokens)+ if not all(math.isfinite(value) for value in values):raise ValueError(f'Non-finite arguments for SVG transform {name!r}')- name = name.lower()- if name == 'matrix' and len(args) == 6:+ if len(values) not in _TRANSFORM_ARITIES[name]:+ expected = '/'.join(str(value) for value in sorted(_TRANSFORM_ARITIES[name]))+ raise ValueError(+ f'SVG transform {name!r} has {len(values)} argument(s); '+ f'expected {expected}'+ )+ operations.append((name, values))+ number_tokens.extend(tokens)+ cursor = match.end()++ trailing = transform_str[cursor:]+ if _TRANSFORM_WHITESPACE_RE.fullmatch(trailing) is None:+ raise ValueError(+ f'Invalid SVG transform trailing syntax at offset {cursor}: '+ f'{trailing!r}'+ )++ return tuple(operations), tuple(number_tokens)+++def parse_transform_operations(+ transform_str: str,+) -> tuple[tuple[str, tuple[float, ...]], ...]:+ """Parse one complete supported SVG transform list."""+ operations, _ = _parse_transform_operations(transform_str)+ return operations+++def noncanonical_transform_numbers(transform_str: str) -> tuple[str, ...]:+ """Return compatible transform numbers generated SVG should normalize."""+ _, tokens = _parse_transform_operations(transform_str)+ return tuple(+ token+ for token in tokens+ if _CANONICAL_TRANSFORM_NUMBER_RE.fullmatch(token) is None+ )+++def _transform_operations_matrix(+ operations: tuple[tuple[str, tuple[float, ...]], ...],+) -> AffineMatrix:+ matrix = IDENTITY_MATRIX+ for name, args in operations:+ if name == 'matrix':local = (args[0], args[1], args[2], args[3], args[4], args[5])- elif name == 'translate' and len(args) in {1, 2}:- local = _translate_matrix(args[0], args[1] if len(args) > 1 else 0.0)- elif name == 'scale' and len(args) in {1, 2}:- local = _scale_matrix(args[0], args[1] if len(args) > 1 else None)- elif name == 'rotate' and len(args) in {1, 3}:+ elif name == 'translate':+ local = _translate_matrix(+ args[0],+ args[1] if len(args) > 1 else 0.0,+ )+ elif name == 'scale':+ local = _scale_matrix(+ args[0],+ args[1] if len(args) > 1 else None,+ )+ else:local = _rotate_matrix(args[0],args[1] if len(args) > 2 else None,args[2] if len(args) > 2 else None,)- elif name == 'skewx' and len(args) == 1:- local = _skew_matrix(args[0], x_axis=True)- elif name == 'skewy' and len(args) == 1:- local = _skew_matrix(args[0], x_axis=False)- else:- raise ValueError(- f'Unsupported or malformed SVG transform {match.group(0)!r}'- )-matrix = matrix_multiply(matrix, local)- cursor = match.end()+ return matrix- if (- not matched- or re.fullmatch(r'[\s,]*', transform_str[cursor:]) is None- ):- raise ValueError(f'Invalid SVG transform syntax {transform_str!r}')- return matrix+def parse_transform_matrix(transform_str: str) -> AffineMatrix:+ """Parse a complete SVG transform list into one affine matrix.++ Unsupported or malformed operations fail closed. Treating an unknown+ operation as the identity would silently discard a visible SVG edit.+ """+ if not transform_str:+ return IDENTITY_MATRIX+ return _transform_operations_matrix(parse_transform_operations(transform_str))def transform_point(matrix: AffineMatrix, x: float, y: float) -> tuple[float, float]:@@ -425,22 +537,343 @@ def transform_point(matrix: AffineMatrix, x: float, y: float) -> tuple[float, fldef validate_dml_shape_matrix(matrix: AffineMatrix) -> None:"""Reject affine shear that a DrawingML shape transform cannot express."""+ if not all(math.isfinite(value) for value in matrix):+ raise ValueError('SVG transform produces non-finite matrix values')a, b, c, d, _e, _f = matrixx_length = math.hypot(a, b)y_length = math.hypot(c, d)+ if not math.isfinite(x_length) or not math.isfinite(y_length):+ raise ValueError('SVG transform produces non-finite axis lengths')if x_length <= 1e-12 or y_length <= 1e-12:raise ValueError('SVG zero-scale transform cannot be represented by a visible ''DrawingML shape')- dot = a * c + b * d- if abs(dot) > x_length * y_length * 1e-9:+ normalized_dot = (+ (a / x_length) * (c / y_length)+ + (b / x_length) * (d / y_length)+ )+ if not math.isfinite(normalized_dot) or abs(normalized_dot) > 1e-9:raise ValueError('SVG shear/skew cannot be represented by a DrawingML ''shape transform')+def _svg_element_tag(elem: ET.Element) -> str | None:+ raw_tag = str(elem.tag)+ if raw_tag.startswith('{'):+ namespace, tag = raw_tag[1:].split('}', 1)+ return tag if namespace == SVG_NS else None+ return raw_tag+++def _transform_element_label(elem: ET.Element) -> str:+ tag = _svg_element_tag(elem) or str(elem.tag)+ elem_id = elem.get('id')+ return f'<{tag} id={elem_id!r}>' if elem_id else f'<{tag}>'+++def _visual_transform_children(elem: ET.Element) -> list[ET.Element]:+ return [+ child+ for child in elem+ if _svg_element_tag(child) not in _NON_VISUAL_TRANSFORM_CHILD_TAGS+ ]+++def _iter_visual_transform_tree(elem: ET.Element) -> Iterator[ET.Element]:+ """Yield one rendered subtree while excluding definition/metadata branches."""+ yield elem+ for child in _visual_transform_children(elem):+ yield from _iter_visual_transform_tree(child)+++_TRANSFORM_ARC_STYLE_ATTRS = (+ 'stroke',+ 'stroke-width',+ 'stroke-dasharray',+)+++def _transform_arc_styles(+ elem: ET.Element,+ inherited: dict[str, str] | None = None,+) -> dict[str, str]:+ values = dict(inherited or {})+ inline_style = parse_inline_style(elem.get('style'))+ for name in _TRANSFORM_ARC_STYLE_ATTRS:+ direct = elem.get(name)+ if direct is not None:+ values[name] = direct+ if name in inline_style:+ values[name] = inline_style[name]+ return values+++def _is_project_thick_circle(+ elem: ET.Element,+ arc_styles: dict[str, str],+) -> bool:+ if _svg_element_tag(elem) != 'circle':+ return False+ try:+ radius = parse_project_geometry_length(elem.get('r') or '0', 'r')+ stroke_width = parse_project_geometry_length(+ arc_styles.get('stroke-width', '0'),+ 'stroke-width',+ )+ except ValueError:+ # Geometry preflight owns malformed length diagnostics.+ return False+ return is_thick_circle_shorthand(+ arc_styles.get('stroke-dasharray'),+ arc_styles.get('stroke'),+ stroke_width,+ radius,+ )+++def supports_full_project_transform(+ elem: ET.Element,+ inherited_arc_styles: dict[str, str] | None = None,+) -> bool:+ """Return whether one subtree can consume an affine matrix without text loss."""+ tag = _svg_element_tag(elem)+ arc_styles = _transform_arc_styles(elem, inherited_arc_styles)+ if _is_project_thick_circle(elem, arc_styles):+ # Thick-circle arcs consume scalar context plus one local rotation;+ # treating an ancestor as a full matrix would silently drop it.+ return False+ if tag in _FULL_TRANSFORM_TAGS:+ return True+ if tag == 'use':+ # Local/data-icon use references are validated again after expansion.+ return True+ if tag == 'svg':+ children = _visual_transform_children(elem)+ return len(children) == 1 and _svg_element_tag(children[0]) == 'image'+ if tag == 'g':+ children = _visual_transform_children(elem)+ return bool(children) and all(+ supports_full_project_transform(child, arc_styles)+ for child in children+ )+ return False+++def iter_project_transforms(+ root: ET.Element,+) -> Iterator[tuple[ET.Element, str]]:+ """Yield explicit SVG transform attributes from the project surface."""+ for elem in root.iter():+ if _svg_element_tag(elem) is None:+ continue+ raw = elem.get('transform')+ if raw is not None:+ yield elem, raw+++def _has_positive_rounding(elem: ET.Element) -> bool:+ for attr in ('rx', 'ry'):+ raw = elem.get(attr)+ if raw is None:+ continue+ try:+ if parse_project_geometry_length(raw, attr) > 0:+ return True+ except ValueError:+ # Geometry preflight owns the malformed length diagnostic.+ continue+ return False+++def _contains_rounded_rect(elem: ET.Element) -> bool:+ return any(+ _svg_element_tag(descendant) == 'rect'+ and _has_positive_rounding(descendant)+ for descendant in _iter_visual_transform_tree(elem)+ )+++def _contains_native_marker(elem: ET.Element) -> bool:+ return any(+ descendant.get('data-pptx-native') in {'table', 'chart'}+ for descendant in _iter_visual_transform_tree(elem)+ )+++def _project_thick_circle_ids(+ root: ET.Element,+) -> set[int]:+ thick_circle_ids: set[int] = set()++ def visit(elem: ET.Element, inherited: dict[str, str] | None = None) -> None:+ arc_styles = _transform_arc_styles(elem, inherited)+ if _is_project_thick_circle(elem, arc_styles):+ thick_circle_ids.add(id(elem))+ for child in elem:+ visit(child, arc_styles)++ visit(root)+ return thick_circle_ids+++def _contains_thick_circle(elem: ET.Element, thick_circle_ids: set[int]) -> bool:+ return any(+ id(descendant) in thick_circle_ids+ for descendant in _iter_visual_transform_tree(elem)+ )+++def _transform_semantic_error(+ elem: ET.Element,+ operations: tuple[tuple[str, tuple[float, ...]], ...],+ *,+ is_root: bool,+ thick_circle_ids: set[int],+) -> str | None:+ tag = _svg_element_tag(elem)+ names = tuple(name for name, _args in operations)+ label = _transform_element_label(elem)++ if is_root:+ return (+ 'Root <svg> transform is unsupported; apply transforms to child '+ 'elements or groups'+ )++ if tag == 'text':+ if all(name == 'translate' for name in names):+ return None+ if len(names) == 1 and names[0] == 'rotate':+ return None+ return (+ f'{label} text transform must be a translate-only list or one '+ 'rotate operation; text scale, matrix, and mixed operations are '+ 'not mapped'+ )++ if tag in _TRANSFORM_CONTAINER_TAGS:+ if _contains_native_marker(elem):+ if all(name in {'translate', 'scale'} for name in names):+ return None+ return (+ f'{label} native table/chart marker transforms support only '+ 'translate and scale'+ )+ if _contains_thick_circle(elem, thick_circle_ids):+ if all(name == 'translate' for name in names):+ return None+ return (+ f'{label} contains a thick-circle arc shorthand; ancestor '+ 'transforms must be translate-only'+ )+ if supports_full_project_transform(elem):+ if 'matrix' in names and _contains_rounded_rect(elem):+ return (+ f'{label} matrix transform cannot target a rounded '+ 'rectangle subtree'+ )+ return None+ if all(name == 'translate' for name in names):+ return None+ if len(names) == 1 and names[0] == 'rotate':+ return None+ return (+ f'{label} contains text or another non-matrix visual; its transform '+ 'must be a translate-only list or one rotate operation'+ )++ if tag in _FULL_TRANSFORM_TAGS:+ if id(elem) in thick_circle_ids:+ if len(names) == 1 and names[0] == 'rotate':+ return None+ return (+ f'{label} thick-circle arc transform must be one rotate '+ 'operation'+ )+ if tag == 'rect' and 'matrix' in names and _has_positive_rounding(elem):+ return f'{label} rounded rectangles cannot use matrix transforms'+ return None++ if tag == 'svg' and supports_full_project_transform(elem):+ return None++ return f'{label} has no registered project transform mapping'+++def project_transform_errors(root: ET.Element) -> list[str]:+ """Return blocking transform grammar and mapping errors for preflight."""+ parent_by_id = {+ id(child): parent+ for parent in root.iter()+ for child in list(parent)+ }+ thick_circle_ids = _project_thick_circle_ids(root)+ parsed: dict[int, tuple[AffineMatrix, bool]] = {}+ errors: set[str] = set()++ for elem, raw in iter_project_transforms(root):+ label = _transform_element_label(elem)+ restricted_ancestor = None+ current = parent_by_id.get(id(elem))+ while current is not None:+ current_tag = _svg_element_tag(current)+ if current_tag in _TRANSFORM_DEFINITION_BOUNDARIES:+ restricted_ancestor = current_tag+ break+ current = parent_by_id.get(id(current))+ if restricted_ancestor is not None:+ errors.add(+ f'{label} cannot use transform inside <{restricted_ancestor}>'+ )+ parsed[id(elem)] = (IDENTITY_MATRIX, False)+ continue++ try:+ operations = parse_transform_operations(raw)+ if not operations:+ raise ValueError('SVG transform must not be empty')+ matrix = _transform_operations_matrix(operations)+ except ValueError as exc:+ errors.add(f'{label} transform={raw!r}: {exc}')+ parsed[id(elem)] = (IDENTITY_MATRIX, False)+ continue++ semantic_error = _transform_semantic_error(+ elem,+ operations,+ is_root=elem is root,+ thick_circle_ids=thick_circle_ids,+ )+ if semantic_error is not None:+ errors.add(semantic_error)+ parsed[id(elem)] = (matrix, semantic_error is None)++ def validate_branch(elem: ET.Element, parent_matrix: AffineMatrix) -> None:+ current_matrix = parent_matrix+ entry = parsed.get(id(elem))+ if entry is not None:+ local_matrix, semantic_ok = entry+ if not semantic_ok:+ return+ current_matrix = matrix_multiply(parent_matrix, local_matrix)+ try:+ validate_dml_shape_matrix(current_matrix)+ except ValueError as exc:+ errors.add(+ f'{_transform_element_label(elem)} has an unsupported '+ f'cumulative transform: {exc}'+ )+ return+ for child in elem:+ validate_branch(child, current_matrix)++ validate_branch(root, IDENTITY_MATRIX)+ return sorted(errors)++def rect_to_dml_xfrm(x: float,y: float,diff --git a/skills/ppt-master/scripts/svg_to_pptx/native_objects/marker_common.py b/skills/ppt-master/scripts/svg_to_pptx/native_objects/marker_common.pyindex 173f87ef..b1809cea 100644--- a/skills/ppt-master/scripts/svg_to_pptx/native_objects/marker_common.py+++ b/skills/ppt-master/scripts/svg_to_pptx/native_objects/marker_common.py@@ -24,6 +24,7 @@ from ..drawingml.utils import (font_px_to_hpt,matrix_multiply,parse_project_geometry_length,+ parse_transform_operations,parse_transform_matrix,transform_point,)@@ -45,15 +46,6 @@ _NATIVE_KINDS = {"table", "chart"}_POWERPOINT_COORD_MIN = -(2**31)_POWERPOINT_COORD_MAX = 2**31 - 1_POWERPOINT_LINE_WIDTH_MAX = 20116800-_NATIVE_TRANSFORM_OPERATION_RE = re.compile(r"([A-Za-z]+)\s*\(([^()]*)\)")-_NATIVE_TRANSFORM_SEPARATOR_RE = re.compile(r"\s*,?\s*")-_NATIVE_TRANSFORM_ARGS_RE = re.compile(- r"\s*"- r"([-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?)"- r"(?:\s*(?:,\s*|\s+)"- r"([-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?))?"- r"\s*"-)_HEX_RE = re.compile(r"^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$")_RGB_RE = re.compile(r"^rgba?\(([^)]+)\)$", re.IGNORECASE)_CSS_NAMED_COLORS = {@@ -268,32 +260,13 @@ def native_marker_transform(transform: str | None) -> tuple[float, float, float,if not raw:return 0.0, 0.0, 1.0, 1.0- cursor = 0- operation_count = 0- for match in _NATIVE_TRANSFORM_OPERATION_RE.finditer(raw):- gap = raw[cursor:match.start()]- valid_gap = (- not gap- if operation_count == 0- else _NATIVE_TRANSFORM_SEPARATOR_RE.fullmatch(gap) is not None- )- if not valid_gap:- raise RuntimeError(- "Native PPTX table/chart markers support translate/scale transforms only"- )- name = match.group(1).lower()- args_match = _NATIVE_TRANSFORM_ARGS_RE.fullmatch(match.group(2))- if name not in {"translate", "scale"} or args_match is None:- raise RuntimeError(- "Native PPTX table/chart markers support translate/scale transforms only"- )- values = [float(value) for value in args_match.groups() if value is not None]- if not all(math.isfinite(value) for value in values):- raise RuntimeError("Native PPTX marker transform values must be finite")- operation_count += 1- cursor = match.end()-- if operation_count == 0 or raw[cursor:]:+ try:+ operations = parse_transform_operations(raw)+ except ValueError as exc:+ raise RuntimeError(+ "Native PPTX table/chart markers support translate/scale transforms only"+ ) from exc+ if any(name not in {"translate", "scale"} for name, _args in operations):raise RuntimeError("Native PPTX table/chart markers support translate/scale transforms only")diff --git a/skills/ppt-master/templates/decks/README.md b/skills/ppt-master/templates/decks/README.mdindex 83f369f2..076f90a0 100644--- a/skills/ppt-master/templates/decks/README.md+++ b/skills/ppt-master/templates/decks/README.md@@ -63,9 +63,10 @@ New deck creation uses the same portable workspace routing in both output scopes├── templates/│ ├── design_spec.md│ ├── 01_cover.svg-│ ├── 02_chapter.svg-│ ├── 03_content.svg-│ └── 04_ending.svg+│ ├── 02_toc.svg # optional; without it: 02_chapter, 03_content, 04_ending+│ ├── 03_chapter.svg+│ ├── 04_content.svg+│ └── 05_ending.svg├── images/ # Optional; omit when unused├── icons/ # Optional; omit when unused└── exports/ # Optional, on-demand review output; Git-ignoreddiff --git "a/skills/ppt-master/templates/decks/\344\270\255\345\233\275\347\224\265\344\277\241/templates/02_chapter.svg" "b/skills/ppt-master/templates/decks/\344\270\255\345\233\275\347\224\265\344\277\241/templates/03_chapter.svg"similarity index 100%rename from "skills/ppt-master/templates/decks/\344\270\255\345\233\275\347\224\265\344\277\241/templates/02_chapter.svg"rename to "skills/ppt-master/templates/decks/\344\270\255\345\233\275\347\224\265\344\277\241/templates/03_chapter.svg"diff --git "a/skills/ppt-master/templates/decks/\344\270\255\345\233\275\347\224\265\344\277\241/templates/03_content.svg" "b/skills/ppt-master/templates/decks/\344\270\255\345\233\275\347\224\265\344\277\241/templates/04_content.svg"similarity index 100%rename from "skills/ppt-master/templates/decks/\344\270\255\345\233\275\347\224\265\344\277\241/templates/03_content.svg"rename to "skills/ppt-master/templates/decks/\344\270\255\345\233\275\347\224\265\344\277\241/templates/04_content.svg"diff --git "a/skills/ppt-master/templates/decks/\344\270\255\345\233\275\347\224\265\344\277\241/templates/04_ending.svg" "b/skills/ppt-master/templates/decks/\344\270\255\345\233\275\347\224\265\344\277\241/templates/05_ending.svg"similarity index 100%rename from "skills/ppt-master/templates/decks/\344\270\255\345\233\275\347\224\265\344\277\241/templates/04_ending.svg"rename to "skills/ppt-master/templates/decks/\344\270\255\345\233\275\347\224\265\344\277\241/templates/05_ending.svg"diff --git "a/skills/ppt-master/templates/decks/\344\270\255\345\233\275\347\224\265\344\277\241/templates/design_spec.md" "b/skills/ppt-master/templates/decks/\344\270\255\345\233\275\347\224\265\344\277\241/templates/design_spec.md"index 564dc9d0..161ce613 100644--- "a/skills/ppt-master/templates/decks/\344\270\255\345\233\275\347\224\265\344\277\241/templates/design_spec.md"+++ "b/skills/ppt-master/templates/decks/\344\270\255\345\233\275\347\224\265\344\277\241/templates/design_spec.md"@@ -50,9 +50,9 @@ page_count: 5| --- | --- | --- | --- | --- | --- || (01_cover.svg) | China Telecom Brand | cover | Cover | 左侧标题簇、右侧品牌卡片、底部飘带 | 标题、副标题、单位、日期 || (02_toc.svg) | China Telecom Content | agenda | Agenda | 左侧品牌说明卡、右侧四行编号目录 | 页面标题、四个目录项、页码 |-| (02_chapter.svg) | China Telecom Brand | section | Section Header | 左侧章节信息、右侧品牌卡片、底部飘带 | 章节号、章节标题、章节副标题 |-| (03_content.svg) | China Telecom Content | content | Title and Content | 红灰页眉与大面积浅灰开放内容区 | 栏目标、页面标题、内容对象、来源、页码 |-| (04_ending.svg) | China Telecom Brand | closing | Closing | 左侧结束语、右侧品牌卡片、底部飘带 | 结束标题、副标题、联系信息、页码 |+| (03_chapter.svg) | China Telecom Brand | section | Section Header | 左侧章节信息、右侧品牌卡片、底部飘带 | 章节号、章节标题、章节副标题 |+| (04_content.svg) | China Telecom Content | content | Title and Content | 红灰页眉与大面积浅灰开放内容区 | 栏目标、页面标题、内容对象、来源、页码 |+| (05_ending.svg) | China Telecom Brand | closing | Closing | 左侧结束语、右侧品牌卡片、底部飘带 | 结束标题、副标题、联系信息、页码 |## VI. Assetsdiff --git "a/skills/ppt-master/templates/decks/\344\270\255\346\261\275\347\240\224/templates/02_chapter.svg" "b/skills/ppt-master/templates/decks/\344\270\255\346\261\275\347\240\224/templates/03_chapter.svg"similarity index 100%rename from "skills/ppt-master/templates/decks/\344\270\255\346\261\275\347\240\224/templates/02_chapter.svg"rename to "skills/ppt-master/templates/decks/\344\270\255\346\261\275\347\240\224/templates/03_chapter.svg"diff --git "a/skills/ppt-master/templates/decks/\344\270\255\346\261\275\347\240\224/templates/03_content.svg" "b/skills/ppt-master/templates/decks/\344\270\255\346\261\275\347\240\224/templates/04_content.svg"similarity index 100%rename from "skills/ppt-master/templates/decks/\344\270\255\346\261\275\347\240\224/templates/03_content.svg"rename to "skills/ppt-master/templates/decks/\344\270\255\346\261\275\347\240\224/templates/04_content.svg"diff --git "a/skills/ppt-master/templates/decks/\344\270\255\346\261\275\347\240\224/templates/04_ending.svg" "b/skills/ppt-master/templates/decks/\344\270\255\346\261\275\347\240\224/templates/05_ending.svg"similarity index 100%rename from "skills/ppt-master/templates/decks/\344\270\255\346\261\275\347\240\224/templates/04_ending.svg"rename to "skills/ppt-master/templates/decks/\344\270\255\346\261\275\347\240\224/templates/05_ending.svg"diff --git "a/skills/ppt-master/templates/decks/\344\270\255\346\261\275\347\240\224/templates/design_spec.md" "b/skills/ppt-master/templates/decks/\344\270\255\346\261\275\347\240\224/templates/design_spec.md"index e1f50f17..a1c5c851 100644--- "a/skills/ppt-master/templates/decks/\344\270\255\346\261\275\347\240\224/templates/design_spec.md"+++ "b/skills/ppt-master/templates/decks/\344\270\255\346\261\275\347\240\224/templates/design_spec.md"@@ -50,9 +50,9 @@ page_count: 5| --- | --- | --- | --- | --- | --- || (01_cover.svg) | CATARC Dark | cover | Cover | 深蓝背景、居中大型 Logo 与标题簇 | 标题、副标题、单位、英文单位 || (02_toc.svg) | CATARC Light | agenda | Agenda | 数字双竖线目录、右侧数据面板 | 页面标题、五个目录项、数据对象、页码 |-| (02_chapter.svg) | CATARC Dark | section | Section Header | 深蓝章节页、居中章节号和标题 | 章节号、章节标题、章节副标题 |-| (03_content.svg) | CATARC Light | content | Title and Content | 方形章节号页眉与开放内容面板 | 章节号、页面标题、内容对象、页码 |-| (04_ending.svg) | CATARC Dark | closing | Closing | 深蓝网格背景、居中 Logo 与结束语 | 结束标题、英文副标题、联系信息、页脚 |+| (03_chapter.svg) | CATARC Dark | section | Section Header | 深蓝章节页、居中章节号和标题 | 章节号、章节标题、章节副标题 |+| (04_content.svg) | CATARC Light | content | Title and Content | 方形章节号页眉与开放内容面板 | 章节号、页面标题、内容对象、页码 |+| (05_ending.svg) | CATARC Dark | closing | Closing | 深蓝网格背景、居中 Logo 与结束语 | 结束标题、英文副标题、联系信息、页脚 |## VI. Assetsdiff --git a/skills/ppt-master/templates/layouts/README.md b/skills/ppt-master/templates/layouts/README.mdindex 6471286c..d490dde6 100644--- a/skills/ppt-master/templates/layouts/README.md+++ b/skills/ppt-master/templates/layouts/README.md@@ -66,7 +66,7 @@ New layout creation uses the same portable workspace routing in both output scop| Library | `skills/ppt-master/templates/layouts/<layout_id>/` | Register in `layouts_index.json` || Project | `projects/<project_name>/` | Do not register globally |-`02_toc.svg` and other roster variants remain optional. All SVGs use `viewBox="0 0 1280 720"` for ppt169. Bitmaps belong in `images/`; extracted runtime icons belong in `icons/`; template sources and any validation icon copy belong in `templates/`.+`02_toc.svg` and other roster variants remain optional; including the TOC shifts the later types to `03_chapter.svg` / `04_content.svg` / `05_ending.svg`, keeping numbering equal to the template's own presentation order. All SVGs use `viewBox="0 0 1280 720"` for ppt169. Bitmaps belong in `images/`; extracted runtime icons belong in `icons/`; template sources and any validation icon copy belong in `templates/`.Omit empty optional directories instead of adding placeholder files. Generate a preview PPTX only when local PowerPoint review is requested; it is derived output, library `exports/` is Git-ignored, and template application never copies it.diff --git a/skills/ppt-master/workflows/create-template.md b/skills/ppt-master/workflows/create-template.mdindex 05d78b73..d8c6a860 100644--- a/skills/ppt-master/workflows/create-template.md+++ b/skills/ppt-master/workflows/create-template.md@@ -643,10 +643,10 @@ Produce one scope-aware, evidence-driven completion card for either location:| File | Status ||------|--------|| `templates/01_cover.svg` | Done |-| `templates/02_chapter.svg` | Done || `templates/02_toc.svg` | Done |-| `templates/03_content.svg` | Done |-| `templates/04_ending.svg` | Done |+| `templates/03_chapter.svg` | Done |+| `templates/04_content.svg` | Done |+| `templates/05_ending.svg` | Done || `exports/<template_id>_template_preview.pptx` | Verified, when requested or required for multi-Master |```