AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He
feat(pptx_to_svg): render tables, OLE preview bitmaps, and inherit placeholder geometry
hugohe3afff60e2d290
diff --git a/skills/ppt-master/scripts/pptx_to_svg/shape_walker.py b/skills/ppt-master/scripts/pptx_to_svg/shape_walker.pyindex c8c2462b..a96518e5 100644--- a/skills/ppt-master/scripts/pptx_to_svg/shape_walker.py+++ b/skills/ppt-master/scripts/pptx_to_svg/shape_walker.py@@ -156,6 +156,7 @@ _KIND_MAP = {def _walk_container(container: ET.Element,parent_group_xfrm: Xfrm | None,+ placeholder_xfrms: dict[tuple[str | None, str | None], Xfrm] | None = None,) -> list[ShapeNode]:"""Walk a p:spTree or p:grpSp subtree. Children kept in document (z) order."""@@ -172,6 +173,23 @@ def _walk_container(name, spid, hidden, ph = _read_nv_sp_pr(child, nv_tag)xfrm = parse_xfrm(_resolve_xfrm(child, kind))+ # Placeholders without their own xfrm inherit geometry from a matching+ # placeholder in the layout, then the master. This is what PowerPoint+ # itself does when rendering the slide. Without this fallback such+ # shapes get a 0×0 box and convert_txbody wraps every glyph onto its+ # own line — visually a vertical strip of single characters.+ if (ph is not None and placeholder_xfrms+ and (xfrm.w == 0 and xfrm.h == 0)):+ inherited = _lookup_placeholder_xfrm(ph, placeholder_xfrms)+ if inherited is not None:+ xfrm = Xfrm(+ x=inherited.x, y=inherited.y,+ w=inherited.w, h=inherited.h,+ rot=xfrm.rot, flip_h=xfrm.flip_h, flip_v=xfrm.flip_v,+ ch_x=xfrm.ch_x, ch_y=xfrm.ch_y,+ ch_w=xfrm.ch_w, ch_h=xfrm.ch_h,+ )+# If we're inside a group, remap to slide-absolute coordinatesif parent_group_xfrm is not None:xfrm = _adjust_for_group(xfrm, parent_group_xfrm)@@ -182,18 +200,91 @@ def _walk_container()if kind == GROUP:- node.children = _walk_container(child, xfrm)+ node.children = _walk_container(+ child, xfrm, placeholder_xfrms=placeholder_xfrms,+ )nodes.append(node)return nodes-def walk_sp_tree(slide_xml: ET.Element) -> list[ShapeNode]:- """Top-level entry: return shape nodes for a slide / layout / master XML."""+def _lookup_placeholder_xfrm(+ ph: PlaceholderInfo,+ table: dict[tuple[str | None, str | None], Xfrm],+) -> Xfrm | None:+ """Find an inherited xfrm for a placeholder. PowerPoint matches first by+ (type, idx) exactly, then by type alone, then by idx alone — so a slide+ body with idx="1" can pull from a layout body that omits idx, and a slide+ title with no idx can pull from a master title that has idx="0"."""+ for key in (+ (ph.type, ph.idx),+ (ph.type, None),+ (None, ph.idx),+ ):+ hit = table.get(key)+ if hit is not None and (hit.w > 0 or hit.h > 0):+ return hit+ return None+++def _build_placeholder_xfrm_table(+ *parts: ET.Element | None,+) -> dict[tuple[str | None, str | None], Xfrm]:+ """Index placeholders that *do* have explicit geometry, in priority order.++ Pass parts most-specific to least-specific (layout first, master second);+ the first writer for a given key wins so layout overrides master, which is+ what PowerPoint's inheritance chain expects.+ """+ table: dict[tuple[str | None, str | None], Xfrm] = {}+ for part_xml in parts:+ if part_xml is None:+ continue+ sp_tree = part_xml.find("p:cSld/p:spTree", NS)+ if sp_tree is None:+ continue+ for sp in sp_tree.iter():+ if not isinstance(sp.tag, str) or sp.tag.split("}", 1)[-1] != "sp":+ continue+ ph_elem = sp.find("p:nvSpPr/p:nvPr/p:ph", NS)+ if ph_elem is None:+ continue+ xfrm_elem = sp.find("p:spPr/a:xfrm", NS)+ if xfrm_elem is None:+ continue+ xfrm = parse_xfrm(xfrm_elem)+ if xfrm.w <= 0 and xfrm.h <= 0:+ continue+ ph_type = ph_elem.attrib.get("type")+ ph_idx = ph_elem.attrib.get("idx")+ for key in ((ph_type, ph_idx),+ (ph_type, None),+ (None, ph_idx)):+ table.setdefault(key, xfrm)+ return table+++def walk_sp_tree(+ slide_xml: ET.Element,+ *,+ layout_xml: ET.Element | None = None,+ master_xml: ET.Element | None = None,+) -> list[ShapeNode]:+ """Top-level entry: return shape nodes for a slide / layout / master XML.++ When ``slide_xml`` is a regular slide, pass its ``layout_xml`` and+ ``master_xml`` so that placeholders without explicit geometry can inherit+ from the layout/master. Layout and master walks pass neither — their own+ placeholders are the source of truth.+ """sp_tree = slide_xml.find("p:cSld/p:spTree", NS)if sp_tree is None:return []- return _walk_container(sp_tree, parent_group_xfrm=None)+ placeholder_xfrms = _build_placeholder_xfrm_table(layout_xml, master_xml)+ return _walk_container(+ sp_tree, parent_group_xfrm=None,+ placeholder_xfrms=placeholder_xfrms or None,+ )def get_background(slide_xml: ET.Element) -> ET.Element | None:diff --git a/skills/ppt-master/scripts/pptx_to_svg/slide_to_svg.py b/skills/ppt-master/scripts/pptx_to_svg/slide_to_svg.pyindex 1df8f7c0..ac856a54 100644--- a/skills/ppt-master/scripts/pptx_to_svg/slide_to_svg.py+++ b/skills/ppt-master/scripts/pptx_to_svg/slide_to_svg.py@@ -38,6 +38,7 @@ from .shape_walker import (CONNECTOR, GRAPHIC, GROUP, PICTURE, SHAPE,ShapeNode, get_background, walk_sp_tree,)+from .tbl_to_svg import convert_tblfrom .txbody_to_svg import (TextResult,convert_txbody,@@ -128,8 +129,13 @@ def assemble_slide(f"inheritance_mode must be 'flat' or 'layered', got {inheritance_mode!r}")- # Walk shapes- nodes = walk_sp_tree(slide.part.xml)+ # Walk shapes — placeholders without their own xfrm inherit geometry from+ # layout, then master.+ nodes = walk_sp_tree(+ slide.part.xml,+ layout_xml=slide.layout.xml if slide.layout else None,+ master_xml=slide.master.xml if slide.master else None,+ )for node in nodes:chunk = _convert_node(node, ctx, top_level=True)if chunk:@@ -461,10 +467,30 @@ def _convert_group(node: ShapeNode, ctx: AssemblyContext, *, top_level: bool) ->def _convert_graphic_fallback(node: ShapeNode, ctx: AssemblyContext,*, top_level: bool) -> str:- """v1 fallback: render the bounding box with a dashed outline + label."""- # Detect what's inside (chart / table / smartArt) for the comment.+ """Render a <p:graphicFrame> by dispatching on its graphicData uri.++ Currently:+ - ``...drawingml/2006/table`` → real table renderer (`convert_tbl`)+ - ``...presentationml/2006/ole`` → render the ``mc:Fallback`` preview+ bitmap that PowerPoint bakes alongside every embedded OLE object.+ Visually identical to what PowerPoint shows for an unedited embed.+ - everything else (chart / SmartArt / diagram) → labelled bounding+ rectangle so the slide composition is preserved even though the inner+ content can't be drawn yet.+ """graphic_data = node.xml.find("a:graphic/a:graphicData", NS)uri = graphic_data.attrib.get("uri", "graphicFrame") if graphic_data is not None else "graphicFrame"++ if uri == "http://schemas.openxmlformats.org/drawingml/2006/table":+ rendered = _render_graphic_table(node, ctx, graphic_data)+ if rendered:+ return _wrap_shape_group(rendered, node, ctx, top_level=top_level)++ if uri == "http://schemas.openxmlformats.org/presentationml/2006/ole":+ rendered = _render_ole_preview(node, ctx)+ if rendered:+ return _wrap_shape_group(rendered, node, ctx, top_level=top_level)+label = uri.rsplit("/", 1)[-1]placeholder = (f'<rect x="{fmt_num(node.xfrm.x)}" y="{fmt_num(node.xfrm.y)}" '@@ -478,6 +504,75 @@ def _convert_graphic_fallback(node: ShapeNode, ctx: AssemblyContext,return _wrap_shape_group(placeholder, node, ctx, top_level=top_level)+def _render_graphic_table(node: ShapeNode, ctx: AssemblyContext,+ graphic_data: ET.Element | None) -> str:+ """Convert the <a:tbl> child of a graphicFrame to SVG, or return ''."""+ if graphic_data is None:+ return ""+ tbl = graphic_data.find("a:tbl", NS)+ if tbl is None:+ return ""+ result = convert_tbl(+ tbl, node.xfrm, ctx.palette,+ theme_fonts=ctx.theme_fonts,+ id_prefix=f"tbl{ctx.shape_seq[0]}",+ grad_seq=ctx.grad_seq,+ marker_seq=ctx.marker_seq,+ )+ if result.defs:+ ctx.defs.extend(result.defs)+ return result.svg+++def _render_ole_preview(node: ShapeNode, ctx: AssemblyContext) -> str:+ """Render an OLE-embedded object as its baked preview bitmap.++ PowerPoint stores a static raster preview for every embedded OLE object+ inside ``mc:AlternateContent``. The Fallback branch is required by spec+ to be a plain ``p:pic`` (sometimes nested inside a stray ``p:oleObj``),+ so any conformant viewer that can't speak OLE just paints the preview.+ We do the same: locate that ``p:pic`` and run it through the regular+ picture pipeline. The user sees what they'd see in PowerPoint without+ double-clicking the chart, no live OLE editing required (which we+ couldn't do in SVG anyway).++ Falls back to '' when the deck has no Fallback pic (very old or+ third-party authoring tools sometimes omit it). Caller then emits the+ dashed placeholder.+ """+ ac = node.xml.find("a:graphic/a:graphicData/mc:AlternateContent", NS)+ if ac is None:+ return ""+ pic = ac.find("mc:Fallback//p:pic", NS)+ if pic is None:+ # Some authoring tools put the preview directly in mc:Choice.+ pic = ac.find("mc:Choice//p:pic", NS)+ if pic is None:+ return ""++ # The inner pic carries its own absolute xfrm in this deck (and in every+ # well-formed PPTX I've seen — PowerPoint copies the graphicFrame xfrm+ # there during save). If it's missing, fall back to the graphicFrame's+ # xfrm so the preview at least lands somewhere visible.+ inner_xfrm = node.xfrm+ pic_xfrm_elem = pic.find("p:spPr/a:xfrm", NS)+ if pic_xfrm_elem is not None:+ from .emu_units import parse_xfrm+ parsed = parse_xfrm(pic_xfrm_elem)+ if parsed.w > 0 and parsed.h > 0:+ inner_xfrm = parsed++ result = convert_picture(+ pic, inner_xfrm, ctx.slide_part, ctx.pkg,+ media_subdir=ctx.media_subdir,+ embed_inline=ctx.embed_images,+ )+ if not result.svg:+ return ""+ ctx.media.update(result.media)+ return result.svg++# ---------------------------------------------------------------------------# Background# ---------------------------------------------------------------------------diff --git a/skills/ppt-master/scripts/pptx_to_svg/tbl_to_svg.py b/skills/ppt-master/scripts/pptx_to_svg/tbl_to_svg.pynew file mode 100644index 00000000..db8d979d--- /dev/null+++ b/skills/ppt-master/scripts/pptx_to_svg/tbl_to_svg.py@@ -0,0 +1,393 @@+"""Convert a DrawingML <a:tbl> into SVG.++Tables in PowerPoint are stored under <p:graphicFrame> with+graphicData uri="...drawingml/2006/table" wrapping a single <a:tbl>:++ <p:graphicFrame>+ <p:xfrm>...</p:xfrm>+ <a:graphic><a:graphicData uri="...table">+ <a:tbl>+ <a:tblPr/>+ <a:tblGrid>+ <a:gridCol w="..."/>...+ </a:tblGrid>+ <a:tr h="...">+ <a:tc [gridSpan=N] [rowSpan=N] [hMerge=1] [vMerge=1]>+ <a:txBody>...</a:txBody>+ <a:tcPr>+ <a:lnL/><a:lnR/><a:lnT/><a:lnB/>+ <a:solidFill/>... or <a:gradFill/> ...+ </a:tcPr>+ </a:tc>+ </a:tr>+ </a:tbl>+ </a:graphicData></a:graphic>+ </p:graphicFrame>++The graphicFrame's <p:xfrm> gives the table's slide-space position and total+size; <a:tblGrid> + <a:tr> heights distribute that size across columns/rows.++Cell painting order:+1. background fill (rect at cell box)+2. text body (re-uses convert_txbody)+3. cell borders (lnT / lnR / lnB / lnL — stroked as separate <line>s so+ neighbouring cells with different border styles render correctly)+"""++from __future__ import annotations++from dataclasses import dataclass+from xml.etree import ElementTree as ET++from .color_resolver import ColorPalette+from .emu_units import NS, Xfrm, emu_to_px, fmt_num+from .fill_to_svg import resolve_fill+from .ln_to_svg import resolve_stroke+from .txbody_to_svg import convert_txbody+++@dataclass+class TableResult:+ """Composite render output: SVG body + accumulated <defs>."""++ svg: str = ""+ defs: list[str] = None++ def __post_init__(self) -> None:+ if self.defs is None:+ self.defs = []+++# ---------------------------------------------------------------------------+# Public entry+# ---------------------------------------------------------------------------++def convert_tbl(+ tbl: ET.Element,+ xfrm: Xfrm,+ palette: ColorPalette | None,+ *,+ theme_fonts: dict[str, str] | None = None,+ id_prefix: str = "tbl",+ grad_seq: list[int] | None = None,+ marker_seq: list[int] | None = None,+) -> TableResult:+ """Render an <a:tbl> at the given absolute xfrm into SVG markup."""+ grad_seq = grad_seq if grad_seq is not None else [0]+ marker_seq = marker_seq if marker_seq is not None else [0]++ col_widths_px = _column_widths_px(tbl)+ if not col_widths_px:+ return TableResult()+ rows = tbl.findall("a:tr", NS)+ if not rows:+ return TableResult()+ row_heights_px = [_row_height_px(r) for r in rows]++ # PowerPoint's tblGrid widths and tr heights together describe the+ # *intrinsic* table size. The graphicFrame xfrm width/height may differ;+ # if it does, scale rows/columns proportionally so the table fills the+ # frame the way PowerPoint renders it.+ intrinsic_w = sum(col_widths_px) or xfrm.w+ intrinsic_h = sum(row_heights_px) or xfrm.h+ sx = (xfrm.w / intrinsic_w) if intrinsic_w else 1.0+ sy = (xfrm.h / intrinsic_h) if intrinsic_h else 1.0+ col_widths = [w * sx for w in col_widths_px]+ row_heights = [h * sy for h in row_heights_px]++ col_lefts = _cumulative_starts(xfrm.x, col_widths)+ row_tops = _cumulative_starts(xfrm.y, row_heights)++ # First pass: resolve merge state so spanned cells get the union geometry+ # and dropped cells don't render anything. PowerPoint expresses merges via+ # gridSpan/rowSpan on the anchor cell + hMerge/vMerge on the dropped cells.+ cells = _build_cell_grid(rows, len(col_widths))++ body_parts: list[str] = []+ defs: list[str] = []++ # Pass A: cell backgrounds.+ for r, row_cells in enumerate(cells):+ for c, cell in enumerate(row_cells):+ if cell is None or cell.is_dropped:+ continue+ rect_x = col_lefts[c]+ rect_y = row_tops[r]+ rect_w = sum(col_widths[c:c + cell.col_span])+ rect_h = sum(row_heights[r:r + cell.row_span])+ tcPr = cell.element.find("a:tcPr", NS)+ fill = resolve_fill(+ tcPr, palette,+ id_prefix=f"{id_prefix}fill",+ id_seq=grad_seq,+ )+ defs.extend(fill.defs)+ attrs = fill.attrs or {"fill": "none"}+ attr_str = "".join(f' {k}="{v}"' for k, v in attrs.items())+ body_parts.append(+ f'<rect x="{fmt_num(rect_x)}" y="{fmt_num(rect_y)}" '+ f'width="{fmt_num(rect_w)}" height="{fmt_num(rect_h)}"'+ f'{attr_str}/>'+ )++ # Pass B: cell text. Cell xfrm uses default tcPr insets if none specified.+ for r, row_cells in enumerate(cells):+ for c, cell in enumerate(row_cells):+ if cell is None or cell.is_dropped:+ continue+ tx_body = cell.element.find("a:txBody", NS)+ if tx_body is None:+ continue+ tcPr = cell.element.find("a:tcPr", NS)+ cell_x = col_lefts[c]+ cell_y = row_tops[r]+ cell_w = sum(col_widths[c:c + cell.col_span])+ cell_h = sum(row_heights[r:r + cell.row_span])+ cell_xfrm = Xfrm(x=cell_x, y=cell_y, w=cell_w, h=cell_h)+ text_result = _convert_cell_text(+ tx_body, tcPr, cell_xfrm, palette, theme_fonts,+ )+ if text_result.svg:+ body_parts.append(text_result.svg)++ # Pass C: cell borders. Drawn last so they appear on top of fills/text.+ for r, row_cells in enumerate(cells):+ for c, cell in enumerate(row_cells):+ if cell is None or cell.is_dropped:+ continue+ cell_x = col_lefts[c]+ cell_y = row_tops[r]+ cell_w = sum(col_widths[c:c + cell.col_span])+ cell_h = sum(row_heights[r:r + cell.row_span])+ tcPr = cell.element.find("a:tcPr", NS)+ for tag, x1, y1, x2, y2 in (+ ("a:lnT", cell_x, cell_y, cell_x + cell_w, cell_y),+ ("a:lnR", cell_x + cell_w, cell_y, cell_x + cell_w, cell_y + cell_h),+ ("a:lnB", cell_x, cell_y + cell_h, cell_x + cell_w, cell_y + cell_h),+ ("a:lnL", cell_x, cell_y, cell_x, cell_y + cell_h),+ ):+ line_xml = _border_line(+ tcPr, tag, x1, y1, x2, y2, palette,+ id_prefix=f"{id_prefix}stk", id_seq=marker_seq, defs=defs,+ )+ if line_xml:+ body_parts.append(line_xml)++ return TableResult(svg="\n".join(body_parts), defs=defs)+++# ---------------------------------------------------------------------------+# Geometry helpers+# ---------------------------------------------------------------------------++def _column_widths_px(tbl: ET.Element) -> list[float]:+ grid = tbl.find("a:tblGrid", NS)+ if grid is None:+ return []+ widths: list[float] = []+ for col in grid.findall("a:gridCol", NS):+ w_emu = col.attrib.get("w")+ if w_emu is None:+ continue+ try:+ widths.append(emu_to_px(int(w_emu)))+ except ValueError:+ widths.append(0.0)+ return widths+++def _row_height_px(row: ET.Element) -> float:+ h_emu = row.attrib.get("h")+ if h_emu is None:+ return 0.0+ try:+ return emu_to_px(int(h_emu))+ except ValueError:+ return 0.0+++def _cumulative_starts(origin: float, sizes: list[float]) -> list[float]:+ out = [origin]+ acc = origin+ for size in sizes[:-1]:+ acc += size+ out.append(acc)+ return out+++# ---------------------------------------------------------------------------+# Cell grid+# ---------------------------------------------------------------------------++@dataclass+class _CellSlot:+ """Per-grid-position resolution of <a:tc> attributes."""++ element: ET.Element+ col_span: int = 1+ row_span: int = 1+ is_dropped: bool = False # True for h/vMerge slaves: don't paint anything+++def _build_cell_grid(rows: list[ET.Element], col_count: int) -> list[list[_CellSlot | None]]:+ """Map each (row, col) to the <a:tc> that owns it.++ Anchor cells (the top-left of a merge) carry col_span/row_span; merged+ slaves are marked is_dropped so the renderer skips them. Cells not part+ of any merge get span 1×1.+ """+ grid: list[list[_CellSlot | None]] = [[None] * col_count for _ in rows]++ for r, row in enumerate(rows):+ c = 0+ for tc in row.findall("a:tc", NS):+ # Skip already-occupied slots from a row above's rowSpan anchor.+ while c < col_count and grid[r][c] is not None:+ c += 1+ if c >= col_count:+ break++ grid_span = _safe_int(tc.attrib.get("gridSpan"), 1)+ row_span = _safe_int(tc.attrib.get("rowSpan"), 1)+ h_merge = tc.attrib.get("hMerge") == "1"+ v_merge = tc.attrib.get("vMerge") == "1"++ if h_merge or v_merge:+ # This cell is a merge slave; leave the slot tied to the anchor+ # if one was already placed there, else mark as dropped placeholder.+ if grid[r][c] is None:+ grid[r][c] = _CellSlot(element=tc, is_dropped=True)+ c += 1+ continue++ slot = _CellSlot(+ element=tc,+ col_span=max(grid_span, 1),+ row_span=max(row_span, 1),+ )+ for dr in range(slot.row_span):+ for dc in range(slot.col_span):+ rr = r + dr+ cc = c + dc+ if rr >= len(rows) or cc >= col_count:+ continue+ if dr == 0 and dc == 0:+ grid[rr][cc] = slot+ else:+ grid[rr][cc] = _CellSlot(+ element=tc, is_dropped=True,+ )+ c += slot.col_span++ return grid+++def _safe_int(value: str | None, default: int) -> int:+ if value is None:+ return default+ try:+ return int(value)+ except ValueError:+ return default+++# ---------------------------------------------------------------------------+# Cell text & borders+# ---------------------------------------------------------------------------++def _convert_cell_text(+ tx_body: ET.Element,+ tcPr: ET.Element | None,+ cell_xfrm: Xfrm,+ palette: ColorPalette | None,+ theme_fonts: dict[str, str] | None,+):+ """Render cell text. PowerPoint's <a:tcPr> can override txBody insets via+ its own marL/marR/marT/marB attrs; convert_txbody reads from <a:bodyPr>,+ so we materialise a synthetic bodyPr by mutating the txBody in place when+ tcPr has its own insets. (We undo the mutation afterwards to keep the+ slide tree pristine for any subsequent passes.)"""+ body_pr = tx_body.find("a:bodyPr", NS)+ overrides = _tcPr_inset_overrides(tcPr)+ saved: dict[str, str | None] = {}+ if overrides and body_pr is not None:+ for key, val in overrides.items():+ saved[key] = body_pr.attrib.get(key)+ body_pr.set(key, val)+ try:+ return convert_txbody(+ tx_body, cell_xfrm, palette, theme_fonts=theme_fonts,+ )+ finally:+ if overrides and body_pr is not None:+ for key, prior in saved.items():+ if prior is None:+ body_pr.attrib.pop(key, None)+ else:+ body_pr.set(key, prior)+++def _tcPr_inset_overrides(tcPr: ET.Element | None) -> dict[str, str]:+ if tcPr is None:+ return {}+ out: dict[str, str] = {}+ for src, dst in (("marL", "lIns"), ("marR", "rIns"),+ ("marT", "tIns"), ("marB", "bIns")):+ if src in tcPr.attrib:+ out[dst] = tcPr.attrib[src]+ return out+++def _border_line(+ tcPr: ET.Element | None,+ tag: str,+ x1: float, y1: float, x2: float, y2: float,+ palette: ColorPalette | None,+ *,+ id_prefix: str,+ id_seq: list[int],+ defs: list[str],+) -> str:+ """Emit a single border <line> for a given cell side, or empty string when+ that side is explicitly noFill / not specified."""+ if tcPr is None:+ return ""+ ln = tcPr.find(tag, NS)+ if ln is None:+ return ""+ # Skip explicit no-line.+ if ln.find("a:noFill", NS) is not None:+ return ""++ stroke = resolve_stroke(+ # resolve_stroke expects a parent that contains <a:ln>; wrap so it+ # finds our tag's own children as the line spec.+ _make_ln_wrapper(ln),+ palette,+ id_prefix=id_prefix,+ id_seq=id_seq,+ )+ defs.extend(stroke.defs)+ attrs = stroke.attrs+ if not attrs.get("stroke"):+ return ""+ attr_str = "".join(f' {k}="{v}"' for k, v in attrs.items())+ return (+ f'<line x1="{fmt_num(x1)}" y1="{fmt_num(y1)}" '+ f'x2="{fmt_num(x2)}" y2="{fmt_num(y2)}"{attr_str}/>'+ )+++def _make_ln_wrapper(ln: ET.Element) -> ET.Element:+ """resolve_stroke walks for ``parent.find('a:ln')``; tcPr borders ARE the+ <a:ln> already, so wrap them in a synthetic parent that points back at+ the original element under the expected tag.+ """+ wrapper = ET.Element(f"{{{NS['a']}}}wrapper")+ proxy = ET.SubElement(wrapper, f"{{{NS['a']}}}ln")+ # Carry attributes (e.g. w="...") and children (solidFill, prstDash, ...).+ for k, v in ln.attrib.items():+ proxy.set(k, v)+ for child in list(ln):+ proxy.append(child)+ return wrapper