From 64aee65f62c7184f31d6778d0d3d9b6dc96e4e91 Mon Sep 17 00:00:00 2001 From: Mateusz Kowalczyk Date: Wed, 25 Jun 2014 15:02:48 +0200 Subject: Drop DocParagraph from front of headers I can not remember why they were wrapped in paragraphs to begin with and it seems unnecessary now that I test it. Closes #307. --- haddock-library/src/Documentation/Haddock/Parser.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'haddock-library/src/Documentation/Haddock/Parser.hs') diff --git a/haddock-library/src/Documentation/Haddock/Parser.hs b/haddock-library/src/Documentation/Haddock/Parser.hs index f13cedc6..1d98601a 100644 --- a/haddock-library/src/Documentation/Haddock/Parser.hs +++ b/haddock-library/src/Documentation/Haddock/Parser.hs @@ -220,6 +220,11 @@ paragraph = examples <|> skipSpace *> (list <|> birdtracks <|> codeblock -- | Headers inside the comment denoted with @=@ signs, up to 6 levels -- deep. +-- +-- >>> parseOnly header "= Hello" +-- Right (DocHeader (Header {headerLevel = 1, headerTitle = DocString "Hello"})) +-- >>> parseOnly header "== World" +-- Right (DocHeader (Header {headerLevel = 2, headerTitle = DocString "World"})) header :: Parser (DocH mod Identifier) header = do let psers = map (string . encodeUtf8 . concat . flip replicate "=") [6, 5 .. 1] @@ -227,7 +232,7 @@ header = do delim <- decodeUtf8 <$> pser line <- skipHorizontalSpace *> nonEmptyLine >>= return . parseString rest <- paragraph <|> return mempty - return $ DocParagraph (DocHeader (Header (length delim) line)) <> rest + return $ DocHeader (Header (length delim) line) <> rest textParagraph :: Parser (DocH mod Identifier) textParagraph = docParagraph . parseString . intercalate "\n" <$> many1 nonEmptyLine -- cgit v1.2.3