git.iko.soy/typeable/pandoc
on master help sign in
Fixed extractSection in MakeManPage.
commite2a5038be681f8610b3cc3621cbf66647de14322 authorJohn MacFarlane <jgm@berkeley.edu> dateFri 28 Jan 2011, 20:01 (16 years ago) parentd4137e1
1 file changed+7−5
MakeManPage.hs+7−5
MakeManPage.hs+7−5
@@ -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+