aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-12-07 14:20:41 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2019-12-07 14:20:41 -0800
commit0b54d6282bb89a71433043857f4983668f9a4beb (patch)
tree7088fcba2e14b6afdd5a1451b0a2108f9fa1ee41 /src/Text/Pandoc
parent5295607de712fd5247e3e8ade21930c0a22c21dc (diff)
downloadpandoc-0b54d6282bb89a71433043857f4983668f9a4beb.tar.gz
Fix --toc-depth regression in 2.8.
Closes #5967.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Writers/Shared.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/Shared.hs b/src/Text/Pandoc/Writers/Shared.hs
index 0161db506..6018b4294 100644
--- a/src/Text/Pandoc/Writers/Shared.hs
+++ b/src/Text/Pandoc/Writers/Shared.hs
@@ -407,9 +407,9 @@ toTableOfContents opts bs =
sectionToListItem :: WriterOptions -> Block -> [Block]
sectionToListItem opts (Div (ident,_,_)
(Header lev (_,classes,kvs) ils : subsecs))
- | not (isNothing (lookup "number" kvs) && "unlisted" `elem` classes)
- = Plain headerLink : [BulletList listContents | not (null listContents)
- , lev < writerTOCDepth opts]
+ | lev <= writerTOCDepth opts
+ , not (isNothing (lookup "number" kvs) && "unlisted" `elem` classes)
+ = Plain headerLink : [BulletList listContents | not (null listContents)]
where
num = fromMaybe "" $ lookup "number" kvs
addNumber = if T.null num