From f6e5d57bee5a7bf5d74d26982db64fa8a56f17bd Mon Sep 17 00:00:00 2001 From: Sebastian Meric de Bellefon Date: Sun, 15 May 2016 01:12:28 -0400 Subject: Fix #280. Parsing of module header The initial newlines were counted as indentation spaces, thus disturbing the parsing of next lines --- .../src/Haddock/Interface/ParseModuleHeader.hs | 2 +- html-test/ref/Bug280.html | 81 ++++++++++++++++++++++ html-test/src/Bug280.hs | 11 +++ 3 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 html-test/ref/Bug280.html create mode 100644 html-test/src/Bug280.hs diff --git a/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs b/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs index e7d2a085..768a31ce 100644 --- a/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs +++ b/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs @@ -76,7 +76,7 @@ parseKey :: String -> String -> Maybe (String,String) parseKey key toParse0 = do let - (spaces0,toParse1) = extractLeadingSpaces toParse0 + (spaces0,toParse1) = extractLeadingSpaces (dropWhile (`elem` ['\r', '\n']) toParse0) indentation = spaces0 afterKey0 <- extractPrefix key toParse1 diff --git a/html-test/ref/Bug280.html b/html-test/ref/Bug280.html new file mode 100644 index 00000000..f154f300 --- /dev/null +++ b/html-test/ref/Bug280.html @@ -0,0 +1,81 @@ + +Bug280

 

CopyrightFoo, + Bar, + Baz
Safe HaskellSafe

Bug280

Description

The module description

Documentation

x :: [Char] #

