From d5770b74969ac60836e40ca6a95a38ac0bf3c3bf Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 28 Dec 2017 11:03:34 -0800 Subject: [PATCH] Moved makeCanoncial definition out of ifdef! Also added slide2 to the default pptx, and reordered the data files in pandoc.cabal. --- pandoc.cabal | 28 ++++++++++++++-------------- src/Text/Pandoc/Class.hs | 20 +++++++++++--------- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/pandoc.cabal b/pandoc.cabal index c3c369edd..6f2dec4bc 100644 --- a/pandoc.cabal +++ b/pandoc.cabal @@ -105,28 +105,28 @@ data-files: data/pptx/docProps/thumbnail.jpeg data/pptx/docProps/app.xml data/pptx/docProps/core.xml - data/pptx/ppt/slideLayouts/slideLayout4.xml - data/pptx/ppt/slideLayouts/_rels/slideLayout9.xml.rels - data/pptx/ppt/slideLayouts/_rels/slideLayout2.xml.rels - data/pptx/ppt/slideLayouts/_rels/slideLayout10.xml.rels data/pptx/ppt/slideLayouts/_rels/slideLayout1.xml.rels + data/pptx/ppt/slideLayouts/_rels/slideLayout2.xml.rels data/pptx/ppt/slideLayouts/_rels/slideLayout3.xml.rels + data/pptx/ppt/slideLayouts/_rels/slideLayout4.xml.rels data/pptx/ppt/slideLayouts/_rels/slideLayout5.xml.rels + data/pptx/ppt/slideLayouts/_rels/slideLayout6.xml.rels data/pptx/ppt/slideLayouts/_rels/slideLayout7.xml.rels data/pptx/ppt/slideLayouts/_rels/slideLayout8.xml.rels + data/pptx/ppt/slideLayouts/_rels/slideLayout9.xml.rels + data/pptx/ppt/slideLayouts/_rels/slideLayout10.xml.rels data/pptx/ppt/slideLayouts/_rels/slideLayout11.xml.rels - data/pptx/ppt/slideLayouts/_rels/slideLayout4.xml.rels - data/pptx/ppt/slideLayouts/_rels/slideLayout6.xml.rels - data/pptx/ppt/slideLayouts/slideLayout2.xml - data/pptx/ppt/slideLayouts/slideLayout8.xml - data/pptx/ppt/slideLayouts/slideLayout11.xml - data/pptx/ppt/slideLayouts/slideLayout3.xml - data/pptx/ppt/slideLayouts/slideLayout6.xml - data/pptx/ppt/slideLayouts/slideLayout9.xml - data/pptx/ppt/slideLayouts/slideLayout5.xml - data/pptx/ppt/slideLayouts/slideLayout7.xml data/pptx/ppt/slideLayouts/slideLayout1.xml + data/pptx/ppt/slideLayouts/slideLayout2.xml + data/pptx/ppt/slideLayouts/slideLayout3.xml + data/pptx/ppt/slideLayouts/slideLayout4.xml + data/pptx/ppt/slideLayouts/slideLayout5.xml + data/pptx/ppt/slideLayouts/slideLayout6.xml + data/pptx/ppt/slideLayouts/slideLayout7.xml + data/pptx/ppt/slideLayouts/slideLayout8.xml + data/pptx/ppt/slideLayouts/slideLayout9.xml data/pptx/ppt/slideLayouts/slideLayout10.xml + data/pptx/ppt/slideLayouts/slideLayout11.xml data/pptx/ppt/_rels/presentation.xml.rels data/pptx/ppt/theme/theme1.xml data/pptx/ppt/presProps.xml diff --git a/src/Text/Pandoc/Class.hs b/src/Text/Pandoc/Class.hs index 5ea736539..d0e33268f 100644 --- a/src/Text/Pandoc/Class.hs +++ b/src/Text/Pandoc/Class.hs @@ -688,8 +688,6 @@ getDefaultReferencePptx = do , "ppt/presProps.xml" , "ppt/presentation.xml" , "ppt/slideLayouts/_rels/slideLayout1.xml.rels" - , "ppt/slideLayouts/_rels/slideLayout10.xml.rels" - , "ppt/slideLayouts/_rels/slideLayout11.xml.rels" , "ppt/slideLayouts/_rels/slideLayout2.xml.rels" , "ppt/slideLayouts/_rels/slideLayout3.xml.rels" , "ppt/slideLayouts/_rels/slideLayout4.xml.rels" @@ -698,6 +696,8 @@ getDefaultReferencePptx = do , "ppt/slideLayouts/_rels/slideLayout7.xml.rels" , "ppt/slideLayouts/_rels/slideLayout8.xml.rels" , "ppt/slideLayouts/_rels/slideLayout9.xml.rels" + , "ppt/slideLayouts/_rels/slideLayout10.xml.rels" + , "ppt/slideLayouts/_rels/slideLayout11.xml.rels" , "ppt/slideLayouts/slideLayout1.xml" , "ppt/slideLayouts/slideLayout10.xml" , "ppt/slideLayouts/slideLayout11.xml" @@ -713,6 +713,8 @@ getDefaultReferencePptx = do , "ppt/slideMasters/slideMaster1.xml" , "ppt/slides/_rels/slide1.xml.rels" , "ppt/slides/slide1.xml" + , "ppt/slides/_rels/slide2.xml.rels" + , "ppt/slides/slide2.xml" , "ppt/tableStyles.xml" , "ppt/theme/theme1.xml" , "ppt/viewProps.xml" @@ -766,13 +768,6 @@ readDefaultDataFile fname = getDataFileName fname' >>= checkExistence >>= readFileStrict where fname' = if fname == "MANUAL.txt" then fname else "data" fname -makeCanonical :: FilePath -> FilePath -makeCanonical = Posix.joinPath . transformPathParts . splitDirectories - where transformPathParts = reverse . foldl go [] - go as "." = as - go (_:as) ".." = as - go as x = x : as - checkExistence :: PandocMonad m => FilePath -> m FilePath checkExistence fn = do exists <- fileExists fn @@ -781,6 +776,13 @@ checkExistence fn = do else throwError $ PandocCouldNotFindDataFileError fn #endif +makeCanonical :: FilePath -> FilePath +makeCanonical = Posix.joinPath . transformPathParts . splitDirectories + where transformPathParts = reverse . foldl go [] + go as "." = as + go (_:as) ".." = as + go as x = x : as + withPaths :: PandocMonad m => [FilePath] -> (FilePath -> m a) -> FilePath -> m a withPaths [] _ fp = throwError $ PandocResourceNotFound fp withPaths (p:ps) action fp =