dknowc-dsh 1.0.4 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/README.md +9 -4
  2. package/package.json +2 -2
  3. package/skills/dknowc-ppt-assistant/README.md +54 -0
  4. package/skills/dknowc-ppt-assistant/SKILL.md +151 -0
  5. package/skills/dknowc-ppt-assistant/THIRD_PARTY_NOTICES.md +36 -0
  6. package/skills/dknowc-ppt-assistant/official-docs/output/.gitkeep +0 -0
  7. package/skills/dknowc-ppt-assistant/official-docs/search-results/.gitkeep +0 -0
  8. package/skills/dknowc-ppt-assistant/projects/.gitkeep +0 -0
  9. package/skills/dknowc-ppt-assistant/references/content-pack.md +55 -0
  10. package/skills/dknowc-ppt-assistant/references/material_usage.md +51 -0
  11. package/skills/dknowc-ppt-assistant/references/sample_effect.html +89 -0
  12. package/skills/dknowc-ppt-assistant/references/sample_search_result.md +48 -0
  13. package/skills/dknowc-ppt-assistant/references/search_intro.md +79 -0
  14. package/skills/dknowc-ppt-assistant/references/style-presets.md +126 -0
  15. package/skills/dknowc-ppt-assistant/references/svg-authoring.md +81 -0
  16. package/skills/dknowc-ppt-assistant/references/upstream-docs/svg-pipeline.md +842 -0
  17. package/skills/dknowc-ppt-assistant/references/upstream-example/01_cover.svg +28 -0
  18. package/skills/dknowc-ppt-assistant/references/upstream-example/02_quote.svg +38 -0
  19. package/skills/dknowc-ppt-assistant/references/upstream-example/03_origin.svg +96 -0
  20. package/skills/dknowc-ppt-assistant/references/upstream-example/README.md +15 -0
  21. package/skills/dknowc-ppt-assistant/references/upstream-example/design_spec.md +408 -0
  22. package/skills/dknowc-ppt-assistant/references/upstream-example/spec_lock.md +78 -0
  23. package/skills/dknowc-ppt-assistant/scripts/adapt_mcp_result.py +279 -0
  24. package/skills/dknowc-ppt-assistant/scripts/check_release.py +106 -0
  25. package/skills/dknowc-ppt-assistant/scripts/compact_svg_coordinates.py +345 -0
  26. package/skills/dknowc-ppt-assistant/scripts/config.py +707 -0
  27. package/skills/dknowc-ppt-assistant/scripts/console_encoding.py +33 -0
  28. package/skills/dknowc-ppt-assistant/scripts/error_helper.py +434 -0
  29. package/skills/dknowc-ppt-assistant/scripts/finalize_svg.py +507 -0
  30. package/skills/dknowc-ppt-assistant/scripts/hyperlink_contract.py +399 -0
  31. package/skills/dknowc-ppt-assistant/scripts/initialize.py +182 -0
  32. package/skills/dknowc-ppt-assistant/scripts/language_tags.py +283 -0
  33. package/skills/dknowc-ppt-assistant/scripts/mcp_direct.py +158 -0
  34. package/skills/dknowc-ppt-assistant/scripts/native_payloads.py +655 -0
  35. package/skills/dknowc-ppt-assistant/scripts/pptx_animation_presets.json +3440 -0
  36. package/skills/dknowc-ppt-assistant/scripts/pptx_animations.py +3965 -0
  37. package/skills/dknowc-ppt-assistant/scripts/pptx_effects.py +143 -0
  38. package/skills/dknowc-ppt-assistant/scripts/pptx_opc_validation.py +346 -0
  39. package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/__init__.py +130 -0
  40. package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/data/LICENSE-APACHE-2.0.txt +202 -0
  41. package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/data/LICENSE-OPEN-XML-SDK-MIT.txt +23 -0
  42. package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/data/NOTICE.md +54 -0
  43. package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/data/presetShapeDefinitions.xml +19898 -0
  44. package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/data/presetShapeSemantics.json +1217 -0
  45. package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/data/shape_type_values.txt +187 -0
  46. package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/errors.py +39 -0
  47. package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/formula.py +336 -0
  48. package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/loader.py +364 -0
  49. package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/models.py +201 -0
  50. package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/registry.py +270 -0
  51. package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/semantic_hash.py +456 -0
  52. package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/semantics.py +543 -0
  53. package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/xml_safety.py +21 -0
  54. package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/__init__.py +21 -0
  55. package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/animation_import.py +287 -0
  56. package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/chart_to_svg.py +2377 -0
  57. package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/chartex_to_svg.py +422 -0
  58. package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/color_resolver.py +894 -0
  59. package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/converter.py +1143 -0
  60. package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/custgeom_to_svg.py +165 -0
  61. package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/effect_to_svg.py +410 -0
  62. package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/emu_units.py +258 -0
  63. package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/fill_to_svg.py +816 -0
  64. package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/formula_import.py +611 -0
  65. package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/hyperlinks.py +93 -0
  66. package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/import_diagnostics.py +37 -0
  67. package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/ln_to_svg.py +362 -0
  68. package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/normalized_chart_svg.py +1217 -0
  69. package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/ooxml_loader.py +506 -0
  70. package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/pic_to_svg.py +653 -0
  71. package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/preset_authoring.py +894 -0
  72. package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/preset_registry_to_svg.py +216 -0
  73. package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/preset_svg_markup.py +198 -0
  74. package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/prstgeom_to_svg.py +162 -0
  75. package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/shape_walker.py +556 -0
  76. package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/slide_to_svg.py +2002 -0
  77. package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/tbl_to_svg.py +1841 -0
  78. package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/transition_import.py +201 -0
  79. package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/txbody_to_svg.py +1433 -0
  80. package/skills/dknowc-ppt-assistant/scripts/pptx_transitions.py +3153 -0
  81. package/skills/dknowc-ppt-assistant/scripts/preset_shape_svg.py +450 -0
  82. package/skills/dknowc-ppt-assistant/scripts/project_utils.py +645 -0
  83. package/skills/dknowc-ppt-assistant/scripts/register_key.mjs +183 -0
  84. package/skills/dknowc-ppt-assistant/scripts/register_template.py +1327 -0
  85. package/skills/dknowc-ppt-assistant/scripts/render_trace_html.py +1048 -0
  86. package/skills/dknowc-ppt-assistant/scripts/resource_paths.py +282 -0
  87. package/skills/dknowc-ppt-assistant/scripts/shape_boolean_svg.py +189 -0
  88. package/skills/dknowc-ppt-assistant/scripts/slide_roster.py +44 -0
  89. package/skills/dknowc-ppt-assistant/scripts/svg_finalize/__init__.py +12 -0
  90. package/skills/dknowc-ppt-assistant/scripts/svg_finalize/align_embed_images.py +672 -0
  91. package/skills/dknowc-ppt-assistant/scripts/svg_finalize/crop_images.py +370 -0
  92. package/skills/dknowc-ppt-assistant/scripts/svg_finalize/embed_icons.py +564 -0
  93. package/skills/dknowc-ppt-assistant/scripts/svg_finalize/embed_images.py +288 -0
  94. package/skills/dknowc-ppt-assistant/scripts/svg_finalize/fix_image_aspect.py +389 -0
  95. package/skills/dknowc-ppt-assistant/scripts/svg_finalize/flatten_tspan.py +948 -0
  96. package/skills/dknowc-ppt-assistant/scripts/svg_finalize/svg_rect_to_path.py +346 -0
  97. package/skills/dknowc-ppt-assistant/scripts/svg_quality/__init__.py +15 -0
  98. package/skills/dknowc-ppt-assistant/scripts/svg_quality/checker.py +7791 -0
  99. package/skills/dknowc-ppt-assistant/scripts/svg_quality/cli.py +193 -0
  100. package/skills/dknowc-ppt-assistant/scripts/svg_quality/svg_contracts.py +1121 -0
  101. package/skills/dknowc-ppt-assistant/scripts/svg_quality/xml_support.py +35 -0
  102. package/skills/dknowc-ppt-assistant/scripts/svg_quality_checker.py +59 -0
  103. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/__init__.py +37 -0
  104. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/animation_config.py +1622 -0
  105. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/canvas_contract.py +226 -0
  106. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/__init__.py +1 -0
  107. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/context.py +291 -0
  108. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/converter.py +1980 -0
  109. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/elements.py +5272 -0
  110. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/hyperlinks.py +162 -0
  111. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/paths.py +847 -0
  112. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/styles.py +752 -0
  113. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/text_properties.py +796 -0
  114. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/theme_colors.py +283 -0
  115. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/theme_fonts.py +330 -0
  116. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/utils.py +3555 -0
  117. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/geometry_properties.py +140 -0
  118. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/__init__.py +356 -0
  119. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/chart_data.py +1449 -0
  120. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/chart_style.py +886 -0
  121. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/chart_xml.py +1495 -0
  122. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/chartex.py +272 -0
  123. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/fallback_hash.py +161 -0
  124. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula.py +243 -0
  125. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula_ast.py +592 -0
  126. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula_compiler.py +96 -0
  127. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula_omml.py +1049 -0
  128. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula_parser.py +2181 -0
  129. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula_profile.py +739 -0
  130. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula_run_properties.py +234 -0
  131. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/inline_formula.py +311 -0
  132. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/marker_attributes.py +182 -0
  133. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/marker_common.py +806 -0
  134. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/marker_status.py +190 -0
  135. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/table.py +1113 -0
  136. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/workbook.py +216 -0
  137. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/__init__.py +1 -0
  138. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/builder.py +6273 -0
  139. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/cli.py +2059 -0
  140. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/dimensions.py +189 -0
  141. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/discovery.py +120 -0
  142. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/media.py +160 -0
  143. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/narration.py +696 -0
  144. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/notes.py +336 -0
  145. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/slide_xml.py +138 -0
  146. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/template_structure.py +3457 -0
  147. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/template_validation.py +1536 -0
  148. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/semantic_markers.py +240 -0
  149. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/shape_boolean.py +1355 -0
  150. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/text_outline.py +1121 -0
  151. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/tspan_flattener.py +64 -0
  152. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/use_expander.py +577 -0
  153. package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx.py +21 -0
  154. package/skills/dknowc-ppt-assistant/scripts/trusted_search.py +336 -0
  155. package/skills/dknowc-ppt-assistant/scripts/update_spec.py +404 -0
  156. package/skills/dknowc-ppt-assistant/workflows/generate-pptx.md +142 -0
  157. package/skills/dknowc-ppt-assistant/workflows/routing.md +38 -0
  158. package/src/index.js +7 -2