diff --git a/html-test/src/Bug280.hs b/html-test/src/Bug280.hs new file mode 100644 index 00000000..ac27e2e5 --- /dev/null +++ b/html-test/src/Bug280.hs @@ -0,0 +1,11 @@ +{-| +Copyright: Foo, + Bar, + Baz + +The module description +-} +-- The module header can start with newlines. They are not taken into account for the indentation level +module Bug280 where + +x = "" -- cgit v1.2.3 From ebd41f6eb98fdbd43e25fdd574271de9159cde11 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Sun, 22 May 2016 12:31:50 +0200 Subject: Create: Remove redundant imports --- haddock-api/src/Haddock/Interface/Create.hs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/haddock-api/src/Haddock/Interface/Create.hs b/haddock-api/src/Haddock/Interface/Create.hs index 007038cb..a351c0dc 100644 --- a/haddock-api/src/Haddock/Interface/Create.hs +++ b/haddock-api/src/Haddock/Interface/Create.hs @@ -36,7 +36,6 @@ import Control.Arrow (second) import Control.DeepSeq import Control.Monad import Data.Function (on) -import qualified Data.Foldable as F import qualified Packages import qualified Module @@ -50,7 +49,7 @@ import TcRnTypes import FastString (concatFS) import BasicTypes ( StringLiteral(..) ) import qualified Outputable as O -import HsDecls ( gadtDeclDetails,getConDetails ) +import HsDecls ( getConDetails ) -- | Use a 'TypecheckedModule' to produce an 'Interface'. -- To do this, we need access to already processed modules in the topological -- cgit v1.2.3 From c03dad1c5d4ab7c44234d145ba9c13f17a918201 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Sun, 22 May 2016 12:32:02 +0200 Subject: Create: Better debug output For tracking down #505 --- haddock-api/src/Haddock/Interface/Create.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/haddock-api/src/Haddock/Interface/Create.hs b/haddock-api/src/Haddock/Interface/Create.hs index a351c0dc..8d561d68 100644 --- a/haddock-api/src/Haddock/Interface/Create.hs +++ b/haddock-api/src/Haddock/Interface/Create.hs @@ -789,7 +789,10 @@ extractDecl name mdl decl [s0] -> let (n, tyvar_names) = (tcdName d, tyClDeclTyVars d) L pos sig = addClassContext n tyvar_names s0 in L pos (SigD sig) - _ -> error "internal: extractDecl (ClassDecl)" + _ -> O.pprPanic "extractDecl" (O.text "Ambiguous decl for" O.<+> O.ppr name O.<+> O.text "in class:" + O.$$ O.nest 4 (O.ppr d) + O.$$ O.text "Matches:" + O.$$ O.nest 4 (O.ppr matches)) TyClD d@DataDecl {} -> let (n, tyvar_tys) = (tcdName d, lHsQTyVarsToTypes (tyClDeclTyVars d)) in SigD <$> extractRecSel name mdl n tyvar_tys (dd_cons (tcdDataDefn d)) -- cgit v1.2.3 From 6193f6d07f380436048928182ef511f167909a53 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Sun, 22 May 2016 12:42:23 +0200 Subject: Don't consider default class ops when looking for decls When we are looking for an operation within a class we don't care about `default`-type declarations. This was the cause of #505. --- haddock-api/src/Haddock/Interface/Create.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/haddock-api/src/Haddock/Interface/Create.hs b/haddock-api/src/Haddock/Interface/Create.hs index 8d561d68..e0b52cb5 100644 --- a/haddock-api/src/Haddock/Interface/Create.hs +++ b/haddock-api/src/Haddock/Interface/Create.hs @@ -783,8 +783,13 @@ extractDecl name mdl decl | otherwise = case unLoc decl of TyClD d@ClassDecl {} -> - let matches = [ sig | sig <- tcdSigs d, name `elem` sigName sig, - isTypeLSig sig ] -- TODO: document fixity + let matches = [ lsig + | lsig <- tcdSigs d + , ClassOpSig False _ _ <- pure $ unLoc lsig + -- Note: exclude `default` declarations (see #505) + , name `elem` sigName lsig + ] + -- TODO: document fixity in case matches of [s0] -> let (n, tyvar_names) = (tcdName d, tyClDeclTyVars d) L pos sig = addClassContext n tyvar_names s0 -- cgit v1.2.3 From ba70ca2a921d7aa7af547a61ea7eba5a02381653 Mon Sep 17 00:00:00 2001 From: David Feuer Date: Tue, 24 May 2016 18:48:53 -0400 Subject: Make parser state a newtype Previously, it was `data` wrapping a `Maybe`, which seems a bit silly. Obviously, this can be changed back if anyone wants to add more fields some day. --- haddock-library/src/Documentation/Haddock/Parser/Monad.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/haddock-library/src/Documentation/Haddock/Parser/Monad.hs b/haddock-library/src/Documentation/Haddock/Parser/Monad.hs index a421c58c..3f7d60f8 100644 --- a/haddock-library/src/Documentation/Haddock/Parser/Monad.hs +++ b/haddock-library/src/Documentation/Haddock/Parser/Monad.hs @@ -42,7 +42,7 @@ import Data.Tuple import Documentation.Haddock.Types (Version) -data ParserState = ParserState { +newtype ParserState = ParserState { parserStateSince :: Maybe Version } deriving (Eq, Show) -- cgit v1.2.3 From 474a0c182d6ef9a7e93e277a2755d04d943059a0 Mon Sep 17 00:00:00 2001 From: Sebastian Meric de Bellefon Date: Tue, 24 May 2016 17:36:34 -0400 Subject: remove framed view of the HTML documentation (see #114 and #274) Frames are a bit broken, ignored by Hackage, and considered obsolete in general. This patch disables frames generation. The mini_*.html files are still used in the synopsis. --- doc/invoking.rst | 8 ++---- haddock-api/haddock-api.cabal | 1 - haddock-api/resources/html/frames.html | 30 --------------------- haddock-api/resources/html/haddock-util.js | 28 -------------------- haddock-api/src/Haddock/Backends/Xhtml.hs | 42 +++--------------------------- haddock-api/src/Haddock/Utils.hs | 12 ++------- html-test/ref/frames.html | 30 --------------------- html-test/ref/haddock-util.js | 28 -------------------- 8 files changed, 7 insertions(+), 172 deletions(-) delete mode 100644 haddock-api/resources/html/frames.html delete mode 100644 html-test/ref/frames.html diff --git a/doc/invoking.rst b/doc/invoking.rst index 13cb9f1e..83087bac 100644 --- a/doc/invoking.rst +++ b/doc/invoking.rst @@ -100,7 +100,7 @@ The following options are available: ``module.html``; ``mini_module.html`` An HTML page for each module, and a "mini" page for each used - when viewing in frames. + when viewing their synopsis. ``index.html`` The top level page of the documentation: lists the modules @@ -111,17 +111,13 @@ The following options are available: The alphabetic index, possibly split into multiple pages if big enough. - ``frames.html`` - The top level document when viewing in frames. - ``some.css``; ``etc...`` Files needed for the themes used. Specify your themes using the :option:`--theme` option. ``haddock-util.js`` Some JavaScript utilities used to implement some of the dynamic - features like collapsible sections, and switching to frames - view. + features like collapsible sections. .. option:: --latex diff --git a/haddock-api/haddock-api.cabal b/haddock-api/haddock-api.cabal index 6c98fcfb..d1bbf783 100644 --- a/haddock-api/haddock-api.cabal +++ b/haddock-api/haddock-api.cabal @@ -19,7 +19,6 @@ data-dir: resources data-files: html/solarized.css - html/frames.html html/haddock-util.js html/highlight.js html/Classic.theme/haskell_icon.gif diff --git a/haddock-api/resources/html/frames.html b/haddock-api/resources/html/frames.html deleted file mode 100644 index e86edb66..00000000 --- a/haddock-api/resources/html/frames.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/haddock-api/resources/html/haddock-util.js b/haddock-api/resources/html/haddock-util.js index fc7743fe..92d07d2a 100644 --- a/haddock-api/resources/html/haddock-util.js +++ b/haddock-api/resources/html/haddock-util.js @@ -248,33 +248,6 @@ function addMenuItem(html) { } } -function adjustForFrames() { - var bodyCls; - - if (parent.location.href == window.location.href) { - // not in frames, so add Frames button - addMenuItem("Frames"); - bodyCls = "no-frame"; - } - else { - bodyCls = "in-frame"; - } - addClass(document.body, bodyCls); -} - -function reframe() { - setCookie("haddock-reframe", document.URL); - window.location = "frames.html"; -} - -function postReframe() { - var s = getCookie("haddock-reframe"); - if (s) { - parent.window.main.location = s; - clearCookie("haddock-reframe"); - } -} - function styles() { var i, a, es = document.getElementsByTagName("link"), rs = []; for (i = 0; a = es[i]; i++) { @@ -337,7 +310,6 @@ function styleMenu(show) { function pageLoad() { addStyleMenu(); - adjustForFrames(); resetStyle(); restoreCollapsed(); } diff --git a/haddock-api/src/Haddock/Backends/Xhtml.hs b/haddock-api/src/Haddock/Backends/Xhtml.hs index f7284062..8252839c 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml.hs @@ -36,14 +36,13 @@ import Haddock.GhcUtils import Control.Monad ( when, unless ) import Data.Char ( toUpper ) -import Data.List ( sortBy, groupBy, intercalate, isPrefixOf ) +import Data.List ( sortBy, intercalate, isPrefixOf ) import Data.Maybe import System.FilePath hiding ( () ) import System.Directory import Data.Map ( Map ) import qualified Data.Map as Map hiding ( Map ) import qualified Data.Set as Set hiding ( Set ) -import Data.Function import Data.Ord ( comparing ) import DynFlags (Language(..)) @@ -105,7 +104,8 @@ copyHtmlBits odir libdir themes = do copyCssFile f = copyFile f (combine odir (takeFileName f)) copyLibFile f = copyFile (joinPath [libhtmldir, f]) (joinPath [odir, f]) mapM_ copyCssFile (cssFiles themes) - mapM_ copyLibFile [ jsFile, framesFile ] + copyLibFile jsFile + return () headHtml :: String -> Maybe String -> Themes -> Maybe String -> Html @@ -268,9 +268,6 @@ ppHtmlContents dflags odir doctitle _maybe_package createDirectoryIfMissing True odir writeFile (joinPath [odir, contentsHtmlFile]) (renderToString debug html) - -- XXX: think of a better place for this? - ppHtmlContentsFrame odir doctitle themes mathjax_url ifaces debug - ppPrologue :: Qualification -> String -> Maybe (MDoc GHC.RdrName) -> Html ppPrologue _ _ Nothing = noHtml @@ -321,39 +318,6 @@ mkNode qual ss p (Node s leaf pkg srcPkg short ts) = subtree = mkNodeList qual (s:ss) p ts ! collapseSection p True "" --- | Turn a module tree into a flat list of full module names. E.g., --- @ --- A --- +-B --- +-C --- @ --- becomes --- @["A", "A.B", "A.B.C"]@ -flatModuleTree :: [InstalledInterface] -> [Html] -flatModuleTree ifaces = - map (uncurry ppModule' . head) - . groupBy ((==) `on` fst) - . sortBy (comparing fst) - $ mods - where - mods = [ (moduleString mdl, mdl) | mdl <- map instMod ifaces ] - ppModule' txt mdl = - anchor ! [href (moduleHtmlFile mdl), target mainFrameName] - << toHtml txt - - -ppHtmlContentsFrame :: FilePath -> String -> Themes -> Maybe String - -> [InstalledInterface] -> Bool -> IO () -ppHtmlContentsFrame odir doctitle themes maybe_mathjax_url ifaces debug = do - let mods = flatModuleTree ifaces - html = - headHtml doctitle Nothing themes maybe_mathjax_url +++ - miniBody << divModuleList << - (sectionName << "Modules" +++ - ulist << [ li ! [theclass "module"] << m | m <- mods ]) - createDirectoryIfMissing True odir - writeFile (joinPath [odir, frameIndexHtmlFile]) (renderToString debug html) - -------------------------------------------------------------------------------- -- * Generate the index diff --git a/haddock-api/src/Haddock/Utils.hs b/haddock-api/src/Haddock/Utils.hs index 58a7ef90..389aa5ab 100644 --- a/haddock-api/src/Haddock/Utils.hs +++ b/haddock-api/src/Haddock/Utils.hs @@ -21,10 +21,9 @@ module Haddock.Utils ( -- * Filename utilities moduleHtmlFile, moduleHtmlFile', contentsHtmlFile, indexHtmlFile, - frameIndexHtmlFile, moduleIndexFrameName, mainFrameName, synopsisFrameName, subIndexHtmlFile, - jsFile, framesFile, + jsFile, -- * Anchor and URL utilities moduleNameUrl, moduleNameUrl', moduleUrl, @@ -262,12 +261,6 @@ contentsHtmlFile = "index.html" indexHtmlFile = "doc-index.html" --- | The name of the module index file to be displayed inside a frame. --- Modules are display in full, but without indentation. Clicking opens in --- the main window. -frameIndexHtmlFile :: String -frameIndexHtmlFile = "index-frames.html" - moduleIndexFrameName, mainFrameName, synopsisFrameName :: String moduleIndexFrameName = "modules" @@ -333,9 +326,8 @@ makeAnchorId (f:r) = escape isAlpha f ++ concatMap (escape isLegal) r ------------------------------------------------------------------------------- -jsFile, framesFile :: String +jsFile :: String jsFile = "haddock-util.js" -framesFile = "frames.html" ------------------------------------------------------------------------------- diff --git a/html-test/ref/frames.html b/html-test/ref/frames.html deleted file mode 100644 index e86edb66..00000000 --- a/html-test/ref/frames.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/html-test/ref/haddock-util.js b/html-test/ref/haddock-util.js index fc7743fe..92d07d2a 100644 --- a/html-test/ref/haddock-util.js +++ b/html-test/ref/haddock-util.js @@ -248,33 +248,6 @@ function addMenuItem(html) { } } -function adjustForFrames() { - var bodyCls; - - if (parent.location.href == window.location.href) { - // not in frames, so add Frames button - addMenuItem("Frames"); - bodyCls = "no-frame"; - } - else { - bodyCls = "in-frame"; - } - addClass(document.body, bodyCls); -} - -function reframe() { - setCookie("haddock-reframe", document.URL); - window.location = "frames.html"; -} - -function postReframe() { - var s = getCookie("haddock-reframe"); - if (s) { - parent.window.main.location = s; - clearCookie("haddock-reframe"); - } -} - function styles() { var i, a, es = document.getElementsByTagName("link"), rs = []; for (i = 0; a = es[i]; i++) { @@ -337,7 +310,6 @@ function styleMenu(show) { function pageLoad() { addStyleMenu(); - adjustForFrames(); resetStyle(); restoreCollapsed(); } -- cgit v1.2.3 From 02adc0affe8f389dbfc1cfb8cf73ae56ac8a4069 Mon Sep 17 00:00:00 2001 From: Sebastian Meric de Bellefon Date: Wed, 25 May 2016 14:17:00 -0400 Subject: Update CHANGES --- CHANGES | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES b/CHANGES index d450cff5..4389c58a 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +Changes in version 2.17.3 + + * Remove framed view of the HTML documentation + Changes in version 2.17.2 * Fix portability of documentation building within GHC -- cgit v1.2.3 From 4202f96a37c9786708bd0410631bc1cf7a82d76a Mon Sep 17 00:00:00 2001 From: alexbiehl Date: Thu, 26 May 2016 12:43:09 +0200 Subject: Remove misplaced haddock comment --- haddock-api/src/Haddock/Interface/Create.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/haddock-api/src/Haddock/Interface/Create.hs b/haddock-api/src/Haddock/Interface/Create.hs index e0b52cb5..cb855693 100644 --- a/haddock-api/src/Haddock/Interface/Create.hs +++ b/haddock-api/src/Haddock/Interface/Create.hs @@ -832,7 +832,7 @@ extractRecSel nm mdl t tvs (L _ con : rest) = matching_fields flds = [ (l,f) | f@(L _ (ConDeclField ns _ _)) <- flds , L l n <- ns, selectorFieldOcc n == nm ] data_ty - -- | ResTyGADT _ ty <- con_res con = ty + -- ResTyGADT _ ty <- con_res con = ty | ConDeclGADT{} <- con = hsib_body $ con_type con | otherwise = foldl' (\x y -> noLoc (HsAppTy x y)) (noLoc (HsTyVar (noLoc t))) tvs -- cgit v1.2.3 From 8d826904a8a37ada9c74f1821cc8a4a1a5abcd05 Mon Sep 17 00:00:00 2001 From: Sebastian Meric de Bellefon Date: Fri, 3 Jun 2016 18:07:48 -0400 Subject: Version bumps (2.17.3, 1.4.2) --- haddock-api/haddock-api.cabal | 2 +- haddock-library/haddock-library.cabal | 2 +- haddock.cabal | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/haddock-api/haddock-api.cabal b/haddock-api/haddock-api.cabal index d1bbf783..8fe4c3b1 100644 --- a/haddock-api/haddock-api.cabal +++ b/haddock-api/haddock-api.cabal @@ -1,5 +1,5 @@ name: haddock-api -version: 2.17.2 +version: 2.17.3 synopsis: A documentation-generation tool for Haskell libraries description: Haddock is a documentation-generation tool for Haskell libraries diff --git a/haddock-library/haddock-library.cabal b/haddock-library/haddock-library.cabal index f9a61181..5eced02d 100644 --- a/haddock-library/haddock-library.cabal +++ b/haddock-library/haddock-library.cabal @@ -1,5 +1,5 @@ name: haddock-library -version: 1.4.1 +version: 1.4.2 synopsis: Library exposing some functionality of Haddock. description: Haddock is a documentation-generation tool for Haskell libraries. These modules expose some functionality of it diff --git a/haddock.cabal b/haddock.cabal index 27f2d604..92729970 100644 --- a/haddock.cabal +++ b/haddock.cabal @@ -1,5 +1,5 @@ name: haddock -version: 2.17.2 +version: 2.17.3 synopsis: A documentation-generation tool for Haskell libraries description: Haddock is a documentation-generation tool for Haskell libraries -- cgit v1.2.3 From 37692f64d21d417e25d89b92ec1a0fab059ed500 Mon Sep 17 00:00:00 2001 From: Sebastian Meric de Bellefon Date: Mon, 6 Jun 2016 19:07:17 -0400 Subject: publish haddock-test library --- haddock-test/Setup.lhs | 3 +++ haddock-test/haddock-test.cabal | 2 +- haddock.cabal | 8 ++++---- 3 files changed, 8 insertions(+), 5 deletions(-) create mode 100755 haddock-test/Setup.lhs diff --git a/haddock-test/Setup.lhs b/haddock-test/Setup.lhs new file mode 100755 index 00000000..5bde0de9 --- /dev/null +++ b/haddock-test/Setup.lhs @@ -0,0 +1,3 @@ +#!/usr/bin/env runhaskell +> import Distribution.Simple +> main = defaultMain diff --git a/haddock-test/haddock-test.cabal b/haddock-test/haddock-test.cabal index 2b75ea81..7cb15d7d 100644 --- a/haddock-test/haddock-test.cabal +++ b/haddock-test/haddock-test.cabal @@ -16,7 +16,7 @@ library default-language: Haskell2010 ghc-options: -Wall hs-source-dirs: src - build-depends: base, bytestring, directory, process, filepath, Cabal, xml, xhtml, syb + build-depends: base >= 4.3 && < 4.10, bytestring, directory, process, filepath, Cabal, xml, xhtml, syb exposed-modules: Test.Haddock diff --git a/haddock.cabal b/haddock.cabal index 92729970..49745a10 100644 --- a/haddock.cabal +++ b/haddock.cabal @@ -133,14 +133,14 @@ test-suite html-test default-language: Haskell2010 main-is: Main.hs hs-source-dirs: html-test - build-depends: base, filepath, haddock-test + build-depends: base, filepath, haddock-test == 0.0.1 test-suite hypsrc-test type: exitcode-stdio-1.0 default-language: Haskell2010 main-is: Main.hs hs-source-dirs: hypsrc-test - build-depends: base, filepath, haddock-test + build-depends: base, filepath, haddock-test == 0.0.1 ghc-options: -Wall -fwarn-tabs test-suite latex-test @@ -148,14 +148,14 @@ test-suite latex-test default-language: Haskell2010 main-is: Main.hs hs-source-dirs: latex-test - build-depends: base, filepath, haddock-test + build-depends: base, filepath, haddock-test == 0.0.1 test-suite hoogle-test type: exitcode-stdio-1.0 default-language: Haskell2010 main-is: Main.hs hs-source-dirs: hoogle-test - build-depends: base, filepath, haddock-test + build-depends: base, filepath, haddock-test == 0.0.1 source-repository head type: git -- cgit v1.2.3 From ccd952f8741a1818afac6ee50a54c0a7f4dee4b3 Mon Sep 17 00:00:00 2001 From: Dominic Steinitz Date: Thu, 9 Jun 2016 09:27:28 +0100 Subject: Documentation for LaTeX markup. --- doc/markup.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/doc/markup.rst b/doc/markup.rst index a2274ad6..733b810b 100644 --- a/doc/markup.rst +++ b/doc/markup.rst @@ -799,6 +799,21 @@ If the output format supports it, the image will be rendered inside the documentation. The image description is used as relpacement text and/or image title. +Mathematics / LaTeX +~~~~~~~~~~~~~~~~~~~ + +Haddock supports LaTeX syntax for rendering mathematical notation. The +delimiters are ``\[...\]`` for displayed mathemetics and ``\(...\)`` +for in-line mathematics. An example looks like this: :: + + \[ + f(a) = \frac{1}{2\pi i}\oint_\gamma \frac{f(z)}{z-a}\mathrm\,{d}z + \] + +If the output format supports it, the mathematics will be rendered +inside the documentation. For example, the HTML backend will display +the mathematics via mathjax. + Anchors ~~~~~~~ -- cgit v1.2.3 From f453f37b178033ffa3b0d37707ee7fc8d1ddb8f5 Mon Sep 17 00:00:00 2001 From: Dominic Steinitz Date: Thu, 9 Jun 2016 09:33:59 +0100 Subject: Fix spelling mistake. --- doc/markup.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/markup.rst b/doc/markup.rst index 733b810b..a270da27 100644 --- a/doc/markup.rst +++ b/doc/markup.rst @@ -803,7 +803,7 @@ Mathematics / LaTeX ~~~~~~~~~~~~~~~~~~~ Haddock supports LaTeX syntax for rendering mathematical notation. The -delimiters are ``\[...\]`` for displayed mathemetics and ``\(...\)`` +delimiters are ``\[...\]`` for displayed mathematics and ``\(...\)`` for in-line mathematics. An example looks like this: :: \[ -- cgit v1.2.3 From 6b075efec016e9a28e83d738893862145a7164d4 Mon Sep 17 00:00:00 2001 From: Dominic Steinitz Date: Thu, 9 Jun 2016 09:37:15 +0100 Subject: Camel case MathJax. --- doc/markup.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/markup.rst b/doc/markup.rst index a270da27..bc27d34f 100644 --- a/doc/markup.rst +++ b/doc/markup.rst @@ -812,7 +812,7 @@ for in-line mathematics. An example looks like this: :: If the output format supports it, the mathematics will be rendered inside the documentation. For example, the HTML backend will display -the mathematics via mathjax. +the mathematics via MathJax. Anchors ~~~~~~~ -- cgit v1.2.3 From 1f28fd887cd405ef5e31868ae51c32df2545e484 Mon Sep 17 00:00:00 2001 From: Dominic Steinitz Date: Thu, 9 Jun 2016 09:44:53 +0100 Subject: Fix math typo and add link. --- doc/markup.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/markup.rst b/doc/markup.rst index bc27d34f..78718c18 100644 --- a/doc/markup.rst +++ b/doc/markup.rst @@ -807,12 +807,12 @@ delimiters are ``\[...\]`` for displayed mathematics and ``\(...\)`` for in-line mathematics. An example looks like this: :: \[ - f(a) = \frac{1}{2\pi i}\oint_\gamma \frac{f(z)}{z-a}\mathrm\,{d}z + f(a) = \frac{1}{2\pi i}\oint_\gamma \frac{f(z)}{z-a}\,\mathrm{d}z \] If the output format supports it, the mathematics will be rendered inside the documentation. For example, the HTML backend will display -the mathematics via MathJax. +the mathematics via `MathJax `__. Anchors ~~~~~~~ -- cgit v1.2.3 From 5a9c393c8f0f6d24fa185f4acbb39e40a0f534a6 Mon Sep 17 00:00:00 2001 From: Sebastian Meric de Bellefon Date: Thu, 16 Jun 2016 00:46:46 -0400 Subject: Copyright holders shown on several lines. Fix #279 --- haddock-api/src/Haddock/Backends/Xhtml.hs | 18 ++++++++++++++---- html-test/ref/Bug280.html | 8 ++++---- html-test/ref/Test.html | 2 +- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/haddock-api/src/Haddock/Backends/Xhtml.hs b/haddock-api/src/Haddock/Backends/Xhtml.hs index 8252839c..0958c2cd 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml.hs @@ -35,8 +35,8 @@ import Text.XHtml hiding ( name, title, p, quote ) import Haddock.GhcUtils import Control.Monad ( when, unless ) -import Data.Char ( toUpper ) -import Data.List ( sortBy, intercalate, isPrefixOf ) +import Data.Char ( toUpper, isSpace ) +import Data.List ( sortBy, intercalate, isPrefixOf, intersperse ) import Data.Maybe import System.FilePath hiding ( () ) import System.Directory @@ -201,8 +201,7 @@ moduleInfo iface = field info >>= \a -> return (th << fieldName <-> td << a) entries :: [HtmlTable] - entries = mapMaybe doOneEntry [ - ("Copyright",hmi_copyright), + entries = maybeToList copyrightsTable ++ mapMaybe doOneEntry [ ("License",hmi_license), ("Maintainer",hmi_maintainer), ("Stability",hmi_stability), @@ -216,6 +215,14 @@ moduleInfo iface = Just Haskell98 -> Just "Haskell98" Just Haskell2010 -> Just "Haskell2010" + multilineRow :: String -> [String] -> HtmlTable + multilineRow title xs = (th ! [valign "top"]) << title <-> td << (toLines xs) + where toLines = mconcat . intersperse br . map toHtml + + copyrightsTable :: Maybe HtmlTable + copyrightsTable = fmap (multilineRow "Copyright" . split) (hmi_copyright info) + where split = map (trim . filter (/= ',')) . lines + extsForm | OptShowExtensions `elem` ifaceOptions iface = let fs = map (dropOpt . show) (hmi_extensions info) @@ -648,6 +655,9 @@ processDecl :: Bool -> Html -> Maybe Html processDecl True = Just processDecl False = Just . divTopDecl +trim :: String -> String +trim = f . f + where f = reverse . dropWhile isSpace processDeclOneLiner :: Bool -> Html -> Maybe Html processDeclOneLiner True = Just diff --git a/html-test/ref/Bug280.html b/html-test/ref/Bug280.html index f154f300..92eb61b0 100644 --- a/html-test/ref/Bug280.html +++ b/html-test/ref/Bug280.html @@ -34,12 +34,12 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug280.html");}; >
Foo
Bar
Baz
CopyrightFoo, - Bar, - Baz
Date: Thu, 16 Jun 2016 11:08:59 +0200 Subject: ocean: Ensure that synopsis fully covers other content Previously MathJax content was being rendered on top of the synopsis due to ambiguous z-ordering. Here we explicitly give the synopsis block a higher z-index to ensure it is rendered on top. Fixes #531. --- haddock-api/resources/html/Ocean.std-theme/ocean.css | 2 ++ 1 file changed, 2 insertions(+) diff --git a/haddock-api/resources/html/Ocean.std-theme/ocean.css b/haddock-api/resources/html/Ocean.std-theme/ocean.css index 3ebb14de..e8e4d705 100644 --- a/haddock-api/resources/html/Ocean.std-theme/ocean.css +++ b/haddock-api/resources/html/Ocean.std-theme/ocean.css @@ -333,6 +333,8 @@ div#style-menu-holder { top: 10%; padding: 0; max-width: 75%; + /* Ensure that synopsis covers everything (including MathJAX markup) */ + z-index: 1; } #synopsis .caption { -- cgit v1.2.3 From bc8de008b271ca4b9eb99f8043d08c42ab1734f0 Mon Sep 17 00:00:00 2001 From: Sebastian Meric de Bellefon Date: Wed, 22 Jun 2016 22:51:30 -0400 Subject: do not create empty src directory Fix #536. --- haddock-api/src/Haddock.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/haddock-api/src/Haddock.hs b/haddock-api/src/Haddock.hs index 5e8f4a4a..28974d19 100644 --- a/haddock-api/src/Haddock.hs +++ b/haddock-api/src/Haddock.hs @@ -336,7 +336,7 @@ render dflags flags qual ifaces installedIfaces extSrcMap = do ppLaTeX title pkgStr visibleIfaces odir (fmap _doc prologue) opt_latex_style libDir - when (Flag_HyperlinkedSource `elem` flags) $ do + when (Flag_HyperlinkedSource `elem` flags && not (null ifaces)) $ do ppHyperlinkedSource odir libDir opt_source_css pretty srcMap ifaces -- | From GHC 7.10, this function has a potential to crash with a -- cgit v1.2.3 From d1dc783cbf805e4169bf0528c57016ba175ad555 Mon Sep 17 00:00:00 2001 From: Omari Norman Date: Wed, 29 Jun 2016 21:59:34 -0400 Subject: Add $ as a special character If this character is not escaped, documentation built with Haddock 2.17.2 will fail. This was not an issue with 2.16 series, which causes builds to fail and there is nothing in the docs or error message giving a clue about why builds that used to succeed now don't. --- doc/markup.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/markup.rst b/doc/markup.rst index 78718c18..b0ebc738 100644 --- a/doc/markup.rst +++ b/doc/markup.rst @@ -501,7 +501,7 @@ Special characters ~~~~~~~~~~~~~~~~~~ The following characters have special meanings in documentation -comments: ``\\``, ``/``, ``'``, ``\```, ``"``, ``@``, ``<``. To insert a +comments: ``\\``, ``/``, ``'``, ``\```, ``"``, ``@``, ``<``, ``$``. To insert a literal occurrence of one of these special characters, precede it with a backslash (``\\``). -- cgit v1.2.3 From d9bb5fc3823d720783e31e1e95ed5ed35c721b7b Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Fri, 22 Jul 2016 02:55:04 -0700 Subject: Disable NFData instances for GHC types when GHC >= 8.0.2 (cherry picked from commit a3309e797c42dae9bccdeb17ce52fcababbaff8a) --- haddock-api/src/Haddock/Types.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/haddock-api/src/Haddock/Types.hs b/haddock-api/src/Haddock/Types.hs index eacf4473..17037781 100644 --- a/haddock-api/src/Haddock/Types.hs +++ b/haddock-api/src/Haddock/Types.hs @@ -1,4 +1,6 @@ -{-# LANGUAGE DeriveDataTypeable, DeriveFunctor, DeriveFoldable, DeriveTraversable, StandaloneDeriving, TypeFamilies, RecordWildCards #-} +{-# LANGUAGE CPP #-} +{-# LANGUAGE DeriveDataTypeable, DeriveFunctor, DeriveFoldable, DeriveTraversable, StandaloneDeriving #-} +{-# LANGUAGE TypeFamilies, RecordWildCards #-} {-# OPTIONS_GHC -fno-warn-orphans #-} ----------------------------------------------------------------------------- -- | @@ -447,10 +449,12 @@ instance (NFData a, NFData mod) DocExamples a -> a `deepseq` () DocHeader a -> a `deepseq` () - +#if !MIN_VERSION_ghc(8,0,2) +-- These were added to GHC itself in 8.0.2 instance NFData Name where rnf x = seq x () instance NFData OccName where rnf x = seq x () instance NFData ModuleName where rnf x = seq x () +#endif instance NFData id => NFData (Header id) where rnf (Header a b) = a `deepseq` b `deepseq` () -- cgit v1.2.3 From 60c43ac1ceac6e76c8ab6f2eac63be4ad2b3e77e Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Sun, 7 Aug 2016 13:51:18 +0200 Subject: ghc.mk: Don't attempt to install html/frames.html The frames business has been removed. --- ghc.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/ghc.mk b/ghc.mk index 72ba5df1..9226d027 100644 --- a/ghc.mk +++ b/ghc.mk @@ -36,7 +36,6 @@ endif utils/haddock_dist_MODULES += Paths_haddock -utils/haddock_dist_DATA_FILES += html/frames.html utils/haddock_dist_DATA_FILES += html/haddock-util.js utils/haddock_dist_DATA_FILES += html/Classic.theme/haskell_icon.gif utils/haddock_dist_DATA_FILES += html/Classic.theme/minus.gif -- cgit v1.2.3 From 08aa47916d6bb5a0f65d4da1021e0700b30b4b3b Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Sun, 7 Aug 2016 13:51:40 +0200 Subject: Haddock.Types: More precise version guard This allows haddock to be built with GHC 8.0.2 pre-releases. --- haddock-api/src/Haddock/Types.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/haddock-api/src/Haddock/Types.hs b/haddock-api/src/Haddock/Types.hs index 17037781..dcc50b95 100644 --- a/haddock-api/src/Haddock/Types.hs +++ b/haddock-api/src/Haddock/Types.hs @@ -449,7 +449,7 @@ instance (NFData a, NFData mod) DocExamples a -> a `deepseq` () DocHeader a -> a `deepseq` () -#if !MIN_VERSION_ghc(8,0,2) +#if !MIN_VERSION_GLASGOW_HASKELL(8,0,1,1) -- These were added to GHC itself in 8.0.2 instance NFData Name where rnf x = seq x () instance NFData OccName where rnf x = seq x () -- cgit v1.2.3 From 240bc38b94ed2d0af27333b23392d03eeb615e82 Mon Sep 17 00:00:00 2001 From: Bartosz Nitka Date: Tue, 20 Sep 2016 19:44:04 +0100 Subject: Fix rendering of class methods for Eq and Ord See #549 and GHC issue #12519 (cherry picked from commit 073d899a8f94ddec698f617a38d3420160a7fd0b) --- haddock-api/src/Haddock/Convert.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/haddock-api/src/Haddock/Convert.hs b/haddock-api/src/Haddock/Convert.hs index 660be723..7de840ee 100644 --- a/haddock-api/src/Haddock/Convert.hs +++ b/haddock-api/src/Haddock/Convert.hs @@ -82,7 +82,7 @@ tyThingToLHsDecl t = case t of (map (noLoc . getName) l, map (noLoc . getName) r) ) $ snd $ classTvsFds cl , tcdSigs = noLoc (MinimalSig mempty . noLoc . fmap noLoc $ classMinimalDef cl) : - map (noLoc . synifyIdSig DeleteTopLevelQuantification) + map (noLoc . synifyTcIdSig DeleteTopLevelQuantification) (classMethods cl) , tcdMeths = emptyBag --ignore default method definitions, they don't affect signature -- class associated-types are a subset of TyCon: @@ -317,6 +317,8 @@ synifyName = noLoc . getName synifyIdSig :: SynifyTypeState -> Id -> Sig Name synifyIdSig s i = TypeSig [synifyName i] (synifySigWcType s (varType i)) +synifyTcIdSig :: SynifyTypeState -> Id -> Sig Name +synifyTcIdSig s i = ClassOpSig False [synifyName i] (synifySigType s (varType i)) synifyCtx :: [PredType] -> LHsContext Name synifyCtx = noLoc . map (synifyType WithinType) -- cgit v1.2.3
Copyright(c) Simon Marlow 2002