diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-09-07 08:45:10 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-09-08 21:56:42 -0700 |
commit | 1ccff3339d036db046f37c596bb4ffb6cffbf803 (patch) | |
tree | 72ec0bb64e828a43675477db1270e424e0e055d2 /src/Text/Pandoc | |
parent | 95a19fcff001b19d5da92e8e4332141a93ea0d48 (diff) | |
download | pandoc-1ccff3339d036db046f37c596bb4ffb6cffbf803.tar.gz |
Revert changes to hierarchicalizeWithIds.
Revert "hierarchicalize: ensure that sections get ids..."
This reverts commit 212406a61d027d85712705e626954e0486a2bc34.
Revert "Improve detection of headings in Divs by hierarchicalize."
This reverts commit 6e2cfd6c97b1b8657f1f3e2b66090a2c3ba8d887.
Revert "Shared.hierarchicalize: improve handling of div and section structure."
This reverts commit 345b33762eb4cc6d57d74c76c4757a6166ee5c13.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Shared.hs | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index a5acc6c15..7c3546f44 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -523,33 +523,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 (dident,dclasses,dkvs) - (Header level (hident,hclasses,hkvs) title' : xs):ys) - | not ("columns" `elem` dclasses) - , not ("column" `elem` dclasses) = do - lastnum <- S.get - let lastnum' = take level lastnum - let newnum = case length lastnum' of - x | "unnumbered" `elem` hclasses -> [] - | x >= level -> init lastnum' ++ [last lastnum' + 1] - | otherwise -> lastnum ++ - replicate (level - length lastnum - 1) 0 ++ [1] - unless (null newnum) $ S.put newnum - let attr = (hident, dclasses ++ hclasses, dkvs ++ hkvs) - sectionContents' <- hierarchicalizeWithIds $ - if null dident -- ensure we don't lose an id - then xs - else [Div (dident,[],[]) xs] - rest' <- hierarchicalizeWithIds ys - return $ Sec level newnum attr title' sectionContents' : rest' +hierarchicalizeWithIds (Div ("refs",classes',kvs') + (Header level (ident,classes,kvs) title' : xs):ys) = + hierarchicalizeWithIds (Header level (ident,"references":classes,kvs) + title' : Div ("refs",classes',kvs') 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 ("",classes,[]) (Header l _ _ : _)) = - l <= level && "column" `notElem` classes && "columns" `notElem` classes +headerLtEq level (Div ("",["references"],[]) (Header l _ _ : _)) = l <= level headerLtEq _ _ = False -- | Generate a unique identifier from a list of inlines. |