@heylemon/lemonade 0.1.4 → 0.1.6
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.
- package/dist/build-info.json +3 -3
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/web/inbound/monitor.js +0 -1
- package/package.json +1 -1
- package/skills/docx/SKILL.md +20 -464
- package/skills/docx/references/templates.md +46 -0
- package/skills/docx/scripts/create_doc.py +252 -0
- package/skills/docx/scripts/validate_doc.py +75 -0
- package/skills/pptx/SKILL.md +7 -215
- package/skills/pptx/references/spec-format.md +54 -0
- package/skills/pptx/scripts/create_pptx.js +218 -0
- package/skills/xlsx/SKILL.md +12 -281
- package/skills/xlsx/references/spec-format.md +53 -0
- package/skills/xlsx/scripts/create_xlsx.py +222 -0
- package/skills/xlsx/scripts/validate_xlsx.py +73 -0
- package/skills/pptx/editing.md +0 -205
- package/skills/pptx/pptxgenjs.md +0 -420
- package/skills/pptx/scripts/add_slide.py +0 -195
- package/skills/pptx/scripts/clean.py +0 -286
- package/skills/pptx/scripts/thumbnail.py +0 -289
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Pro Sheets — Spreadsheet Creation Engine
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import json
|
|
7
|
+
import sys
|
|
8
|
+
|
|
9
|
+
try:
|
|
10
|
+
import openpyxl
|
|
11
|
+
from openpyxl.styles import Font, PatternFill, Alignment, Border, Side
|
|
12
|
+
from openpyxl.utils import get_column_letter
|
|
13
|
+
except ImportError:
|
|
14
|
+
print("ERROR: openpyxl not installed. Run: pip install openpyxl --break-system-packages")
|
|
15
|
+
sys.exit(1)
|
|
16
|
+
|
|
17
|
+
DEFAULT_BRAND = {
|
|
18
|
+
"primary": "1B3A5C",
|
|
19
|
+
"accent": "2E86AB",
|
|
20
|
+
"light_bg": "F8FAFC",
|
|
21
|
+
"text_dark": "2C3E50",
|
|
22
|
+
"text_light": "FFFFFF",
|
|
23
|
+
"border": "D5D8DC",
|
|
24
|
+
"positive": "27AE60",
|
|
25
|
+
"negative": "E74C3C",
|
|
26
|
+
"highlight": "FFF8E1",
|
|
27
|
+
"font": "Arial",
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def hex_color(c):
|
|
32
|
+
return c.lstrip("#")
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def make_border(color="D5D8DC"):
|
|
36
|
+
side = Side(style="thin", color=hex_color(color))
|
|
37
|
+
return Border(left=side, right=side, top=side, bottom=side)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def header_font(brand, size=11):
|
|
41
|
+
return Font(bold=True, size=size, color=hex_color(brand["text_light"]), name=brand["font"])
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def header_fill(brand):
|
|
45
|
+
return PatternFill("solid", fgColor=hex_color(brand["primary"]))
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def body_font(brand, size=11, bold=False, color=None):
|
|
49
|
+
return Font(size=size, name=brand["font"], bold=bold, color=hex_color(color or brand["text_dark"]))
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def alt_fill(brand, row_idx):
|
|
53
|
+
if row_idx % 2 == 0:
|
|
54
|
+
return PatternFill("solid", fgColor=hex_color(brand["light_bg"]))
|
|
55
|
+
return PatternFill(fill_type=None)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class ProSheetBuilder:
|
|
59
|
+
def __init__(self, spec):
|
|
60
|
+
self.spec = spec
|
|
61
|
+
self.brand = {**DEFAULT_BRAND, **(spec.get("brand", {}))}
|
|
62
|
+
self.wb = openpyxl.Workbook()
|
|
63
|
+
self.border = make_border(self.brand["border"])
|
|
64
|
+
|
|
65
|
+
def build(self, output_path):
|
|
66
|
+
sheets = self.spec.get("sheets", [])
|
|
67
|
+
if not sheets:
|
|
68
|
+
print("ERROR: No sheets defined in spec")
|
|
69
|
+
sys.exit(1)
|
|
70
|
+
|
|
71
|
+
for si, sheet_spec in enumerate(sheets):
|
|
72
|
+
if si == 0:
|
|
73
|
+
ws = self.wb.active
|
|
74
|
+
ws.title = sheet_spec.get("name", "Sheet1")
|
|
75
|
+
else:
|
|
76
|
+
ws = self.wb.create_sheet(sheet_spec.get("name", f"Sheet{si+1}"))
|
|
77
|
+
self._build_sheet(ws, sheet_spec)
|
|
78
|
+
|
|
79
|
+
self.wb.save(output_path)
|
|
80
|
+
return output_path
|
|
81
|
+
|
|
82
|
+
def _build_sheet(self, ws, sheet_spec):
|
|
83
|
+
sheet_type = sheet_spec.get("type", "data")
|
|
84
|
+
if sheet_type == "dashboard":
|
|
85
|
+
self._build_dashboard(ws, sheet_spec)
|
|
86
|
+
elif sheet_type == "financial":
|
|
87
|
+
self._build_financial(ws, sheet_spec)
|
|
88
|
+
else:
|
|
89
|
+
self._build_data_sheet(ws, sheet_spec)
|
|
90
|
+
|
|
91
|
+
freeze = sheet_spec.get("freeze_panes")
|
|
92
|
+
if freeze:
|
|
93
|
+
ws.freeze_panes = freeze
|
|
94
|
+
if sheet_spec.get("auto_filter", False) and ws.max_row > 1:
|
|
95
|
+
ws.auto_filter.ref = f"A1:{get_column_letter(ws.max_column)}{ws.max_row}"
|
|
96
|
+
|
|
97
|
+
def _build_data_sheet(self, ws, sheet_spec):
|
|
98
|
+
headers = sheet_spec.get("headers", [])
|
|
99
|
+
rows = sheet_spec.get("rows", [])
|
|
100
|
+
col_widths = sheet_spec.get("col_widths", [])
|
|
101
|
+
title = sheet_spec.get("title")
|
|
102
|
+
start_row = 1
|
|
103
|
+
|
|
104
|
+
if title:
|
|
105
|
+
ws.cell(row=1, column=1, value=title).font = Font(
|
|
106
|
+
bold=True, size=16, color=hex_color(self.brand["text_dark"]), name=self.brand["font"]
|
|
107
|
+
)
|
|
108
|
+
ws.merge_cells(start_row=1, start_column=1, end_row=1, end_column=max(len(headers), 1))
|
|
109
|
+
start_row = 3
|
|
110
|
+
|
|
111
|
+
if headers:
|
|
112
|
+
for ci, h in enumerate(headers, 1):
|
|
113
|
+
cell = ws.cell(row=start_row, column=ci, value=h)
|
|
114
|
+
cell.font = header_font(self.brand)
|
|
115
|
+
cell.fill = header_fill(self.brand)
|
|
116
|
+
cell.alignment = Alignment(horizontal="center", wrap_text=True)
|
|
117
|
+
cell.border = self.border
|
|
118
|
+
|
|
119
|
+
for ri, row_data in enumerate(rows):
|
|
120
|
+
r = start_row + 1 + ri
|
|
121
|
+
for ci, val in enumerate(row_data, 1):
|
|
122
|
+
cell = ws.cell(row=r, column=ci, value=val)
|
|
123
|
+
cell.font = body_font(self.brand)
|
|
124
|
+
cell.fill = alt_fill(self.brand, ri)
|
|
125
|
+
cell.border = self.border
|
|
126
|
+
cell.alignment = Alignment(wrap_text=True, vertical="top")
|
|
127
|
+
if isinstance(val, (int, float)):
|
|
128
|
+
cell.alignment = Alignment(horizontal="right", vertical="top")
|
|
129
|
+
if isinstance(val, float) and abs(val) < 1:
|
|
130
|
+
cell.number_format = "0.0%"
|
|
131
|
+
elif isinstance(val, float):
|
|
132
|
+
cell.number_format = "#,##0.00"
|
|
133
|
+
elif isinstance(val, int) and val > 999:
|
|
134
|
+
cell.number_format = "#,##0"
|
|
135
|
+
|
|
136
|
+
if col_widths:
|
|
137
|
+
for ci, w in enumerate(col_widths, 1):
|
|
138
|
+
ws.column_dimensions[get_column_letter(ci)].width = w
|
|
139
|
+
else:
|
|
140
|
+
for ci, h in enumerate(headers, 1):
|
|
141
|
+
ws.column_dimensions[get_column_letter(ci)].width = max(len(str(h)) + 4, 12)
|
|
142
|
+
|
|
143
|
+
for formula_spec in sheet_spec.get("formulas", []):
|
|
144
|
+
cell = ws[formula_spec["cell"]]
|
|
145
|
+
cell.value = formula_spec["formula"]
|
|
146
|
+
if formula_spec.get("bold", False):
|
|
147
|
+
cell.font = body_font(self.brand, bold=True)
|
|
148
|
+
cell.border = self.border
|
|
149
|
+
|
|
150
|
+
def _build_dashboard(self, ws, sheet_spec):
|
|
151
|
+
title = sheet_spec.get("title", "Dashboard")
|
|
152
|
+
kpis = sheet_spec.get("kpis", [])
|
|
153
|
+
sections = sheet_spec.get("sections", [])
|
|
154
|
+
|
|
155
|
+
ws.cell(row=1, column=1, value=title).font = Font(
|
|
156
|
+
bold=True, size=18, color=hex_color(self.brand["text_dark"]), name=self.brand["font"]
|
|
157
|
+
)
|
|
158
|
+
ws.merge_cells(start_row=1, start_column=1, end_row=1, end_column=max(len(kpis) * 2, 6))
|
|
159
|
+
|
|
160
|
+
if kpis:
|
|
161
|
+
r = 3
|
|
162
|
+
for ki, kpi in enumerate(kpis):
|
|
163
|
+
col = ki * 2 + 1
|
|
164
|
+
v = ws.cell(row=r, column=col, value=kpi.get("value", ""))
|
|
165
|
+
v.font = Font(bold=True, size=22, name=self.brand["font"], color=hex_color(self.brand["accent"]))
|
|
166
|
+
v.alignment = Alignment(horizontal="center")
|
|
167
|
+
ws.merge_cells(start_row=r, start_column=col, end_row=r, end_column=col + 1)
|
|
168
|
+
|
|
169
|
+
l = ws.cell(row=r + 1, column=col, value=kpi.get("label", ""))
|
|
170
|
+
l.font = Font(size=9, color="7F8C8D", name=self.brand["font"])
|
|
171
|
+
l.alignment = Alignment(horizontal="center")
|
|
172
|
+
ws.merge_cells(start_row=r + 1, start_column=col, end_row=r + 1, end_column=col + 1)
|
|
173
|
+
|
|
174
|
+
for dr in range(3):
|
|
175
|
+
for dc in range(2):
|
|
176
|
+
c = ws.cell(row=r + dr, column=col + dc)
|
|
177
|
+
c.fill = PatternFill("solid", fgColor=hex_color(self.brand["highlight"]))
|
|
178
|
+
c.border = self.border
|
|
179
|
+
|
|
180
|
+
current_row = 8 if kpis else 3
|
|
181
|
+
for section in sections:
|
|
182
|
+
ws.cell(row=current_row, column=1, value=section.get("title", "")).font = Font(
|
|
183
|
+
bold=True, size=13, color=hex_color(self.brand["text_dark"]), name=self.brand["font"]
|
|
184
|
+
)
|
|
185
|
+
current_row += 1
|
|
186
|
+
headers = section.get("headers", [])
|
|
187
|
+
rows = section.get("rows", [])
|
|
188
|
+
for ci, h in enumerate(headers, 1):
|
|
189
|
+
c = ws.cell(row=current_row, column=ci, value=h)
|
|
190
|
+
c.font = header_font(self.brand, size=10)
|
|
191
|
+
c.fill = header_fill(self.brand)
|
|
192
|
+
c.border = self.border
|
|
193
|
+
c.alignment = Alignment(horizontal="center")
|
|
194
|
+
for ri, row_data in enumerate(rows):
|
|
195
|
+
r = current_row + 1 + ri
|
|
196
|
+
for ci, val in enumerate(row_data, 1):
|
|
197
|
+
c = ws.cell(row=r, column=ci, value=val)
|
|
198
|
+
c.font = body_font(self.brand, size=10)
|
|
199
|
+
c.fill = alt_fill(self.brand, ri)
|
|
200
|
+
c.border = self.border
|
|
201
|
+
current_row += len(rows) + 3
|
|
202
|
+
|
|
203
|
+
def _build_financial(self, ws, sheet_spec):
|
|
204
|
+
self._build_data_sheet(ws, sheet_spec)
|
|
205
|
+
for ref in sheet_spec.get("input_cells", []):
|
|
206
|
+
ws[ref].font = Font(size=11, name=self.brand["font"], color="0000FF")
|
|
207
|
+
for ref in sheet_spec.get("assumption_cells", []):
|
|
208
|
+
ws[ref].fill = PatternFill("solid", fgColor="FFFF00")
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
def main():
|
|
212
|
+
if len(sys.argv) < 3:
|
|
213
|
+
print("Usage: python create_xlsx.py spec.json output.xlsx")
|
|
214
|
+
sys.exit(1)
|
|
215
|
+
with open(sys.argv[1], "r", encoding="utf-8") as f:
|
|
216
|
+
spec = json.load(f)
|
|
217
|
+
ProSheetBuilder(spec).build(sys.argv[2])
|
|
218
|
+
print(f"Spreadsheet created: {sys.argv[2]}")
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
if __name__ == "__main__":
|
|
222
|
+
main()
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Validate an .xlsx file for formula errors.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import json
|
|
7
|
+
import os
|
|
8
|
+
import sys
|
|
9
|
+
|
|
10
|
+
try:
|
|
11
|
+
from openpyxl import load_workbook
|
|
12
|
+
except ImportError:
|
|
13
|
+
print("ERROR: openpyxl not installed. Run: pip install openpyxl --break-system-packages")
|
|
14
|
+
sys.exit(1)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def validate(path):
|
|
18
|
+
if not os.path.exists(path):
|
|
19
|
+
print(json.dumps({"status": "error", "message": f"File not found: {path}"}))
|
|
20
|
+
return 1
|
|
21
|
+
|
|
22
|
+
wb = load_workbook(path, data_only=False)
|
|
23
|
+
wb_data = load_workbook(path, data_only=True)
|
|
24
|
+
result = {
|
|
25
|
+
"status": "success",
|
|
26
|
+
"total_errors": 0,
|
|
27
|
+
"total_formulas": 0,
|
|
28
|
+
"error_summary": {},
|
|
29
|
+
"warnings": [],
|
|
30
|
+
"sheets": {},
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
error_types = ["#REF!", "#DIV/0!", "#VALUE!", "#N/A", "#NAME?", "#NULL!", "#NUM!"]
|
|
34
|
+
|
|
35
|
+
for sheet_name in wb.sheetnames:
|
|
36
|
+
ws = wb[sheet_name]
|
|
37
|
+
ws_data = wb_data[sheet_name]
|
|
38
|
+
sheet_info = {"rows": ws.max_row, "cols": ws.max_column, "formulas": 0, "errors": []}
|
|
39
|
+
|
|
40
|
+
for row in ws.iter_rows():
|
|
41
|
+
for cell in row:
|
|
42
|
+
if cell.value and isinstance(cell.value, str) and cell.value.startswith("="):
|
|
43
|
+
sheet_info["formulas"] += 1
|
|
44
|
+
result["total_formulas"] += 1
|
|
45
|
+
data_cell = ws_data[cell.coordinate]
|
|
46
|
+
if data_cell.value and isinstance(data_cell.value, str):
|
|
47
|
+
for err_type in error_types:
|
|
48
|
+
if err_type in str(data_cell.value):
|
|
49
|
+
sheet_info["errors"].append(
|
|
50
|
+
{"cell": cell.coordinate, "formula": cell.value, "error": err_type}
|
|
51
|
+
)
|
|
52
|
+
result["total_errors"] += 1
|
|
53
|
+
if err_type not in result["error_summary"]:
|
|
54
|
+
result["error_summary"][err_type] = {"count": 0, "locations": []}
|
|
55
|
+
result["error_summary"][err_type]["count"] += 1
|
|
56
|
+
result["error_summary"][err_type]["locations"].append(
|
|
57
|
+
f"{sheet_name}!{cell.coordinate}"
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
result["sheets"][sheet_name] = sheet_info
|
|
61
|
+
|
|
62
|
+
if result["total_errors"] > 0:
|
|
63
|
+
result["status"] = "errors_found"
|
|
64
|
+
|
|
65
|
+
print(json.dumps(result, indent=2))
|
|
66
|
+
return 0 if result["total_errors"] == 0 else 1
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
if __name__ == "__main__":
|
|
70
|
+
if len(sys.argv) < 2:
|
|
71
|
+
print("Usage: python validate_xlsx.py spreadsheet.xlsx")
|
|
72
|
+
sys.exit(1)
|
|
73
|
+
sys.exit(validate(sys.argv[1]))
|
package/skills/pptx/editing.md
DELETED
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
# Editing Presentations
|
|
2
|
-
|
|
3
|
-
## Template-Based Workflow
|
|
4
|
-
|
|
5
|
-
When using an existing presentation as a template:
|
|
6
|
-
|
|
7
|
-
1. **Analyze existing slides**:
|
|
8
|
-
```bash
|
|
9
|
-
python scripts/thumbnail.py template.pptx
|
|
10
|
-
python -m markitdown template.pptx
|
|
11
|
-
```
|
|
12
|
-
Review `thumbnails.jpg` to see layouts, and markitdown output to see placeholder text.
|
|
13
|
-
|
|
14
|
-
2. **Plan slide mapping**: For each content section, choose a template slide.
|
|
15
|
-
|
|
16
|
-
⚠️ **USE VARIED LAYOUTS** — monotonous presentations are a common failure mode. Don't default to basic title + bullet slides. Actively seek out:
|
|
17
|
-
- Multi-column layouts (2-column, 3-column)
|
|
18
|
-
- Image + text combinations
|
|
19
|
-
- Full-bleed images with text overlay
|
|
20
|
-
- Quote or callout slides
|
|
21
|
-
- Section dividers
|
|
22
|
-
- Stat/number callouts
|
|
23
|
-
- Icon grids or icon + text rows
|
|
24
|
-
|
|
25
|
-
**Avoid:** Repeating the same text-heavy layout for every slide.
|
|
26
|
-
|
|
27
|
-
Match content type to layout style (e.g., key points → bullet slide, team info → multi-column, testimonials → quote slide).
|
|
28
|
-
|
|
29
|
-
3. **Unpack**: `python scripts/office/unpack.py template.pptx unpacked/`
|
|
30
|
-
|
|
31
|
-
4. **Build presentation** (do this yourself, not with subagents):
|
|
32
|
-
- Delete unwanted slides (remove from `<p:sldIdLst>`)
|
|
33
|
-
- Duplicate slides you want to reuse (`add_slide.py`)
|
|
34
|
-
- Reorder slides in `<p:sldIdLst>`
|
|
35
|
-
- **Complete all structural changes before step 5**
|
|
36
|
-
|
|
37
|
-
5. **Edit content**: Update text in each `slide{N}.xml`.
|
|
38
|
-
**Use subagents here if available** — slides are separate XML files, so subagents can edit in parallel.
|
|
39
|
-
|
|
40
|
-
6. **Clean**: `python scripts/clean.py unpacked/`
|
|
41
|
-
|
|
42
|
-
7. **Pack**: `python scripts/office/pack.py unpacked/ output.pptx --original template.pptx`
|
|
43
|
-
|
|
44
|
-
---
|
|
45
|
-
|
|
46
|
-
## Scripts
|
|
47
|
-
|
|
48
|
-
| Script | Purpose |
|
|
49
|
-
|--------|---------|
|
|
50
|
-
| `unpack.py` | Extract and pretty-print PPTX |
|
|
51
|
-
| `add_slide.py` | Duplicate slide or create from layout |
|
|
52
|
-
| `clean.py` | Remove orphaned files |
|
|
53
|
-
| `pack.py` | Repack with validation |
|
|
54
|
-
| `thumbnail.py` | Create visual grid of slides |
|
|
55
|
-
|
|
56
|
-
### unpack.py
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
python scripts/office/unpack.py input.pptx unpacked/
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
Extracts PPTX, pretty-prints XML, escapes smart quotes.
|
|
63
|
-
|
|
64
|
-
### add_slide.py
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
python scripts/add_slide.py unpacked/ slide2.xml # Duplicate slide
|
|
68
|
-
python scripts/add_slide.py unpacked/ slideLayout2.xml # From layout
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
Prints `<p:sldId>` to add to `<p:sldIdLst>` at desired position.
|
|
72
|
-
|
|
73
|
-
### clean.py
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
python scripts/clean.py unpacked/
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
Removes slides not in `<p:sldIdLst>`, unreferenced media, orphaned rels.
|
|
80
|
-
|
|
81
|
-
### pack.py
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
python scripts/office/pack.py unpacked/ output.pptx --original input.pptx
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
Validates, repairs, condenses XML, re-encodes smart quotes.
|
|
88
|
-
|
|
89
|
-
### thumbnail.py
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
python scripts/thumbnail.py input.pptx [output_prefix] [--cols N]
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
Creates `thumbnails.jpg` with slide filenames as labels. Default 3 columns, max 12 per grid.
|
|
96
|
-
|
|
97
|
-
**Use for template analysis only** (choosing layouts). For visual QA, use `soffice` + `pdftoppm` to create full-resolution individual slide images—see SKILL.md.
|
|
98
|
-
|
|
99
|
-
---
|
|
100
|
-
|
|
101
|
-
## Slide Operations
|
|
102
|
-
|
|
103
|
-
Slide order is in `ppt/presentation.xml` → `<p:sldIdLst>`.
|
|
104
|
-
|
|
105
|
-
**Reorder**: Rearrange `<p:sldId>` elements.
|
|
106
|
-
|
|
107
|
-
**Delete**: Remove `<p:sldId>`, then run `clean.py`.
|
|
108
|
-
|
|
109
|
-
**Add**: Use `add_slide.py`. Never manually copy slide files—the script handles notes references, Content_Types.xml, and relationship IDs that manual copying misses.
|
|
110
|
-
|
|
111
|
-
---
|
|
112
|
-
|
|
113
|
-
## Editing Content
|
|
114
|
-
|
|
115
|
-
**Subagents:** If available, use them here (after completing step 4). Each slide is a separate XML file, so subagents can edit in parallel. In your prompt to subagents, include:
|
|
116
|
-
- The slide file path(s) to edit
|
|
117
|
-
- **"Use the Edit tool for all changes"**
|
|
118
|
-
- The formatting rules and common pitfalls below
|
|
119
|
-
|
|
120
|
-
For each slide:
|
|
121
|
-
1. Read the slide's XML
|
|
122
|
-
2. Identify ALL placeholder content—text, images, charts, icons, captions
|
|
123
|
-
3. Replace each placeholder with final content
|
|
124
|
-
|
|
125
|
-
**Use the Edit tool, not sed or Python scripts.** The Edit tool forces specificity about what to replace and where, yielding better reliability.
|
|
126
|
-
|
|
127
|
-
### Formatting Rules
|
|
128
|
-
|
|
129
|
-
- **Bold all headers, subheadings, and inline labels**: Use `b="1"` on `<a:rPr>`. This includes:
|
|
130
|
-
- Slide titles
|
|
131
|
-
- Section headers within a slide
|
|
132
|
-
- Inline labels like (e.g.: "Status:", "Description:") at the start of a line
|
|
133
|
-
- **Never use unicode bullets (•)**: Use proper list formatting with `<a:buChar>` or `<a:buAutoNum>`
|
|
134
|
-
- **Bullet consistency**: Let bullets inherit from the layout. Only specify `<a:buChar>` or `<a:buNone>`.
|
|
135
|
-
|
|
136
|
-
---
|
|
137
|
-
|
|
138
|
-
## Common Pitfalls
|
|
139
|
-
|
|
140
|
-
### Template Adaptation
|
|
141
|
-
|
|
142
|
-
When source content has fewer items than the template:
|
|
143
|
-
- **Remove excess elements entirely** (images, shapes, text boxes), don't just clear text
|
|
144
|
-
- Check for orphaned visuals after clearing text content
|
|
145
|
-
- Run visual QA to catch mismatched counts
|
|
146
|
-
|
|
147
|
-
When replacing text with different length content:
|
|
148
|
-
- **Shorter replacements**: Usually safe
|
|
149
|
-
- **Longer replacements**: May overflow or wrap unexpectedly
|
|
150
|
-
- Test with visual QA after text changes
|
|
151
|
-
- Consider truncating or splitting content to fit the template's design constraints
|
|
152
|
-
|
|
153
|
-
**Template slots ≠ Source items**: If template has 4 team members but source has 3 users, delete the 4th member's entire group (image + text boxes), not just the text.
|
|
154
|
-
|
|
155
|
-
### Multi-Item Content
|
|
156
|
-
|
|
157
|
-
If source has multiple items (numbered lists, multiple sections), create separate `<a:p>` elements for each — **never concatenate into one string**.
|
|
158
|
-
|
|
159
|
-
**❌ WRONG** — all items in one paragraph:
|
|
160
|
-
```xml
|
|
161
|
-
<a:p>
|
|
162
|
-
<a:r><a:rPr .../><a:t>Step 1: Do the first thing. Step 2: Do the second thing.</a:t></a:r>
|
|
163
|
-
</a:p>
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
**✅ CORRECT** — separate paragraphs with bold headers:
|
|
167
|
-
```xml
|
|
168
|
-
<a:p>
|
|
169
|
-
<a:pPr algn="l"><a:lnSpc><a:spcPts val="3919"/></a:lnSpc></a:pPr>
|
|
170
|
-
<a:r><a:rPr lang="en-US" sz="2799" b="1" .../><a:t>Step 1</a:t></a:r>
|
|
171
|
-
</a:p>
|
|
172
|
-
<a:p>
|
|
173
|
-
<a:pPr algn="l"><a:lnSpc><a:spcPts val="3919"/></a:lnSpc></a:pPr>
|
|
174
|
-
<a:r><a:rPr lang="en-US" sz="2799" .../><a:t>Do the first thing.</a:t></a:r>
|
|
175
|
-
</a:p>
|
|
176
|
-
<a:p>
|
|
177
|
-
<a:pPr algn="l"><a:lnSpc><a:spcPts val="3919"/></a:lnSpc></a:pPr>
|
|
178
|
-
<a:r><a:rPr lang="en-US" sz="2799" b="1" .../><a:t>Step 2</a:t></a:r>
|
|
179
|
-
</a:p>
|
|
180
|
-
<!-- continue pattern -->
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
Copy `<a:pPr>` from the original paragraph to preserve line spacing. Use `b="1"` on headers.
|
|
184
|
-
|
|
185
|
-
### Smart Quotes
|
|
186
|
-
|
|
187
|
-
Handled automatically by unpack/pack. But the Edit tool converts smart quotes to ASCII.
|
|
188
|
-
|
|
189
|
-
**When adding new text with quotes, use XML entities:**
|
|
190
|
-
|
|
191
|
-
```xml
|
|
192
|
-
<a:t>the “Agreement”</a:t>
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
| Character | Name | Unicode | XML Entity |
|
|
196
|
-
|-----------|------|---------|------------|
|
|
197
|
-
| `“` | Left double quote | U+201C | `“` |
|
|
198
|
-
| `”` | Right double quote | U+201D | `”` |
|
|
199
|
-
| `‘` | Left single quote | U+2018 | `‘` |
|
|
200
|
-
| `’` | Right single quote | U+2019 | `’` |
|
|
201
|
-
|
|
202
|
-
### Other
|
|
203
|
-
|
|
204
|
-
- **Whitespace**: Use `xml:space="preserve"` on `<a:t>` with leading/trailing spaces
|
|
205
|
-
- **XML parsing**: Use `defusedxml.minidom`, not `xml.etree.ElementTree` (corrupts namespaces)
|