aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/Shared.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc/Writers/Shared.hs')
-rw-r--r--src/Text/Pandoc/Writers/Shared.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/Shared.hs b/src/Text/Pandoc/Writers/Shared.hs
index c294eeebb..f7af26a99 100644
--- a/src/Text/Pandoc/Writers/Shared.hs
+++ b/src/Text/Pandoc/Writers/Shared.hs
@@ -40,7 +40,7 @@ where
import Prelude
import Safe (lastMay)
import qualified Data.ByteString.Lazy as BL
-import Data.Maybe (fromMaybe)
+import Data.Maybe (fromMaybe, isNothing)
import Control.Monad (zipWithM)
import Data.Aeson (ToJSON (..), encode)
import Data.Char (chr, ord, isSpace)
@@ -394,8 +394,9 @@ toTableOfContents opts bs =
-- | Converts an Element to a list item for a table of contents,
sectionToListItem :: WriterOptions -> Block -> [Block]
sectionToListItem opts (Div (ident,_,_)
- (Header lev (_,_,kvs) ils : subsecs)) =
- Plain headerLink : [BulletList listContents | not (null listContents)
+ (Header lev (_,classes,kvs) ils : subsecs))
+ | not (isNothing (lookup "number" kvs) && "unlisted" `elem` classes)
+ = Plain headerLink : [BulletList listContents | not (null listContents)
, lev < writerTOCDepth opts]
where
num = fromMaybe "" $ lookup "number" kvs