From 21ee2d80c25d6e7fe3be00b58de553b638c90abb Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 3 Jan 2021 11:27:01 -0800 Subject: EPUB writer: adjust internal links to images, links, and tables... after splitting into chapters. Previously we only did this for Div and Span and Header elements. See #7000. --- src/Text/Pandoc/Writers/EPUB.hs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs index 5867b7c80..a24a872ef 100644 --- a/src/Text/Pandoc/Writers/EPUB.hs +++ b/src/Text/Pandoc/Writers/EPUB.hs @@ -557,6 +557,10 @@ pandocToEPUB version opts doc = do let extractLinkURL' :: Int -> Inline -> [(TS.Text, TS.Text)] extractLinkURL' num (Span (ident, _, _) _) | not (TS.null ident) = [(ident, TS.pack (showChapter num) <> "#" <> ident)] + extractLinkURL' num (Link (ident, _, _) _ _) + | not (TS.null ident) = [(ident, TS.pack (showChapter num) <> "#" <> ident)] + extractLinkURL' num (Image (ident, _, _) _ _) + | not (TS.null ident) = [(ident, TS.pack (showChapter num) <> "#" <> ident)] extractLinkURL' _ _ = [] let extractLinkURL :: Int -> Block -> [(TS.Text, TS.Text)] @@ -564,6 +568,8 @@ pandocToEPUB version opts doc = do | not (TS.null ident) = [(ident, TS.pack (showChapter num) <> "#" <> ident)] extractLinkURL num (Header _ (ident, _, _) _) | not (TS.null ident) = [(ident, TS.pack (showChapter num) <> "#" <> ident)] + extractLinkURL num (Table (ident,_,_) _ _ _ _ _) + | not (TS.null ident) = [(ident, TS.pack (showChapter num) <> "#" <> ident)] extractLinkURL num b = query (extractLinkURL' num) b let reftable = concat $ zipWith (\(Chapter bs) num -> -- cgit v1.2.3