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.
This commit is contained in:
Jesse Rosenthal 2018-03-24 16:07:14 -04:00
parent 6285c047c4
commit 8b533f9c38

View file

@ -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