diff options
-rw-r--r-- | src/Text/Pandoc/Readers/Org/Blocks.hs | 4 | ||||
-rw-r--r-- | test/Tests/Readers/Org/Directive.hs | 7 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/Org/Blocks.hs b/src/Text/Pandoc/Readers/Org/Blocks.hs index 1c52c3477..d3702687c 100644 --- a/src/Text/Pandoc/Readers/Org/Blocks.hs +++ b/src/Text/Pandoc/Readers/Org/Blocks.hs @@ -547,9 +547,7 @@ include = try $ do shiftHeader :: Int -> Block -> Block shiftHeader shift blk = - if shift <= 0 - then blk - else case blk of + case blk of (Header lvl attr content) -> Header (lvl - shift) attr content _ -> blk diff --git a/test/Tests/Readers/Org/Directive.hs b/test/Tests/Readers/Org/Directive.hs index 87abb714d..bf4c2800d 100644 --- a/test/Tests/Readers/Org/Directive.hs +++ b/test/Tests/Readers/Org/Directive.hs @@ -192,10 +192,15 @@ tests = headerWith ("level3", [], []) 3 "Level3") , testWithFiles [("./level3.org", "*** Level3\n\n")] - "Minlevel shifts level" + "Minlevel shifts level leftward" (T.unlines [ "#+include: \"level3.org\" :minlevel 1" ] =?> headerWith ("level3", [], []) 1 "Level3") + , testWithFiles [("./level1.org", "* Level1\n\n")] + "Minlevel shifts level rightward" + (T.unlines [ "#+include: \"level1.org\" :minlevel 3" ] =?> + headerWith ("level1", [], []) 3 "Level1") + , testWithFiles [("./src.hs", "putStrLn outString\n")] "Include file as source code snippet" (T.unlines [ "#+include: \"src.hs\" src haskell" ] =?> |