@@ -0,0 +1,240 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ PPT Master - Semantic SVG Markers
4
+
5
+ Owns the minimal page and structural-role marker vocabulary used by SVG
6
+ authoring, validation, conversion traces, and native PPTX structure
7
+ reconstruction. These markers are compiler hints, not a parallel content model.
8
+
9
+ Usage:
10
+ Import from svg_quality_checker.py or svg_to_pptx internals.
11
+
12
+ Examples:
13
+ validate_semantic_markers(root, require_page_role=True)
14
+
15
+ Dependencies:
16
+ None (standard library only)
17
+ """
18
+
19
+ from __future__ import annotations
20
+
21
+ import re
22
+ from dataclasses import dataclass
23
+ from pathlib import Path
24
+ from xml.etree import ElementTree as ET
25
+
26
+
27
+ PAGE_ROLE_TO_LAYOUT = {
28
+ "cover": "Cover",
29
+ "toc": "Agenda",
30
+ "section": "Section",
31
+ "content": "Content",
32
+ "ending": "Closing",
33
+ }
34
+
35
+ STRUCTURAL_ROLES = frozenset({
36
+ "background",
37
+ "chrome",
38
+ "decoration",
39
+ "footer",
40
+ "header",
41
+ "logo",
42
+ "page-number",
43
+ "watermark",
44
+ })
45
+
46
+ CHROME_ROLE_TO_TOKEN = {
47
+ "chrome": "chrome",
48
+ "footer": "footer",
49
+ "header": "header",
50
+ "logo": "logo",
51
+ "page-number": "pagenumber",
52
+ "watermark": "watermark",
53
+ }
54
+
55
+ ANIMATION_CHROME_ROLES = STRUCTURAL_ROLES
56
+
57
+ SEMANTIC_ATTRS = frozenset({
58
+ "data-pptx-page-role",
59
+ "data-pptx-role",
60
+ })
61
+
62
+ _NON_VISUAL_TAGS = frozenset({"defs", "desc", "metadata", "style", "title"})
63
+ _MARKER_TOKEN_RE = re.compile(r"^[a-z][a-z0-9-]*$")
64
+
65
+
66
+ @dataclass(frozen=True)
67
+ class SemanticMarkerIssue:
68
+ """One semantic-marker validation issue."""
69
+
70
+ severity: str
71
+ message: str
72
+
73
+
74
+ def _local_tag(elem: ET.Element) -> str:
75
+ """Return one element's local tag name."""
76
+ return elem.tag.rsplit("}", 1)[-1] if "}" in str(elem.tag) else str(elem.tag)
77
+
78
+
79
+ def _normalized_marker(raw: str | None) -> str | None:
80
+ """Normalize one marker value, preserving absence."""
81
+ if raw is None:
82
+ return None
83
+ return raw.strip().lower()
84
+
85
+
86
+ def chrome_token_from_role(role: str | None) -> str | None:
87
+ """Return the baseline chrome token represented by a semantic role."""
88
+ normalized = _normalized_marker(role)
89
+ return CHROME_ROLE_TO_TOKEN.get(normalized or "")
90
+
91
+
92
+ def chrome_token_from_markers(
93
+ role: str | None,
94
+ placeholder: str | None,
95
+ ) -> str | None:
96
+ """Return chrome behavior from specialized markers before generic roles."""
97
+ if _normalized_marker(placeholder) == "slide-number":
98
+ return "pagenumber"
99
+ return chrome_token_from_role(role)
100
+
101
+
102
+ def is_chrome_role(role: str | None) -> bool:
103
+ """Return whether a semantic role represents non-content page chrome."""
104
+ normalized = _normalized_marker(role)
105
+ return normalized in ANIMATION_CHROME_ROLES
106
+
107
+
108
+ def is_static_page_frame(
109
+ role: str | None,
110
+ placeholder: str | None,
111
+ ) -> bool:
112
+ """Return whether explicit markers identify a static page-frame object."""
113
+ return (
114
+ _normalized_marker(placeholder) is not None
115
+ or is_chrome_role(role)
116
+ )
117
+
118
+
119
+ def page_layout_name_from_svg(svg_path: Path) -> str | None:
120
+ """Return the native baseline Layout name declared by the SVG page role."""
121
+ root = ET.parse(svg_path).getroot()
122
+ role = _normalized_marker(root.get("data-pptx-page-role"))
123
+ return PAGE_ROLE_TO_LAYOUT.get(role or "")
124
+
125
+
126
+ def validate_semantic_markers(
127
+ root: ET.Element,
128
+ *,
129
+ require_page_role: bool = False,
130
+ ) -> list[SemanticMarkerIssue]:
131
+ """Validate semantic markers without changing SVG rendering semantics."""
132
+ issues: list[SemanticMarkerIssue] = []
133
+ page_role_raw = root.get("data-pptx-page-role")
134
+ page_role = _normalized_marker(page_role_raw)
135
+ if page_role_raw is None:
136
+ if require_page_role:
137
+ issues.append(SemanticMarkerIssue(
138
+ "warning",
139
+ "page SVG is missing root data-pptx-page-role",
140
+ ))
141
+ elif not page_role:
142
+ issues.append(SemanticMarkerIssue(
143
+ "error",
144
+ "root data-pptx-page-role must not be empty",
145
+ ))
146
+ elif not _MARKER_TOKEN_RE.fullmatch(page_role):
147
+ issues.append(SemanticMarkerIssue(
148
+ "error",
149
+ f"invalid data-pptx-page-role={page_role_raw!r}; use lowercase kebab-case",
150
+ ))
151
+ elif page_role not in PAGE_ROLE_TO_LAYOUT:
152
+ issues.append(SemanticMarkerIssue(
153
+ "warning",
154
+ f"unknown data-pptx-page-role={page_role_raw!r}",
155
+ ))
156
+ elif page_role_raw != page_role:
157
+ issues.append(SemanticMarkerIssue(
158
+ "warning",
159
+ f"data-pptx-page-role should use canonical lowercase value {page_role!r}",
160
+ ))
161
+
162
+ id_counts: dict[str, int] = {}
163
+ for elem in root.iter():
164
+ elem_id = (elem.get("id") or "").strip()
165
+ if elem_id:
166
+ id_counts[elem_id] = id_counts.get(elem_id, 0) + 1
167
+
168
+ marked_ids: set[str] = set()
169
+ for elem in root.iter():
170
+ tag = _local_tag(elem)
171
+ elem_id = (elem.get("id") or "").strip()
172
+ if elem is not root and elem.get("data-pptx-page-role") is not None:
173
+ issues.append(SemanticMarkerIssue(
174
+ "error",
175
+ f"{elem_id or tag}: data-pptx-page-role belongs on the root <svg> only",
176
+ ))
177
+
178
+ role_raw = elem.get("data-pptx-role")
179
+ role = _normalized_marker(role_raw)
180
+ if role_raw is not None:
181
+ if elem is root or tag in _NON_VISUAL_TAGS:
182
+ issues.append(SemanticMarkerIssue(
183
+ "error",
184
+ f"{elem_id or tag}: data-pptx-role belongs on a visual SVG element",
185
+ ))
186
+ if not role:
187
+ issues.append(SemanticMarkerIssue(
188
+ "error",
189
+ f"{elem_id or tag}: data-pptx-role must not be empty",
190
+ ))
191
+ elif not _MARKER_TOKEN_RE.fullmatch(role):
192
+ issues.append(SemanticMarkerIssue(
193
+ "error",
194
+ f"{elem_id or tag}: invalid data-pptx-role={role_raw!r}; "
195
+ "use lowercase kebab-case",
196
+ ))
197
+ elif role not in STRUCTURAL_ROLES:
198
+ issues.append(SemanticMarkerIssue(
199
+ "warning",
200
+ f"{elem_id or tag}: unknown data-pptx-role={role_raw!r}",
201
+ ))
202
+ elif role_raw != role:
203
+ issues.append(SemanticMarkerIssue(
204
+ "warning",
205
+ f"{elem_id or tag}: data-pptx-role should use canonical "
206
+ f"lowercase value {role!r}",
207
+ ))
208
+ if not elem_id:
209
+ issues.append(SemanticMarkerIssue(
210
+ "error",
211
+ f"<{tag}> with data-pptx-role requires a stable id",
212
+ ))
213
+ else:
214
+ marked_ids.add(elem_id)
215
+
216
+ layer = _normalized_marker(elem.get("data-pptx-layer"))
217
+ placeholder = _normalized_marker(elem.get("data-pptx-placeholder"))
218
+ if layer:
219
+ issues.append(SemanticMarkerIssue(
220
+ "warning",
221
+ f"{elem_id or tag}: data-pptx-role is redundant when "
222
+ "data-pptx-layer already owns structure/animation behavior",
223
+ ))
224
+ if role == "page-number" and placeholder == "slide-number":
225
+ issues.append(SemanticMarkerIssue(
226
+ "warning",
227
+ f"{elem_id or tag}: data-pptx-role='page-number' is redundant; "
228
+ "data-pptx-placeholder='slide-number' already owns the behavior",
229
+ ))
230
+
231
+ duplicates = sorted(
232
+ elem_id for elem_id in marked_ids
233
+ if id_counts.get(elem_id, 0) > 1
234
+ )
235
+ if duplicates:
236
+ issues.append(SemanticMarkerIssue(
237
+ "error",
238
+ "semantic markers require unique ids; duplicate: " + ", ".join(duplicates),
239
+ ))
240
+ return issues