diff options
Diffstat (limited to 'haddock-library')
| -rw-r--r-- | haddock-library/src/Documentation/Haddock/Parser.hs | 4 | ||||
| -rw-r--r-- | haddock-library/test/Documentation/Haddock/ParserSpec.hs | 4 | 
2 files changed, 6 insertions, 2 deletions
diff --git a/haddock-library/src/Documentation/Haddock/Parser.hs b/haddock-library/src/Documentation/Haddock/Parser.hs index 805b33f8..68d9ecec 100644 --- a/haddock-library/src/Documentation/Haddock/Parser.hs +++ b/haddock-library/src/Documentation/Haddock/Parser.hs @@ -105,7 +105,7 @@ parseStringBS = parse p    where      p :: Parser (DocH mod Identifier)      p = mconcat <$> many (monospace <|> anchor <|> identifier <|> moduleName -                          <|> picture <|> hyperlink <|> autoUrl <|> bold +                          <|> picture <|> hyperlink <|> bold                            <|> emphasis <|> encodedChar <|> string'                            <|> skipSpecialChar) @@ -125,7 +125,7 @@ encodedChar = "&#" *> c <* ";"  -- Once we have checked for any of these and tried to parse the  -- relevant markup, we can assume they are used as regular text.  specialChar :: [Char] -specialChar = "_/<@\"&'`#" +specialChar = "_/<@\"&'`# "  -- | Plain, regular parser for text. Called as one of the last parsers  -- to ensure that we have already given a chance to more meaningful parsers diff --git a/haddock-library/test/Documentation/Haddock/ParserSpec.hs b/haddock-library/test/Documentation/Haddock/ParserSpec.hs index a8c2199a..5181a3f3 100644 --- a/haddock-library/test/Documentation/Haddock/ParserSpec.hs +++ b/haddock-library/test/Documentation/Haddock/ParserSpec.hs @@ -137,6 +137,10 @@ spec = do            "http://example.com/? Some other sentence." `shouldParseTo`              hyperlink "http://example.com/" Nothing <> "? Some other sentence." +        it "autolinks URLs occuring mid-sentence with multiple ‘/’s" $ do +          "foo https://example.com/example bar" `shouldParseTo` +            "foo " <> hyperlink "https://example.com/example" Nothing <> " bar" +      context "when parsing pictures" $ do        let picture :: String -> Maybe String -> Doc String            picture uri = DocPic . Picture uri  | 
