[commit: haddock] 2.15, 2.15.0.1, 2.15.0.2, T6018-injective-type-families, adamse-D1033, clean, fix-travis, ghc-head, master, metainfo, v2.15, wip/10268, wip/10313, wip/D538, wip/D538-1, wip/D538-2, wip/D538-3, wip/D538-4, wip/D538-5, wip/D538-6, wip/D548-master, wip/D548-master-2, wip/T10483, wip/T8584, wip/T9840, wip/api-ann-hstylit, wip/api-ann-hstylit-1, wip/api-ann-hstylit-2, wip/api-ann-hstylit-3, wip/api-ann-hstylit-4, wip/api-ann-hstylit-5, wip/api-annot-tweaks-7.10, wip/api-annots-ghc-7.10-3, wip/ast-annotations-separate, wip/ast-prepare-annotations, wip/ast-prepare-annotations-final, wip/ast-prepare-annotations-final2, wip/ast-prepare-annotations-final3, wip/ast-prepare-annotations-final4, wip/ast-prepare-annotations-final5, wip/ast-prepare-annotations-final6, wip/attoparsec-update, wip/landmine-param-family, wip/orf-new, wip/orf-reboot, wip/pattern-synonyms, wip/rae, wip/remove-cabal-dep, wip/trac-9744: Catch mid-line URLs. Fixes #314. (d6aec63)

git at git.haskell.org git at git.haskell.org
Wed Jul 8 08:29:26 UTC 2015


Repository : ssh://git@git.haskell.org/haddock

On branches: 2.15,2.15.0.1,2.15.0.2,T6018-injective-type-families,adamse-D1033,clean,fix-travis,ghc-head,master,metainfo,v2.15,wip/10268,wip/10313,wip/D538,wip/D538-1,wip/D538-2,wip/D538-3,wip/D538-4,wip/D538-5,wip/D538-6,wip/D548-master,wip/D548-master-2,wip/T10483,wip/T8584,wip/T9840,wip/api-ann-hstylit,wip/api-ann-hstylit-1,wip/api-ann-hstylit-2,wip/api-ann-hstylit-3,wip/api-ann-hstylit-4,wip/api-ann-hstylit-5,wip/api-annot-tweaks-7.10,wip/api-annots-ghc-7.10-3,wip/ast-annotations-separate,wip/ast-prepare-annotations,wip/ast-prepare-annotations-final,wip/ast-prepare-annotations-final2,wip/ast-prepare-annotations-final3,wip/ast-prepare-annotations-final4,wip/ast-prepare-annotations-final5,wip/ast-prepare-annotations-final6,wip/attoparsec-update,wip/landmine-param-family,wip/orf-new,wip/orf-reboot,wip/pattern-synonyms,wip/rae,wip/remove-cabal-dep,wip/trac-9744
Link       : http://git.haskell.org/haddock.git/commitdiff/d6aec63c009c4e57181900eb03847d7dc0fc3c7c

>---------------------------------------------------------------

commit d6aec63c009c4e57181900eb03847d7dc0fc3c7c
Author: Mateusz Kowalczyk <fuuzetsu at fuuzetsu.co.uk>
Date:   Mon Jul 28 13:25:43 2014 +0200

    Catch mid-line URLs. Fixes #314.


>---------------------------------------------------------------

d6aec63c009c4e57181900eb03847d7dc0fc3c7c
 haddock-library/src/Documentation/Haddock/Parser.hs      | 4 ++--
 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 805b33f..68d9ece 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 a8c2199..5181a3f 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



More information about the ghc-commits mailing list