@@ -84,13 +84,21 @@ dropCommentTrees [] = []
84dropCommentTrees blks@(b:bs) =
84dropCommentTrees blks@(b:bs) =
85 maybe blks (flip dropUntilHeaderAboveLevel bs) $ commentHeaderLevel b
85 maybe blks (flip dropUntilHeaderAboveLevel bs) $ commentHeaderLevel b
87−-- | Return the level of a header starting a comment tree and Nothing
87+-- | Return the level of a header starting a comment or :noexport: tree and
88−-- otherwise.
88+-- Nothing otherwise.
89commentHeaderLevel :: Block -> Maybe Int
89commentHeaderLevel :: Block -> Maybe Int
90commentHeaderLevel blk =
90commentHeaderLevel blk =
91 case blk of
91 case blk of
92− (Header level _ ((Str "COMMENT"):_)) -> Just level
92+ (Header level _ ((Str "COMMENT"):_)) -> Just level
93+ (Header level _ title) | hasNoExportTag title -> Just level
93− _ -> Nothing
94+ _ -> Nothing
96+ hasNoExportTag :: [Inline] -> Bool
97+ hasNoExportTag = any isNoExportTag
99+ isNoExportTag :: Inline -> Bool
100+ isNoExportTag (Span ("", ["tag"], [("data-tag-name", "noexport")]) []) = True
101+ isNoExportTag _ = False
95-- | Drop blocks until a header on or above the given level is seen
103-- | Drop blocks until a header on or above the given level is seen
96dropUntilHeaderAboveLevel :: Int -> [Block] -> [Block]
104dropUntilHeaderAboveLevel :: Int -> [Block] -> [Block]