Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docx reader: add handling of vml image objects (jgm#4735) #7257

Merged
merged 1 commit into from
Apr 29, 2021

Conversation

mbrackeantidot
Copy link
Contributor

As explained on the mailing list as well:

Currently, when parsing a docx, a v:imagedata tag inside a w:r/w:object/v:shape
is ignored. But it could be treated the same as a v:imagedata inside a
w:r/w:pict, both represent images linked by the r:id attribute.

In fact, we now use a pre-processing to transform a
w:r/w:object/v:shape/v:imagedata to a w:r/w:pict/v:imagedata before transforming
with Pandoc and we have tested this on many documents.

They represent images, the same way as other images in vml format.
Comment on lines +723 to +729
elemToParPart ns element
| isElem ns "w" "r" element
, Just objectElem <- findChildByName ns "w" "object" element
, Just shapeElem <- findChildByName ns "v" "shape" objectElem
, Just imagedataElem <- findChildByName ns "v" "imagedata" shapeElem
, Just drawingId <- findAttrByName ns "r" "id" imagedataElem
= expandDrawingId drawingId >>= (\(fp, bs) -> return $ Drawing fp "" "" bs Nothing)
Copy link
Owner

@jgm jgm Apr 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Big improvement in code clarity!
(EDIT: what I mean is that we should rewrite the stanza above in the same style.)

@jgm jgm merged commit b6a6544 into jgm:master Apr 29, 2021
@jgm
Copy link
Owner

jgm commented Apr 29, 2021

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants