@@ -142,7 +142,7 @@ import qualified System.Environment as IO (lookupEnv)
142142import System.FilePath.Glob (match, compile)
143143import System.Directory (createDirectoryIfMissing, getDirectoryContents,
144144 doesDirectoryExist)
145−import System.FilePath ((</>), (<.>), takeDirectory, makeRelative,
145+import System.FilePath ((</>), (<.>), takeDirectory,
146146 takeExtension, dropExtension, isRelative, normalise)
147147import qualified System.FilePath.Glob as IO (glob)
148148import qualified System.Directory as IO (getModificationTime)
@@ -621,6 +621,7 @@ getDefaultReferenceDocx = do
621621 "word/document.xml",
622622 "word/fontTable.xml",
623623 "word/footnotes.xml",
624+ "word/comments.xml",
624625 "word/numbering.xml",
625626 "word/settings.xml",
626627 "word/webSettings.xml",
@@ -761,15 +762,17 @@ readDefaultDataFile fname =
761762 case lookup (makeCanonical fname) dataFiles of
762763 Nothing -> throwError $ PandocCouldNotFindDataFileError fname
763764 Just contents -> return contents
764− where makeCanonical = Posix.joinPath . transformPathParts . splitDirectories
765− transformPathParts = reverse . foldl go []
766− go as "." = as
767− go (_:as) ".." = as
768− go as x = x : as
769765#else
770766 getDataFileName fname' >>= checkExistence >>= readFileStrict
771767 where fname' = if fname == "MANUAL.txt" then fname else "data" </> fname
772768
769+makeCanonical :: FilePath -> FilePath
770+makeCanonical = Posix.joinPath . transformPathParts . splitDirectories
771+ where transformPathParts = reverse . foldl go []
772+ go as "." = as
773+ go (_:as) ".." = as
774+ go as x = x : as
775+
773776checkExistence :: PandocMonad m => FilePath -> m FilePath
774777checkExistence fn = do
775778 exists <- fileExists fn
@@ -914,7 +917,7 @@ newtype FileTree = FileTree {unFileTree :: M.Map FilePath FileInfo}
914917
915918getFileInfo :: FilePath -> FileTree -> Maybe FileInfo
916919getFileInfo fp tree =
917− M.lookup (makeRelative "." fp) (unFileTree tree)
920+ M.lookup (makeCanonical fp) (unFileTree tree)
918921
919922-- | Add the specified file to the FileTree. If file
920923-- is a directory, add its contents recursively.
@@ -937,7 +940,7 @@ addToFileTree tree fp = do
937940-- | Insert an ersatz file into the 'FileTree'.
938941insertInFileTree :: FilePath -> FileInfo -> FileTree -> FileTree
939942insertInFileTree fp info (FileTree treemap) =
940− FileTree $ M.insert (makeRelative "." fp) info treemap
943+ FileTree $ M.insert (makeCanonical fp) info treemap
941944
942945newtype PandocPure a = PandocPure {
943946 unPandocPure :: ExceptT PandocError