From 3fbbafd391334429df49255160ace17245409e41 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 29 Jun 2014 23:03:12 -0700 Subject: Rewrote normalize for efficiency. (Closes #1385.) * Added normalizeInlines, normalizeBlocks. * Type signature is now more narrow, `Pandoc -> Pandoc` instead of `Data a :: a -> a`. Some users may need to change their uses of `normalize` to the newly exported `normalizeInlines` or `normalizeBlocks`. --- man/make-pandoc-man-pages.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'man') diff --git a/man/make-pandoc-man-pages.hs b/man/make-pandoc-man-pages.hs index 008294433..afba9135a 100644 --- a/man/make-pandoc-man-pages.hs +++ b/man/make-pandoc-man-pages.hs @@ -27,7 +27,7 @@ main = do unless (null ds1 && null ds2) $ do rmContents <- UTF8.readFile "README" - let (Pandoc meta blocks) = readMarkdown def rmContents + let (Pandoc meta blocks) = normalize $ readMarkdown def rmContents let manBlocks = removeSect [Str "Wrappers"] $ removeSect [Str "Pandoc's",Space,Str "markdown"] blocks let syntaxBlocks = extractSect [Str "Pandoc's",Space,Str "markdown"] blocks @@ -67,13 +67,13 @@ capitalize (Str xs) = Str $ map toUpper xs capitalize x = x removeSect :: [Inline] -> [Block] -> [Block] -removeSect ils (Header 1 _ x:xs) | normalize x == normalize ils = +removeSect ils (Header 1 _ x:xs) | x == ils = dropWhile (not . isHeader1) xs removeSect ils (x:xs) = x : removeSect ils xs removeSect _ [] = [] extractSect :: [Inline] -> [Block] -> [Block] -extractSect ils (Header 1 _ z:xs) | normalize z == normalize ils = +extractSect ils (Header 1 _ z:xs) | z == ils = bottomUp promoteHeader $ takeWhile (not . isHeader1) xs where promoteHeader (Header n attr x) = Header (n-1) attr x promoteHeader x = x -- cgit v1.2.3