summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-07-12 13:57:14 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2015-07-12 13:58:28 -0700
commit2df3dfe88391f9e5a0ec4e10aff0abbf0c88bb0a (patch)
tree7b9b78c992281b1110ad06099a1d06aeaf98f1e5 /src/Text/Pandoc
parent0bd5873977e8cb3afaf84e0d3d5192f140ea72e5 (diff)
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.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Shared.hs5
1 files changed, 5 insertions, 0 deletions
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.