git.iko.soy/typeable/pandoc
on master help sign in
Fix function dropping subtrees tagged :noexport:
b3b00daAlbert Krewinkel
src/Text/Pandoc/Readers/Org.hs+4−2
@@ -87,8 +87,10 @@ parseOrg = do
87-- | Drop COMMENT headers and the document tree below those headers.
87-- | Drop COMMENT headers and the document tree below those headers.
88dropCommentTrees :: [Block] -> [Block]
88dropCommentTrees :: [Block] -> [Block]
89dropCommentTrees [] = []
89dropCommentTrees [] = []
90−dropCommentTrees blks@(b:bs) =
90+dropCommentTrees (b:bs) =
91+ maybe (b:dropCommentTrees bs)
91− maybe blks (flip dropUntilHeaderAboveLevel bs) $ commentHeaderLevel b
92+ (dropCommentTrees . flip dropUntilHeaderAboveLevel bs)
93+ (commentHeaderLevel b)
92
94
93-- | Return the level of a header starting a comment or :noexport: tree and
95-- | Return the level of a header starting a comment or :noexport: tree and
94-- Nothing otherwise.
96-- Nothing otherwise.
tests/Tests/Readers/Org.hs+10
@@ -569,6 +569,16 @@ tests =
569 ] =?>
569 ] =?>
570 (mempty::Blocks)
570 (mempty::Blocks)
571
571
572+ , "Subtree with :noexport:" =:
573+ unlines [ "* Exported"
574+ , "** This isn't exported :noexport:"
575+ , "*** This neither"
576+ , "** But this is"
577+ ] =?>
578+ mconcat [ headerWith ("exported", [], []) 1 "Exported"
579+ , headerWith ("but-this-is", [], []) 2 "But this is"
580+ ]
581+
572 , "Paragraph starting with an asterisk" =:
582 , "Paragraph starting with an asterisk" =:
573 "*five" =?>
583 "*five" =?>
574 para "*five"
584 para "*five"