aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorJesse Rosenthal <jrosenthal@jhu.edu>2015-01-19 11:40:33 -0500
committerJesse Rosenthal <jrosenthal@jhu.edu>2015-01-21 13:41:16 -0500
commiteb11c61182032129d7f4824de2afff61b662b9db (patch)
tree48f3d2448514cbef883a8824f6fe4f522c84f9c0 /src/Text/Pandoc/Readers
parent24573b6a5a17b47119733026e29b4bb59f437853 (diff)
downloadpandoc-eb11c61182032129d7f4824de2afff61b662b9db.tar.gz
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.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/Docx/Parse.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Readers/Docx/Parse.hs b/src/Text/Pandoc/Readers/Docx/Parse.hs
index 5fd6b7a81..671d2acf3 100644
--- a/src/Text/Pandoc/Readers/Docx/Parse.hs
+++ b/src/Text/Pandoc/Readers/Docx/Parse.hs
@@ -639,6 +639,16 @@ elemToParPart ns element
case drawing of
Just s -> expandDrawingId s >>= (\(fp, bs) -> return $ Drawing fp bs)
Nothing -> throwError WrongElem
+-- The below is an attempt to deal with images in deprecated vml format.
+elemToParPart ns element
+ | isElem ns "w" "r" element
+ , Just _ <- findChild (elemName ns "w" "pict") element =
+ let drawing = findElement (elemName ns "v" "imagedata") element
+ >>= findAttr (elemName ns "r" "id")
+ in
+ case drawing of
+ Just s -> expandDrawingId s >>= (\(fp, bs) -> return $ Drawing fp bs)
+ Nothing -> throwError WrongElem
elemToParPart ns element
| isElem ns "w" "r" element =
elemToRun ns element >>= (\r -> return $ PlainRun r)