Repository navigation
Conversation
Pins the visible caption of every way an image reaches a DOCX document (plain, cross-ref, subfigure panel, div float, non-crossref layout, linked, table cell, callout, knitr and Jupyter cells), so changes to how alt text is handled in DOCX can be checked against unchanged captions. Every alt value carries a marker that must never show up as document text. The image description (descr) is asserted only for images without fig-alt, where it must not change: the caption for a plain figure, empty for a cross-referenced one and for the callout icon. Caption text is compared with string-join(.//w:t, '') rather than normalize-space(.): cross-ref caption paragraphs carry a raw second w:pPr with whitespace text nodes, and fontoxpath's normalize-space turns the non-breaking space after "Figure" into a plain space.
The hand-built image.png had a bad IDAT CRC and zlib checksum, so the DOCX could embed an undecodable image while the XML assertions still passed. Reuse an existing valid 1x1 fixture instead.
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
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.
#15077 changes how
fig-altreaches DOCX: a late fixup inquarto-post/docx.luarewrites each image's inline content so Pandoc writes it as the picture description (wp:docPr/@descr). Its tests cover diagrams, one captioned image and one cross-referenced image. Nothing currently pins the visible caption for the other ways an image ends up in a DOCX document, so it is hard to check that the fixup only changesdescr.These smoke-all tests go to main first. Then main gets merged into #15077, and CI has to stay green on that branch with them.
They assert the visible caption text for:
layout-ncolfig-altfig-subcaplayoutEvery alt value includes an
ALT-ONLYmarker, and the tests check that this marker never shows up in the document text. Fordescr, only the values that must stay the same are asserted: images withoutfig-alt(the caption for a plain figure, empty for a cross-referenced one and for the callout icon). Thedescrvalues that #15077 changes on purpose will get assertions on its branch after the merge.Caption text is compared with
string-join(.//w:t, '')and not withnormalize-space(.). fontoxpath'snormalize-spaceturns the non-breaking space after "Figure" into a regular space, and cross-ref caption paragraphs have extra whitespace-only text nodes.Related to #15077
Checklist
I have (if applicable):
AI-assisted PR
Note: autonomous AI agents submitting PRs without human oversight are not permitted — see the Code of Conduct.