diff options
author | John MacFarlane <jgm@berkeley.edu> | 2021-01-03 11:27:01 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-01-03 11:27:01 -0800 |
commit | 21ee2d80c25d6e7fe3be00b58de553b638c90abb (patch) | |
tree | aa0c500e5accf7d8507389f08a76f29e1605eef6 /src/Text/Pandoc | |
parent | 57b10941521d9db808e3892ea9893878065b7c50 (diff) | |
download | pandoc-21ee2d80c25d6e7fe3be00b58de553b638c90abb.tar.gz |
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.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Writers/EPUB.hs | 6 |
1 files changed, 6 insertions, 0 deletions
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 -> |