@@ -79,17 +79,19 @@ capitalize x = x
7979
8080removeSect :: [Inline] -> [Block] -> [Block]
8181removeSect ils (Header 1 x:xs) | normalize x == normalize ils =
82− dropWhile notLevelOneHeader xs
83− where notLevelOneHeader (Header 1 _) = False
84− notLevelOneHeader _ = True
82+ dropWhile (not . isHeader1) xs
8583removeSect ils (x:xs) = x : removeSect ils xs
8684removeSect _ [] = []
8785
8886extractSect :: [Inline] -> [Block] -> [Block]
89−extractSect ils (Header 1 x:xs) | normalize x == normalize ils =
90− bottomUp promoteHeader xs
87+extractSect ils (Header 1 z:xs) | normalize z == normalize ils =
88+ bottomUp promoteHeader $ takeWhile (not . isHeader1) xs
9189 where promoteHeader (Header n x) = Header (n-1) x
9290 promoteHeader x = x
9391extractSect ils (x:xs) = extractSect ils xs
9492extractSect _ [] = []
9593
94+isHeader1 :: Block -> Bool
95+isHeader1 (Header 1 _) = True
96+isHeader1 _ = False
97+