diff options
author | Jesse Rosenthal <jrosenthal@jhu.edu> | 2018-01-15 08:54:42 -0500 |
---|---|---|
committer | Jesse Rosenthal <jrosenthal@jhu.edu> | 2018-01-15 08:56:20 -0500 |
commit | a7d131cf442f6d93f1e3183d26b855ca5f7112af (patch) | |
tree | e5c8c499eab674a7dc9e87b97d469837f112d739 | |
parent | 0e16155aaf9d6df2c5dde07db5e385781280f8bd (diff) | |
download | pandoc-a7d131cf442f6d93f1e3183d26b855ca5f7112af.tar.gz |
Powerpoint writer: Ignore anchor links to nowehere.
We don't convert a '#target' ExternalTarget to an InternalTarget if
`target` is not in the AnchorMap. We just remove the link. This
prevents broken links in the Powerpoint output.
-rw-r--r-- | src/Text/Pandoc/Writers/Powerpoint/Presentation.hs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs b/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs index e68f5eb57..5ced4e8a8 100644 --- a/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs +++ b/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs @@ -680,9 +680,12 @@ replaceAnchor :: PandocMonad m => ParaElem -> Pres m ParaElem replaceAnchor (Run rProps s) | Just (ExternalTarget ('#':anchor, _)) <- rLink rProps = do anchorMap <- gets stAnchorMap - return $ case M.lookup anchor anchorMap of - Just n -> Run (rProps{rLink = Just $ InternalTarget n}) s - Nothing -> Run rProps s + -- If the anchor is not in the anchormap, we just remove the + -- link. + let rProps' = case M.lookup anchor anchorMap of + Just n -> rProps{rLink = Just $ InternalTarget n} + Nothing -> rProps{rLink = Nothing} + return $ Run rProps' s replaceAnchor pe = return pe blocksToPresentation :: PandocMonad m => [Block] -> Pres m Presentation |