summaryrefslogtreecommitdiff
path: root/MakeManPage.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2011-01-28 20:01:47 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2011-01-28 20:01:47 -0800
commite2a5038be681f8610b3cc3621cbf66647de14322 (patch)
treea37e6b742fcb33fae37ca3b6a787102d61ed9562 /MakeManPage.hs
parentd4137e10211ca6ddd9099e8fdd5aaf933fe2cade (diff)
Fixed extractSection in MakeManPage.
Diffstat (limited to 'MakeManPage.hs')
-rw-r--r--MakeManPage.hs12
1 files changed, 7 insertions, 5 deletions
diff --git a/MakeManPage.hs b/MakeManPage.hs
index 117c1e9f1..47b284380 100644
--- a/MakeManPage.hs
+++ b/MakeManPage.hs
@@ -79,17 +79,19 @@ capitalize x = x
removeSect :: [Inline] -> [Block] -> [Block]
removeSect ils (Header 1 x:xs) | normalize x == normalize ils =
- dropWhile notLevelOneHeader xs
- where notLevelOneHeader (Header 1 _) = False
- notLevelOneHeader _ = True
+ dropWhile (not . isHeader1) xs
removeSect ils (x:xs) = x : removeSect ils xs
removeSect _ [] = []
extractSect :: [Inline] -> [Block] -> [Block]
-extractSect ils (Header 1 x:xs) | normalize x == normalize ils =
- bottomUp promoteHeader xs
+extractSect ils (Header 1 z:xs) | normalize z == normalize ils =
+ bottomUp promoteHeader $ takeWhile (not . isHeader1) xs
where promoteHeader (Header n x) = Header (n-1) x
promoteHeader x = x
extractSect ils (x:xs) = extractSect ils xs
extractSect _ [] = []
+isHeader1 :: Block -> Bool
+isHeader1 (Header 1 _) = True
+isHeader1 _ = False
+