fix: add notesMasterIdLst element when creating notes master#1128
Open
robbybrodie wants to merge 1 commit intoscanny:developfrom
Open
fix: add notesMasterIdLst element when creating notes master#1128robbybrodie wants to merge 1 commit intoscanny:developfrom
robbybrodie wants to merge 1 commit intoscanny:developfrom
Conversation
When python-pptx creates a notes master on first access to slide.notes_slide, it correctly creates the NotesMasterPart and adds the relationship in the .rels file, but omits the corresponding <p:notesMasterIdLst> reference from presentation.xml. Without this element, OOXML consumers cannot discover the notes master from the presentation element, even though the relationship and part exist. This causes Apple Keynote (and potentially other consumers) to fail to recognize the notes master, breaking speaker notes import. This fix: - Adds CT_NotesMasterIdList and CT_NotesMasterIdListEntry element classes with proper ZeroOrOne/RequiredAttribute declarations - Registers both element classes in the oxml element class lookup - Adds a ZeroOrOne declaration for notesMasterIdLst on CT_Presentation with correct successor sequence - Updates PresentationPart.notes_master_part to populate the notesMasterIdLst element with the relationship ID after creating the notes master relationship Closes scanny#1051
2e83480 to
c14854d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When python-pptx creates a notes master on first access to
slide.notes_slide, it correctly creates theNotesMasterPartand adds the relationship in the.relsfile, but omits the corresponding<p:notesMasterIdLst>reference frompresentation.xml. Without this element, OOXML consumers cannot discover the notes master from the presentation element, even though the relationship and part exist in the package.This causes Apple Keynote (and potentially other OOXML consumers) to fail to recognize the notes master, breaking speaker notes when opening python-pptx-generated files.
What this PR does
CT_NotesMasterIdListandCT_NotesMasterIdListEntryelement classes with properZeroOrOne/RequiredAttributedeclarationsZeroOrOnedeclaration fornotesMasterIdLstonCT_Presentationwith the correct successor sequence per the OOXML specPresentationPart.notes_master_partto populate thenotesMasterIdLstelement with the relationship ID after creating the notes master relationshipBefore (missing element)
After (element present)
Test results
Unit tests (pytest): 2700 passed, 0 failed
Acceptance tests (behave): 54 features, 973 scenarios, 2914 steps — all passed
The existing acceptance test in
prs-presentation-props.feature(Presentation.notes_masterwithno notes master) already exercises the code path this fix modifies — creating a notes master when none exists. No new acceptance test was needed.Manual verification:
notesMasterIdLstelement inpresentation.xmlCloses #1051