You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OOXML foundation for the headers/footers/slide-numbers/dates/watermarks
epic (#20). Phase 1 ships element-level wrappers only — the public
Slide/Master/Field API lands in Phase 2 and later.
Changes:
- pptx.oxml.slide.CT_HeaderFooter (NEW) — `<p:hf>` element wrapper, with
the four ECMA-376 §19.3.1.18 boolean attributes (sldNum, hdr, ftr, dt),
each OptionalAttribute defaulting to True when absent.
- pptx.oxml.slide.CT_HandoutMaster (NEW) — `<p:handoutMaster>` element
with content model (cSld, clrMap, hf?, extLst?) per §19.3.1.24.
Registered against `p:handoutMaster` so deepcopy + parse + xmlchemy
flow against the right class.
- `hf` ZeroOrOne accessor added to CT_SlideMaster, CT_SlideLayout, and
CT_NotesMaster, using each class's existing `_tag_seq` to compute the
correct successor tuple (so insertion never violates schema order).
- pptx.oxml.text.CT_TextField — surfaces the two attributes the field
authoring API in later phases needs: `id` (RequiredAttribute, XsdString,
per spec a GUID) and `type` (OptionalAttribute, XsdString — values like
`slidenum`, `datetime1`..`datetime13`, `title`). Existing fld parse
paths are unaffected — none of them read .id today.
Out of scope for Phase 1 (deliberate):
- No public Slide.footer / has_slide_number / has_date API (Phase 2)
- No Field / Run.add_field authoring surface (Phase 3 — scanny#797 port)
- No HandoutMaster Python class or HandoutMasterPart plumbing (Phase 5)
- No watermark helper (Phase 5)
Plan correction surfaced during investigation: per ECMA-376, `<p:hf>` is
a child of slide LAYOUTS and the three master types (slide, notes,
handout) — not of individual slides. The original plan listed CT_Slide;
the correct slot list is the four templates. Per-slide footer text flows
through the FOOTER-typed placeholder shape (Phase 2's Slide.footer).
Verification (local, CPython 3.14.4):
- python3 -m pytest tests/ -q → 3514 passed in 6.31s (+29 vs baseline)
- tests/oxml/test_slide.py + tests/oxml/test_text.py: 31 new passing tests
- python3 -m ruff check src tests → All checks passed
- python3 -m ruff format --check src tests → 216 files already formatted
- python3 -m behave features/ --no-color → 1048 scenarios, 0 failed
- python3 uat/uat_headers_footers_phase1.py → PASS (hf attrs round-trip on a real .pptx)
Refs #20.
0 commit comments