From 8b533f9c386029f1a95dd2ea887ec7bb151fe513 Mon Sep 17 00:00:00 2001 From: Jesse Rosenthal Date: Sat, 24 Mar 2018 16:07:14 -0400 Subject: Powerpoint writer: simplify code with `ParseXml` There were some artifact code blocks around from before `reference-doc` functionality was implemented. This led to ignoring the reference-doc in places. Though I fixed this, I kept the old hacked-up functions instead of replacing them with `parseXml` (imported from Writers.OOXML) which does this in a consistent manner. This commit corrects that oversight. --- src/Text/Pandoc/Writers/Powerpoint/Output.hs | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) (limited to 'src/Text/Pandoc/Writers') diff --git a/src/Text/Pandoc/Writers/Powerpoint/Output.hs b/src/Text/Pandoc/Writers/Powerpoint/Output.hs index a99069ea2..dc5f1c9a9 100644 --- a/src/Text/Pandoc/Writers/Powerpoint/Output.hs +++ b/src/Text/Pandoc/Writers/Powerpoint/Output.hs @@ -344,17 +344,7 @@ getLayout layout = do (TwoColumnSlide _ _ _) -> "ppt/slideLayouts/slideLayout4.xml" refArchive <- asks envRefArchive distArchive <- asks envDistArchive - root <- case findEntryByPath layoutpath refArchive `mplus` - findEntryByPath layoutpath distArchive of - Just e -> case parseXMLDoc $ UTF8.toStringLazy $ fromEntry e of - Just element -> return $ element - Nothing -> throwError $ - PandocSomeError $ - layoutpath ++ " corrupt in reference file" - Nothing -> throwError $ - PandocSomeError $ - layoutpath ++ " missing in reference file" - return root + parseXml refArchive distArchive layoutpath shapeHasId :: NameSpaces -> String -> Element -> Bool shapeHasId ns ident element @@ -1171,20 +1161,9 @@ slideToElement (Slide _ l@(MetadataSlide titleElems subtitleElems authorElems da getNotesMaster :: PandocMonad m => P m Element getNotesMaster = do - let notesMasterPath = "ppt/notesMasters/notesMaster1.xml" refArchive <- asks envRefArchive distArchive <- asks envDistArchive - root <- case findEntryByPath notesMasterPath refArchive `mplus` - findEntryByPath notesMasterPath distArchive of - Just e -> case parseXMLDoc $ UTF8.toStringLazy $ fromEntry e of - Just element -> return $ element - Nothing -> throwError $ - PandocSomeError $ - notesMasterPath ++ " corrupt in reference file" - Nothing -> throwError $ - PandocSomeError $ - notesMasterPath ++ " missing in reference file" - return root + parseXml refArchive distArchive "ppt/notesMasters/notesMaster1.xml" getSlideNumberFieldId :: PandocMonad m => Element -> P m String getSlideNumberFieldId notesMaster -- cgit v1.2.3