diff options
author | John MacFarlane <jgm@berkeley.edu> | 2013-01-16 12:16:49 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2013-01-16 12:16:49 -0800 |
commit | 31fa80fdcb8b88e76d0384bcc0eec3d11ea0d55b (patch) | |
tree | d263b723ef6c80766e5673267a46de144385480b /src/Text/Pandoc/Writers | |
parent | 49820d5b51cb1072d311814b999627c8fec9aa43 (diff) | |
download | pandoc-31fa80fdcb8b88e76d0384bcc0eec3d11ea0d55b.tar.gz |
Fixed problem with duplicate ids in epub.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r-- | src/Text/Pandoc/Writers/EPUB.hs | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs index 389589e9a..4155cca05 100644 --- a/src/Text/Pandoc/Writers/EPUB.hs +++ b/src/Text/Pandoc/Writers/EPUB.hs @@ -423,8 +423,6 @@ imageTypeOf x = case drop 1 (map toLower (takeExtension x)) of data IdentState = IdentState{ chapterNumber :: Int, - runningIdents :: [String], - chapterIdents :: [String], identTable :: [(String,String)] } deriving (Read, Show) @@ -453,23 +451,17 @@ correlateRefs :: Int -> [Block] -> [(String,String)] correlateRefs chapterHeaderLevel bs = identTable $ execState (mapM_ go bs) IdentState{ chapterNumber = 0 - , runningIdents = [] - , chapterIdents = [] , identTable = [] } where go :: Block -> State IdentState () - go (Header n (ident,_,_) ils) = do + go (Header n (ident,_,_) _) = do when (n <= chapterHeaderLevel) $ - modify $ \s -> s{ chapterNumber = chapterNumber s + 1 - , chapterIdents = [] } + modify $ \s -> s{ chapterNumber = chapterNumber s + 1 } st <- get let chapterid = showChapter (chapterNumber st) ++ if n <= chapterHeaderLevel then "" - else '#' : uniqueIdent ils (chapterIdents st) - modify $ \s -> s{ runningIdents = ident : runningIdents st - , chapterIdents = chapterid : chapterIdents st - , identTable = (ident, chapterid) : identTable st - } + else '#' : ident + modify $ \s -> s{ identTable = (ident, chapterid) : identTable st } go _ = return () -- Replace internal link references using the table produced |