haddock 2.14.2 → 2.14.3
raw patch · 18 files changed
+473/−27 lines, 18 filesdep ~ghcsetup-changed
Dependency ranges changed: ghc
Files
- CHANGES +6/−0
- Setup.hs +2/−0
- Setup.lhs +0/−3
- doc/haddock.xml +7/−3
- haddock.cabal +4/−4
- html-test/ref/Bug298.html +133/−0
- html-test/ref/Bug308.html +111/−0
- html-test/ref/Bug308CrossModule.html +91/−0
- html-test/run.lhs +13/−1
- html-test/src/Bug298.hs +22/−0
- html-test/src/Bug308.hs +21/−0
- html-test/src/Bug308CrossModule.hs +17/−0
- html-test/src/Bug85.hs +0/−1
- src/Haddock/Backends/Xhtml/DocMarkup.hs +6/−1
- src/Haddock/Convert.hs +2/−2
- src/Haddock/Interface/Create.hs +8/−8
- src/Haddock/Parser.hs +17/−4
- test/Haddock/ParserSpec.hs +13/−0
CHANGES view
@@ -1,3 +1,9 @@+Changes in version 2.14.3++ * Fix parsing of identifiers with ^ or ⋆ in them (#298)++ * Fix anchors (#308)+ Changes in version 2.14.2 * Always drop --split-objs GHC flag for performance reasons (#292)
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
− Setup.lhs
@@ -1,3 +0,0 @@-#!/usr/bin/env runhaskell-> import Distribution.Simple-> main = defaultMain
doc/haddock.xml view
@@ -21,7 +21,7 @@ <holder>Simon Marlow, David Waern</holder> </copyright> <abstract>- <para>This document describes Haddock version 2.14.1, a Haskell+ <para>This document describes Haddock version 2.14.3, a Haskell documentation tool.</para> </abstract> </bookinfo>@@ -2101,8 +2101,12 @@ <literal>"<replaceable>module</replaceable>#<replaceable>label</replaceable>"</literal> where <replaceable>module</replaceable> is the module name containing the anchor, and <replaceable>label</replaceable> is- the anchor label. The module does not have to be local, it- can be imported via an interface.</para>+ the anchor label. The module does not have to be local, it can+ be imported via an interface. Please note that in Haddock+ versions 2.13.x and earlier, the syntax was+ <literal>"<replaceable>module</replaceable>\#<replaceable>label</replaceable>"</literal>.+ This is deprecated as of version 2.14.3 and will be removed in+ future versions.</para> </section> <section>
haddock.cabal view
@@ -1,5 +1,5 @@ name: haddock-version: 2.14.2+version: 2.14.3 synopsis: A documentation-generation tool for Haskell libraries description: Haddock is a documentation-generation tool for Haskell libraries@@ -8,7 +8,7 @@ author: Simon Marlow, David Waern maintainer: Simon Hengel <sol@typeful.net>, Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> homepage: http://www.haskell.org/haddock/-bug-reports: http://trac.haskell.org/haddock+bug-reports: https://github.com/haskell/haddock/issues copyright: (c) Simon Marlow, David Waern category: Documentation build-type: Simple@@ -83,7 +83,7 @@ array, xhtml >= 3000.2 && < 3000.3, Cabal >= 1.10,- ghc >= 7.7 && < 7.10,+ ghc == 7.8.*, bytestring other-modules:@@ -143,7 +143,7 @@ array, xhtml >= 3000.2 && < 3000.3, Cabal >= 1.10,- ghc >= 7.4 && < 7.10+ ghc == 7.8.* if flag(in-ghc-tree) cpp-options: -DIN_GHC_TREE
+ html-test/ref/Bug298.html view
@@ -0,0 +1,133 @@+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">+<html xmlns="http://www.w3.org/1999/xhtml"+><head+ ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"+ /><title+ >Bug298</title+ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"+ /><script src="haddock-util.js" type="text/javascript"+ ></script+ ><script type="text/javascript"+ >//<![CDATA[+window.onload = function () {pageLoad();setSynopsis("mini_Bug298.html");};+//]]>+</script+ ></head+ ><body+ ><div id="package-header"+ ><ul class="links" id="page-menu"+ ><li+ ><a href=""+ >Contents</a+ ></li+ ><li+ ><a href=""+ >Index</a+ ></li+ ></ul+ ><p class="caption empty"+ > </p+ ></div+ ><div id="content"+ ><div id="module-header"+ ><table class="info"+ ><tr+ ><th+ >Safe Haskell</th+ ><td+ >Safe-Inferred</td+ ></tr+ ></table+ ><p class="caption"+ >Bug298</p+ ></div+ ><div id="synopsis"+ ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')"+ >Synopsis</p+ ><ul id="section.syn" class="hide" onclick="toggleSection('syn')"+ ><li class="src short"+ ><a href=""+ >(<^>)</a+ > :: (a -> a) -> a -> a</li+ ><li class="src short"+ ><a href=""+ >(<^)</a+ > :: a -> a -> a</li+ ><li class="src short"+ ><a href=""+ >(^>)</a+ > :: a -> a -> a</li+ ><li class="src short"+ ><a href=""+ >(⋆^)</a+ > :: a -> a -> a</li+ ><li class="src short"+ ><a href=""+ >f</a+ > :: ()</li+ ></ul+ ></div+ ><div id="interface"+ ><h1+ >Documentation</h1+ ><div class="top"+ ><p class="src"+ ><a name="v:-60--94--62-" class="def"+ >(<^>)</a+ > :: (a -> a) -> a -> a</p+ ></div+ ><div class="top"+ ><p class="src"+ ><a name="v:-60--94-" class="def"+ >(<^)</a+ > :: a -> a -> a</p+ ></div+ ><div class="top"+ ><p class="src"+ ><a name="v:-94--62-" class="def"+ >(^>)</a+ > :: a -> a -> a</p+ ></div+ ><div class="top"+ ><p class="src"+ ><a name="v:-8902--94-" class="def"+ >(⋆^)</a+ > :: a -> a -> a</p+ ></div+ ><div class="top"+ ><p class="src"+ ><a name="v:f" class="def"+ >f</a+ > :: ()</p+ ><div class="doc"+ ><p+ >Links to <code+ ><a href=""+ ><^></a+ ></code+ > and <code+ ><a href=""+ >^></a+ ></code+ >, <code+ ><a href=""+ ><^</a+ ></code+ > and <code+ ><a href=""+ >⋆^</a+ ></code+ >.</p+ ></div+ ></div+ ></div+ ></div+ ><div id="footer"+ ><p+ >Produced by <a href=""+ >Haddock</a+ > version 2.15.0</p+ ></div+ ></body+ ></html+>
+ html-test/ref/Bug308.html view
@@ -0,0 +1,111 @@+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">+<html xmlns="http://www.w3.org/1999/xhtml"+><head+ ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"+ /><title+ >Bug308</title+ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"+ /><script src="haddock-util.js" type="text/javascript"+ ></script+ ><script type="text/javascript"+ >//<![CDATA[+window.onload = function () {pageLoad();setSynopsis("mini_Bug308.html");};+//]]>+</script+ ></head+ ><body+ ><div id="package-header"+ ><ul class="links" id="page-menu"+ ><li+ ><a href=""+ >Contents</a+ ></li+ ><li+ ><a href=""+ >Index</a+ ></li+ ></ul+ ><p class="caption empty"+ > </p+ ></div+ ><div id="content"+ ><div id="module-header"+ ><table class="info"+ ><tr+ ><th+ >Safe Haskell</th+ ><td+ >Safe-Inferred</td+ ></tr+ ></table+ ><p class="caption"+ >Bug308</p+ ></div+ ><div id="synopsis"+ ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')"+ >Synopsis</p+ ><ul id="section.syn" class="hide" onclick="toggleSection('syn')"+ ><li class="src short"+ ><a href=""+ >f</a+ > :: ()</li+ ><li class="src short"+ ><a href=""+ >g</a+ > :: ()</li+ ></ul+ ></div+ ><div id="interface"+ ><h1+ >Documentation</h1+ ><div class="top"+ ><p class="src"+ ><a name="v:f" class="def"+ >f</a+ > :: ()</p+ ><div class="doc"+ ><p+ >start<a name="startAnchor"+ ></a+ > followed by middle<a name="middleAnchor"+ ></a+ > and end<a name="endAnchor"+ ></a+ ></p+ ></div+ ></div+ ><div class="top"+ ><p class="src"+ ><a name="v:g" class="def"+ >g</a+ > :: ()</p+ ><div class="doc"+ ><p+ >start <a href=""+ >Bug308</a+ ></p+ ><p+ >startOldStyle <a href=""+ >Bug308</a+ ></p+ ><p+ >middle <a href=""+ >Bug308</a+ ></p+ ><p+ >end <a href=""+ >Bug308</a+ ></p+ ></div+ ></div+ ></div+ ></div+ ><div id="footer"+ ><p+ >Produced by <a href=""+ >Haddock</a+ > version 2.15.0</p+ ></div+ ></body+ ></html+>
+ html-test/ref/Bug308CrossModule.html view
@@ -0,0 +1,91 @@+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">+<html xmlns="http://www.w3.org/1999/xhtml"+><head+ ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"+ /><title+ >Bug308CrossModule</title+ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"+ /><script src="haddock-util.js" type="text/javascript"+ ></script+ ><script type="text/javascript"+ >//<![CDATA[+window.onload = function () {pageLoad();setSynopsis("mini_Bug308CrossModule.html");};+//]]>+</script+ ></head+ ><body+ ><div id="package-header"+ ><ul class="links" id="page-menu"+ ><li+ ><a href=""+ >Contents</a+ ></li+ ><li+ ><a href=""+ >Index</a+ ></li+ ></ul+ ><p class="caption empty"+ > </p+ ></div+ ><div id="content"+ ><div id="module-header"+ ><table class="info"+ ><tr+ ><th+ >Safe Haskell</th+ ><td+ >Safe-Inferred</td+ ></tr+ ></table+ ><p class="caption"+ >Bug308CrossModule</p+ ></div+ ><div id="synopsis"+ ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')"+ >Synopsis</p+ ><ul id="section.syn" class="hide" onclick="toggleSection('syn')"+ ><li class="src short"+ ><a href=""+ >h</a+ > :: ()</li+ ></ul+ ></div+ ><div id="interface"+ ><h1+ >Documentation</h1+ ><div class="top"+ ><p class="src"+ ><a name="v:h" class="def"+ >h</a+ > :: ()</p+ ><div class="doc"+ ><p+ >start <a href=""+ >Bug308</a+ ></p+ ><p+ >startOldStyle <a href=""+ >Bug308</a+ ></p+ ><p+ >middle <a href=""+ >Bug308</a+ ></p+ ><p+ >end <a href=""+ >Bug308</a+ ></p+ ></div+ ></div+ ></div+ ></div+ ><div id="footer"+ ><p+ >Produced by <a href=""+ >Haddock</a+ > version 2.15.0</p+ ></div+ ></body+ ></html+>
html-test/run.lhs view
@@ -134,9 +134,21 @@ else do putStrLn $ "Pass: " ++ mod ++ " (no .ref file)" +-- | A rather nasty way to drop the Haddock version string from the+-- end of the generated HTML files so that we don't have to change+-- every single test every time we change versions. We rely on the the+-- last paragraph of the document to be the version. We end up with+-- malformed HTML but we don't care as we never look at it ourselves.+dropVersion :: String -> String+dropVersion = reverse . dropTillP . reverse+ where+ dropTillP [] = []+ dropTillP ('p':'<':xs) = xs+ dropTillP (_:xs) = dropTillP xs haddockEq :: String -> String -> Bool-haddockEq file1 file2 = stripLinks file1 == stripLinks file2+haddockEq file1 file2 =+ stripLinks (dropVersion file1) == stripLinks (dropVersion file2) stripLinks :: String -> String stripLinks str =
+ html-test/src/Bug298.hs view
@@ -0,0 +1,22 @@+-- We introduced a regression in 2.14.x where we don't consider+-- identifiers with ^ as valid. We test that the regression goes away+-- here. It's a silly typo in the parser, really. Same with ★ which is a valid+-- symbol according to the 2010 report.+module Bug298 where+++(<^>) :: (a -> a) -> a -> a+x <^> y = x y++(<^) :: a -> a -> a+x <^ y = x++(^>) :: a -> a -> a+x ^> y = y++(⋆^) :: a -> a -> a+x ⋆^ y = y++-- | Links to '<^>' and '^>', '<^' and '⋆^'.+f :: ()+f = ()
+ html-test/src/Bug308.hs view
@@ -0,0 +1,21 @@+-- From 2.14.x onwards we were forgetting to swallow ‘#’ as a special+-- character resulting in broken anchors if they accured+-- mid-paragraph. Here we check that anchors get generated as+-- expected.+module Bug308 where++-- | start#startAnchor# followed by middle#middleAnchor# and end#endAnchor#+f :: ()+f = ()++{-|+start "Bug308#startAnchor"++startOldStyle "Bug308\#startAnchor"++middle "Bug308#middleAnchor"++end "Bug308#middleAnchor"+-}+g :: ()+g = ()
+ html-test/src/Bug308CrossModule.hs view
@@ -0,0 +1,17 @@+-- Just like Bug308 module but here we test that referring to anchors+-- from other modules works.+module Bug308CrossModule where++import Bug308++{-|+start "Bug308#startAnchor"++startOldStyle "Bug308\#startAnchor"++middle "Bug308#middleAnchor"++end "Bug308#middleAnchor"+-}+h :: ()+h = ()
html-test/src/Bug85.hs view
@@ -1,5 +1,4 @@ {-# LANGUAGE GADTs, KindSignatures #-}-{-# OPTIONS_HADDOCK use-unicode #-} module Bug85 where -- explicitly stated non-trivial kind
src/Haddock/Backends/Xhtml/DocMarkup.hs view
@@ -42,7 +42,12 @@ markupIdentifier = thecode . ppId insertAnchors, markupIdentifierUnchecked = thecode . ppUncheckedLink qual, markupModule = \m -> let (mdl,ref) = break (=='#') m- in ppModuleRef (mkModuleName mdl) ref,+ -- Accomodate for old style+ -- foo\#bar anchors+ mdl' = case reverse mdl of+ '\\':_ -> init mdl+ _ -> mdl+ in ppModuleRef (mkModuleName mdl') ref, markupWarning = thediv ! [theclass "warning"], markupEmphasis = emphasize, markupBold = strong,
src/Haddock/Convert.hs view
@@ -94,10 +94,10 @@ (synifyType ImplicitizeForAll (dataConUserType dc))) AConLike (PatSynCon ps) ->- let (_, _, (req_theta, prov_theta)) = patSynSig ps+ let (_, _, req_theta, prov_theta, _, res_ty) = patSynSig ps in SigD $ PatSynSig (synifyName ps) (fmap (synifyType WithinType) (patSynTyDetails ps))- (synifyType WithinType (patSynType ps))+ (synifyType WithinType res_ty) (synifyCtx req_theta) (synifyCtx prov_theta)
src/Haddock/Interface/Create.hs view
@@ -364,7 +364,7 @@ where decls = docs ++ defs ++ sigs ++ ats docs = mkDecls tcdDocs DocD class_- defs = mkDecls (map snd . bagToList . tcdMeths) ValD class_+ defs = mkDecls (bagToList . tcdMeths) ValD class_ sigs = mkDecls tcdSigs SigD class_ ats = mkDecls tcdATs (TyClD . FamDecl) class_ @@ -384,13 +384,13 @@ ungroup :: HsGroup Name -> [LHsDecl Name] ungroup group_ = mkDecls (tyClGroupConcat . hs_tyclds) TyClD group_ ++- mkDecls hs_derivds DerivD group_ ++- mkDecls hs_defds DefD group_ ++- mkDecls hs_fords ForD group_ ++- mkDecls hs_docs DocD group_ ++- mkDecls hs_instds InstD group_ ++- mkDecls (typesigs . hs_valds) SigD group_ ++- mkDecls (map snd . valbinds . hs_valds) ValD group_+ mkDecls hs_derivds DerivD group_ +++ mkDecls hs_defds DefD group_ +++ mkDecls hs_fords ForD group_ +++ mkDecls hs_docs DocD group_ +++ mkDecls hs_instds InstD group_ +++ mkDecls (typesigs . hs_valds) SigD group_ +++ mkDecls (valbinds . hs_valds) ValD group_ where typesigs (ValBindsOut _ sigs) = filter isVanillaLSig sigs typesigs _ = error "expected ValBindsOut"
src/Haddock/Parser.hs view
@@ -85,8 +85,11 @@ num = hex <|> decimal hex = ("x" <|> "X") *> hexadecimal +-- | List of characters that we use to delimit any special markup.+-- 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@@ -140,7 +143,8 @@ -- >>> parseOnly anchor "#Hello world#" -- Right (DocAName "Hello world") anchor :: Parser (Doc a)-anchor = DocAName . decodeUtf8 <$> ("#" *> takeWhile1 (`notElem` "#\n") <* "#")+anchor = DocAName . decodeUtf8 <$>+ disallowNewline ("#" *> takeWhile1_ (/= '#') <* "#") -- | Monospaced strings. --@@ -158,7 +162,8 @@ -- NOTE: According to Haskell 2010 we shouldd actually only -- accept {small | large | digit | ' } here. But as we can't -- match on unicode characters, this is currently not possible.- <*> (decodeUtf8 <$> takeWhile (`notElem` " .&[{}(=*)+]!#|@/;,^?\"\n"))+ -- Note that we allow ‘#’ to suport anchors.+ <*> (decodeUtf8 <$> takeWhile (`notElem` " .&[{}(=*)+]!|@/;,^?\"\n")) -- | Picture parser, surrounded by \<\< and \>\>. It's possible to specify -- a title for the picture.@@ -419,13 +424,21 @@ -- characters and does no actual validation itself. parseValid :: Parser String parseValid = do- vs <- many' $ satisfy (`elem` "_.!#$%&*+/<=>?@\\|-~:") <|> digit <|> letter_ascii+ vs' <- many' $ utf8String "⋆" <|> return <$> idChar+ let vs = concat vs' c <- peekChar case c of Just '`' -> return vs Just '\'' -> (\x -> vs ++ "'" ++ x) <$> ("'" *> parseValid) <|> return vs _ -> fail "outofvalid"+ where+ idChar = satisfy (`elem` "_.!#$%&*+/<=>?@\\|-~:^")+ <|> digit <|> letter_ascii++-- | Parses UTF8 strings from ByteString streams.+utf8String :: String -> Parser String+utf8String x = decodeUtf8 <$> string (encodeUtf8 x) -- | Parses identifiers with help of 'parseValid'. Asks GHC for 'RdrName' from the -- string it deems valid.
test/Haddock/ParserSpec.hs view
@@ -185,6 +185,13 @@ it "does not accept newlines in anchors" $ do "#foo\nbar#" `shouldParseTo` "#foo\nbar#" + it "accepts anchors mid-paragraph" $ do+ "Hello #someAnchor# world!"+ `shouldParseTo` "Hello " <> DocAName "someAnchor" <> " world!"++ it "does not accept empty anchors" $ do+ "##" `shouldParseTo` "##"+ context "when parsing emphasised text" $ do it "emphasises a word on its own" $ do "/foo/" `shouldParseTo` DocEmphasis "foo"@@ -307,6 +314,12 @@ it "treats empty module name as regular double quotes" $ do "\"\"" `shouldParseTo` "\"\""++ it "accepts anchor reference syntax as DocModule" $ do+ "\"Foo#bar\"" `shouldParseTo` DocModule "Foo#bar"++ it "accepts old anchor reference syntax as DocModule" $ do+ "\"Foo\\#bar\"" `shouldParseTo` DocModule "Foo\\#bar" describe "parseParas" $ do let infix 1 `shouldParseTo`