git.iko.soy/typeable/pandoc
on master help sign in
Docx: Parse images in deprecated vml format.

Some older versions of word use vml (vector markup language) and put their images in a "v:imagedata" tag inside a "w:pict". We read those as we read the more modern "blip" inside a "w:drawing". Note that this does not mean the reader knows anything about vml. It just looks for a `v:imagdata`. It's possible that, with more complicated uses of images in vml, it won't do the right thing.

commiteb11c61182032129d7f4824de2afff61b662b9db authorJesse Rosenthal <jrosenthal@jhu.edu> dateMon 19 Jan 2015, 11:40 (12 years ago) parent24573b6
1 file changed+10
src/Text/Pandoc/Readers/Docx/Parse.hs+10
src/Text/Pandoc/Readers/Docx/Parse.hs+10
@@ -639,6 +639,16 @@ elemToParPart ns element
639639 case drawing of
640640 Just s -> expandDrawingId s >>= (\(fp, bs) -> return $ Drawing fp bs)
641641 Nothing -> throwError WrongElem
642+-- The below is an attempt to deal with images in deprecated vml format.
643+elemToParPart ns element
644+ | isElem ns "w" "r" element
645+ , Just _ <- findChild (elemName ns "w" "pict") element =
646+ let drawing = findElement (elemName ns "v" "imagedata") element
647+ >>= findAttr (elemName ns "r" "id")
648+ in
649+ case drawing of
650+ Just s -> expandDrawingId s >>= (\(fp, bs) -> return $ Drawing fp bs)
651+ Nothing -> throwError WrongElem
642652elemToParPart ns element
643653 | isElem ns "w" "r" element =
644654 elemToRun ns element >>= (\r -> return $ PlainRun r)