Release standalone PPT template workflow 0.5.0
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
"""Structured diagnostics for tolerant PPTX-to-SVG import."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import asdict, dataclass
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class ImportDiagnostic:
|
||||
"""Describe one source-owned construct that required import recovery."""
|
||||
|
||||
code: str
|
||||
message: str
|
||||
fallback: str
|
||||
part_path: str = ""
|
||||
slide_index: int | None = None
|
||||
shape_id: str = ""
|
||||
shape_name: str = ""
|
||||
shape_kind: str = ""
|
||||
severity: str = "warning"
|
||||
|
||||
def to_dict(self) -> dict[str, object]:
|
||||
"""Return the stable JSON representation."""
|
||||
return {
|
||||
key: value
|
||||
for key, value in asdict(self).items()
|
||||
if value not in {"", None}
|
||||
}
|
||||
|
||||
|
||||
def append_diagnostic(
|
||||
diagnostics: list[ImportDiagnostic],
|
||||
diagnostic: ImportDiagnostic,
|
||||
) -> None:
|
||||
"""Append one diagnostic while suppressing duplicate layered/flat reports."""
|
||||
if diagnostic not in diagnostics:
|
||||
diagnostics.append(diagnostic)
|
||||
Reference in New Issue
Block a user