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.
This commit is contained in:
parent
0e16155aaf
commit
a7d131cf44
1 changed files with 6 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue