From 2df3dfe88391f9e5a0ec4e10aff0abbf0c88bb0a Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 12 Jul 2015 13:57:14 -0700 Subject: Changed hierarchicalize so it treats references div as top-level header. Fixes a bug with `--section-divs`, where the final references section added by pandoc-citeproc, enclosed in its own div, got put in the div for the section previous to it. This fixes #2294. Longer term, we might think about how hierarchicalize should interact with Div elements. --- src/Text/Pandoc/Shared.hs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index 52e53e394..ef9f66aa7 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -662,12 +662,17 @@ hierarchicalizeWithIds ((Header level attr@(_,classes,_) title'):xs) = do sectionContents' <- hierarchicalizeWithIds sectionContents rest' <- hierarchicalizeWithIds rest return $ Sec level newnum attr title' sectionContents' : rest' +hierarchicalizeWithIds ((Div ("",["references"],[]) + (Header level (ident,classes,kvs) title' : xs)):ys) = + hierarchicalizeWithIds ((Header level (ident,("references":classes),kvs) + title') : (xs ++ ys)) hierarchicalizeWithIds (x:rest) = do rest' <- hierarchicalizeWithIds rest return $ (Blk x) : rest' headerLtEq :: Int -> Block -> Bool headerLtEq level (Header l _ _) = l <= level +headerLtEq level (Div ("",["references"],[]) (Header l _ _ : _)) = l <= level headerLtEq _ _ = False -- | Generate a unique identifier from a list of inlines. -- cgit v1.2.3