From f5be8427d95217f4efd723575a79f8699b33d003 Mon Sep 17 00:00:00 2001 From: Mateusz Kowalczyk Date: Wed, 25 Jun 2014 15:17:20 +0200 Subject: Don't mangle append order for nested lists. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The benefit of this is that the ‘top-level’ element of such lists is properly wrapped in

tags so any CSS working with these will be applied properly. It also just makes more sense. Pointed out at jgm/pandoc#1346. --- haddock-library/src/Documentation/Haddock/Parser.hs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'haddock-library/src/Documentation/Haddock') diff --git a/haddock-library/src/Documentation/Haddock/Parser.hs b/haddock-library/src/Documentation/Haddock/Parser.hs index 1d98601a..805b33f8 100644 --- a/haddock-library/src/Documentation/Haddock/Parser.hs +++ b/haddock-library/src/Documentation/Haddock/Parser.hs @@ -265,7 +265,7 @@ innerList item = do (cs, items) <- more item let contents = docParagraph . parseString . dropNLs . unlines $ c : cs return $ case items of - Left p -> [contents `joinPara` p] + Left p -> [contents <> p] Right i -> contents : i -- | Parses definition lists. @@ -276,21 +276,9 @@ definitionList = do (cs, items) <- more definitionList let contents = parseString . dropNLs . unlines $ c : cs return $ case items of - Left p -> [(label, contents `joinPara` p)] + Left p -> [(label, contents <> p)] Right i -> (label, contents) : i --- | If possible, appends two 'Doc's under a 'DocParagraph' rather than --- outside of it. This allows to get structures like --- --- @DocParagraph (DocAppend … …)@ --- --- rather than --- --- @DocAppend (DocParagraph …) …@ -joinPara :: DocH mod id -> DocH mod id -> DocH mod id -joinPara (DocParagraph p) c = docParagraph $ p <> c -joinPara d p = d <> p - -- | Drops all trailing newlines. dropNLs :: String -> String dropNLs = reverse . dropWhile (== '\n') . reverse -- cgit v1.2.3