Add public inline shape description and title properties - #1613
Draft
pseudosavant wants to merge 1 commit into
Draft
pseudosavant wants to merge 1 commit into
pseudosavant wants to merge 1 commit into
Conversation
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
Inline pictures currently have no public API for reading or writing their alternative-text description and title. This draft adds
InlineShape.descriptionandInlineShape.title, allowing callers to preserve image descriptions without manipulating XML.The properties map to
wp:docPr/@descrandwp:docPr/@title. They apply to each placed shape, so repeated uses of one image can carry different descriptions.Scope and behavior
add_picture()signatures. Callers set metadata on the returned shape.Nonefor an absent attribute. AssigningNoneremoves it. An empty string remains explicit.pic:cNvPrmetadata unchanged and do not use it as a fallback.Related work and API feedback
Related to #1530, #227, and #317. In particular, this follows the properties-only scope discussed as an option in #1530. That proposal uses
alt_textandalt_title, while this draft usesdescriptionandtitle. Naming and missing/empty-value conventions are open for discussion.This implementation is used in a separately published fork by the Markdown converter
markdown-docx. That is currently the fork's only consumer. We can update both projects to follow the conventions agreed here, so the fork's published names do not need to constrain the upstream API.This branch is based directly on upstream
masterand contains one feature commit. Fork packaging, release configuration, theme-font changes, and hyperlink changes are excluded.Validation