Skip to content

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(scripts): keep first-line inline runs in one frame, numeral roles use title_family, clearer gate output

hugohe3e81122632844
diff --git a/skills/ppt-master/scripts/analyze_images.py b/skills/ppt-master/scripts/analyze_images.py
index 5eceadef..d058cb95 100644
--- a/skills/ppt-master/scripts/analyze_images.py
+++ b/skills/ppt-master/scripts/analyze_images.py
@@ -314,7 +314,7 @@ def print_results(results: list[ImageAnalysis]) -> None:
print(
f"\n{'No.':<4} {'Width':<7} {'Height':<7} {'Ratio':<7} "
- f"{'Source':<8} {'Refs':<5} {'Size':<10} {'Category':<20} {'Filename'}"
+ f"{'Source':<8} {'Uses':<5} {'Size':<10} {'Category':<20} {'Filename'}"
)
print("-" * REPORT_WIDTH)
diff --git a/skills/ppt-master/scripts/svg_finalize/flatten_tspan.py b/skills/ppt-master/scripts/svg_finalize/flatten_tspan.py
index 95d87d75..a2c5c5e1 100644
--- a/skills/ppt-master/scripts/svg_finalize/flatten_tspan.py
+++ b/skills/ppt-master/scripts/svg_finalize/flatten_tspan.py
@@ -268,8 +268,6 @@ def _build_paragraph_child_view(
base_x_raw = get_attr(text_el, "x")
if base_x_raw is None:
return None
- if any((child.tail or "").strip() for child in direct_tspans):
- return None
synthetic_first = ET.Element(f"{{{SVG_NS}}}tspan")
synthetic_first.set("x", base_x_raw)
synthetic_first.text = raw_lead.lstrip()
@@ -337,8 +335,11 @@ def _classify_paragraph_block(
boundary as a hard DrawingML break. First entry is ``paragraph``.
Conditions (all must hold):
- - No direct text under <text>, except simple leading text that can be
- promoted into a synthetic first-line <tspan>.
+ - No direct text under <text>, except leading text that can be
+ promoted into a synthetic first-line <tspan>; inline runs (and their
+ tail text) that follow it before the first line break stay on that
+ line.
+ - A line made of a single positioned <tspan> carries no tail text.
- Every direct child is a <tspan>.
- Every logical line starts with a new-line tspan.
- Direct-child inline formatting tspans without x/y/dy are allowed only
@@ -374,6 +375,14 @@ def _classify_paragraph_block(
if len(line_groups) < 2:
return None
+ # Tail text after a direct-child tspan is a run of the parent <text>. It
+ # survives when the line is wrapped into a container with its sibling
+ # runs; a line made of one positioned tspan has no container, so its
+ # tail would dangle outside every line and the block is not mergeable.
+ for group in line_groups:
+ if len(group) == 1 and (group[0].tail or "").strip():
+ return None
+
# First pass: validate per-line structural rules and collect dy values.
dy_values: list[float] = [] # one per line (0 for first)
for idx, group in enumerate(line_groups):
diff --git a/skills/ppt-master/scripts/svg_quality/checker.py b/skills/ppt-master/scripts/svg_quality/checker.py
index 086e82f2..0b8f3de3 100644
--- a/skills/ppt-master/scripts/svg_quality/checker.py
+++ b/skills/ppt-master/scripts/svg_quality/checker.py
@@ -1133,6 +1133,7 @@ class SVGQualityChecker:
canonical_authoring: bool = False,
):
self.template_mode = template_mode
+ self.scan_banner = True
self.quick_generate = quick_generate
self.canonical_authoring = canonical_authoring
self.results = []
@@ -3866,7 +3867,8 @@ class SVGQualityChecker:
f'{bottom:.1f}), container ({outer_left:.1f}, '
f'{outer_top:.1f})-({outer_right:.1f}, '
f'{outer_bottom:.1f}), overflow horizontal '
- f'{horizontal_ratio:.1%}, vertical {vertical_ratio:.1%}; '
+ f'{horizontal_ratio:.1%}, vertical {vertical_ratio:.1%} '
+ f'(error above {_BOUNDS_OVERFLOW_ERROR_RATIO:.0%}); '
f'{repair}{width_suffix}'
)
@@ -4632,11 +4634,25 @@ class SVGQualityChecker:
if text_el.get('x') is None:
return '<text> has no x anchor'
- for child in list(text_el):
- if not cls._is_tspan(child):
- return '<text> has non-tspan child'
- if (child.tail or "").strip():
- return '<tspan> has non-empty tail text'
+ children = list(text_el)
+ if any(not cls._is_tspan(child) for child in children):
+ return '<text> has non-tspan child'
+
+ # Mirror svg_finalize.flatten_tspan: tail text after an inline run
+ # stays on its line, but a line made of one positioned <tspan> has
+ # nowhere to keep a tail.
+ groups: list[list[ET.Element]] = [[]]
+ for child in children:
+ if cls._is_line_tspan(child):
+ groups.append([child])
+ else:
+ groups[-1].append(child)
+ for group in groups[1:]:
+ if len(group) == 1 and (group[0].tail or "").strip():
+ return (
+ 'text follows a positioned line <tspan> directly; '
+ 'nest it inside that <tspan>'
+ )
return None
@@ -6859,7 +6875,8 @@ class SVGQualityChecker:
directory_expected_label = f"first SVG {svg_file.name}"
break
- print(f"\n[SCAN] Checking {len(svg_files)} SVG file(s)...\n")
+ if self.scan_banner:
+ print(f"\n[SCAN] Checking {len(svg_files)} SVG file(s)...\n")
for svg_file in svg_files:
self._active_prototype_path = self._prototype_by_output.get(
diff --git a/skills/ppt-master/scripts/svg_quality/cli.py b/skills/ppt-master/scripts/svg_quality/cli.py
index e07d792c..6de76b7f 100644
--- a/skills/ppt-master/scripts/svg_quality/cli.py
+++ b/skills/ppt-master/scripts/svg_quality/cli.py
@@ -258,8 +258,14 @@ def main() -> None:
if not early_files:
print("[ERROR] --stage early found no authored SVG pages")
sys.exit(1)
+ print(
+ f"\n[SCAN] Checking {len(early_files)} authored SVG page(s) "
+ "for the early gate...\n"
+ )
+ checker.scan_banner = False
for svg_file in early_files:
checker.check_directory(str(svg_file), expected_format)
+ checker.scan_banner = True
else:
if stage == "first-page":
check_target = _first_page_target(target)
diff --git a/skills/ppt-master/scripts/text_measure.py b/skills/ppt-master/scripts/text_measure.py
index 0fcd1bb9..a62f2872 100644
--- a/skills/ppt-master/scripts/text_measure.py
+++ b/skills/ppt-master/scripts/text_measure.py
@@ -312,7 +312,8 @@ def _roles_from_spec_lock(lock_path: Path) -> dict[str, tuple[str, float]]:
) from exc
family = rows.get(f'{role}_family', '')
if not family:
- fallback = 'title_family' if 'title' in role else 'body_family'
+ display_role = 'title' in role or 'numeral' in role
+ fallback = 'title_family' if display_role else 'body_family'
family = rows.get(fallback, '') or rows.get('font_family', '')
if not family:
raise ValueError(
@@ -332,6 +333,20 @@ def _clean_planned_line(raw: str) -> str:
return ' '.join(text.split())
+_JOINED_BLOCK_SEPARATOR_RE = re.compile(r'\s+[·•|/]\s+|;|;\s')
+
+
+def _split_joined_blocks(text: str) -> list[str]:
+ """Split one outline value joined by spaced separators into planned lines.
+
+ A brief-depth Content field lists a page's blocks as ``A · B · C`` or
+ ``A;B;C`` on one line; each block is a planned line, not the whole list.
+ Unspaced ``·`` inside a name (``让·努维尔``) is left alone.
+ """
+ parts = [part.strip() for part in _JOINED_BLOCK_SEPARATOR_RE.split(text)]
+ return [part for part in parts if part]
+
+
def _slide_id(token: str) -> str:
return 'PNN' if token.upper() == 'NN' else f'P{int(token):02d}'
@@ -392,7 +407,7 @@ def _outline_candidates(
line_index += 1
continue
- content_lines = [value] if value else []
+ content_lines = _split_joined_blocks(value) if value else []
next_index = line_index + 1
while next_index < len(lines):
next_field = _OUTLINE_DATA_LINE_RE.match(lines[next_index])
@@ -403,7 +418,7 @@ def _outline_candidates(
break
planned_line = _clean_planned_line(lines[next_index])
if planned_line:
- content_lines.append(planned_line)
+ content_lines.extend(_split_joined_blocks(planned_line))
next_index += 1
if 'body' in candidates:
candidates['body'].extend((slide, text) for text in content_lines)
@@ -501,6 +516,10 @@ def _render_calibration_table(payload: dict[str, object], *, include_outline: bo
else f'{planned["px"]:.1f}px, {planned["slide"]}, {planned["text"]}'
)
lines.append(' | '.join(row))
+ lines.append(
+ '[NOTE] mixed line width ≈ (CJK chars ÷ CJK rate + other chars ÷ Latin '
+ 'rate) × 100; spaces, digits, and punctuation count as Latin.'
+ )
return '\n'.join(lines) + '\n'