From 4ef850ded53c7e2bd815dbcb3d2e2b1af3b3de69 Mon Sep 17 00:00:00 2001 From: Jesse Rosenthal Date: Tue, 2 Sep 2014 13:45:01 -0400 Subject: Docx reader: Fix window path for image lookup. Don't use os-sensitive "combine", since we always want the paths in our zip-archive to use forward-slashes. --- src/Text/Pandoc/Readers/Docx/Parse.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Text/Pandoc/Readers/Docx/Parse.hs b/src/Text/Pandoc/Readers/Docx/Parse.hs index e7a6c3ffb..2945a1eda 100644 --- a/src/Text/Pandoc/Readers/Docx/Parse.hs +++ b/src/Text/Pandoc/Readers/Docx/Parse.hs @@ -584,7 +584,7 @@ expandDrawingId s = do target <- asks (lookupRelationship s . envRelationships) case target of Just filepath -> do - bytes <- asks (lookup (combine "word" filepath) . envMedia) + bytes <- asks (lookup ("word/" ++ filepath) . envMedia) case bytes of Just bs -> return (filepath, bs) Nothing -> throwError DocxError -- cgit v1.2.3 From a6eead7f261ed47269e7f7e45b5774d8620e602b Mon Sep 17 00:00:00 2001 From: Jesse Rosenthal Date: Tue, 2 Sep 2014 14:05:54 -0400 Subject: Docx reader: Modify mediabag test accordingly. --- tests/Tests/Readers/Docx.hs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/Tests/Readers/Docx.hs b/tests/Tests/Readers/Docx.hs index 234b1b5b7..84da324b6 100644 --- a/tests/Tests/Readers/Docx.hs +++ b/tests/Tests/Readers/Docx.hs @@ -13,7 +13,6 @@ import Text.Pandoc.Writers.Native (writeNative) import qualified Data.Map as M import Text.Pandoc.MediaBag (MediaBag, lookupMedia, mediaDirectory) import Codec.Archive.Zip -import System.FilePath (combine) -- We define a wrapper around pandoc that doesn't normalize in the -- tests. Since we do our own normalization, we want to make sure @@ -60,7 +59,7 @@ testCompare = testCompareWithOpts def getMedia :: FilePath -> FilePath -> IO (Maybe B.ByteString) getMedia archivePath mediaPath = do zf <- B.readFile archivePath >>= return . toArchive - return $ findEntryByPath (combine "word" mediaPath) zf >>= (Just . fromEntry) + return $ findEntryByPath ("word/" ++ mediaPath) zf >>= (Just . fromEntry) compareMediaPathIO :: FilePath -> MediaBag -> FilePath -> IO Bool compareMediaPathIO mediaPath mediaBag docxPath = do -- cgit v1.2.3