hunk ./src/Haddock/Backends/Html.hs 1592 --- gaw 2004 hunk ./src/Haddock/Backends/Html.hs 1603 +ppr_mono_ty _ (HsQuasiQuoteTy {}) _ = error "ppr_mono_ty HsQuasiQuoteTy" hunk ./src/Haddock/Backends/Hoogle.hs 150 - tyVar (UserTyVar v) = v + tyVar (UserTyVar v _) = v hunk ./src/Haddock/Backends/Hoogle.hs 194 - ResTyH98 -> apps $ map (reL . HsTyVar) $ unL (tcdLName dat) : [x | UserTyVar x <- map unL $ tcdTyVars dat] + ResTyH98 -> apps $ map (reL . HsTyVar) $ unL (tcdLName dat) : [x | UserTyVar x _ <- map unL $ tcdTyVars dat] hunk ./src/Haddock/Backends/Html.hs 1360 -ppConstrHdr :: HsExplicitForAll -> [Name] -> HsContext DocName -> Bool -> Html +ppConstrHdr :: HsExplicitFlag -> [Name] -> HsContext DocName -> Bool -> Html hunk ./src/Haddock/Backends/Html.hs 1572 -ppForAll :: HsExplicitForAll -> [Located (HsTyVarBndr DocName)] +ppForAll :: HsExplicitFlag -> [Located (HsTyVarBndr DocName)] hunk ./src/Haddock/Backends/Html.hs 1603 -ppr_mono_ty _ (HsQuasiQuoteTy {}) _ = error "ppr_mono_ty HsQuasiQuoteTy" hunk ./src/Haddock/Backends/Html.hs 1604 -ppr_mono_ty _ (HsRecTy _) _ = error "ppr_mono_ty HsRecTy" +ppr_mono_ty _ (HsRecTy {}) _ = error "ppr_mono_ty HsRecTy" hunk ./src/Haddock/Convert.hs 221 - then UserTyVar name + then UserTyVar name placeHolderKind hunk ./src/Haddock/Backends/Html.hs 1601 -ppr_mono_ty _ (HsSpliceTy _) _ = error "ppr_mono_ty HsSpliceTy" -ppr_mono_ty _ (HsSpliceTyOut _) _ = error "ppr_mono_ty HsSpliceTyOut" +ppr_mono_ty _ (HsSpliceTy {}) _ = error "ppr_mono_ty HsSpliceTy" +ppr_mono_ty _ (HsQuasiQuoteTy {}) _ = error "ppr_mono_ty HsQuasiQuoteTy" hunk ./tests/runtests.hs 28 - result <- findProgramOnPath p silent + result <- findProgramOnPath silent p hunk ./tests/runtests.hs 73 - let basepath = init libdir ++ "/../../share/doc/ghc/libraries/base/" + let basepath = init libdir ++ "/../../share/doc/ghc/html/libraries/base/" hunk ./tests/runtests.hs 75 - let processpath = init libdir ++ "/../../share/doc/ghc/libraries/process/" + let processpath = init libdir ++ "/../../share/doc/ghc/html/libraries/process/" hunk ./tests/tests/CrossPackageDocs.hs 1 -module CrossPackageDocs (map, Monad(..), runInteractiveProcess {- $ Bugs -}) where +module CrossPackageDocs (map, Monad(..), runInteractiveProcess, MVar(..), newEmptyMVar {- $ Bugs -}) where hunk ./tests/tests/CrossPackageDocs.hs 4 +import GHC.MVar addfile ./tests/tests/CrossPackageDocs.html.ref hunk ./tests/tests/CrossPackageDocs.html.ref 1 + + +CrossPackageDocs
 ContentsIndex
CrossPackageDocs
Synopsis
map :: (a -> b) -> [a] -> [b]
class Monad m where
(>>=) :: m a -> (a -> m b) -> m b
(>>) :: m a -> m b -> m b
return :: a -> m a
fail :: String -> m a
runInteractiveProcess :: FilePath -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> IO (Handle, Handle, Handle, ProcessHandle)
data MVar a = MVar (MVar# RealWorld a)
newEmptyMVar :: IO (MVar a)
Documentation
map :: (a -> b) -> [a] -> [b]

map f xs is the list obtained by applying f to each element + of xs, i.e., +

map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn] + map f [x1, x2, ...] == [f x1, f x2, ...] +
class Monad m where

The Monad class defines the basic operations over a monad, +a concept from a branch of mathematics known as category theory. +From the perspective of a Haskell programmer, however, it is best to +think of a monad as an abstract datatype of actions. +Haskell's do expressions provide a convenient syntax for writing +monadic expressions. +

Minimal complete definition: >>= and return. +

Instances of Monad should satisfy the following laws: +

return a >>= k == k a + m >>= return == m + m >>= (\x -> k x >>= h) == (m >>= k) >>= h +

Instances of both Monad and Functor should additionally satisfy the law: +

fmap f xs == xs >>= return . f +

The instances of Monad for lists, Data.Maybe.Maybe and System.IO.IO +defined in the Prelude satisfy these laws. +

Methods
(>>=) :: m a -> (a -> m b) -> m b
Sequentially compose two actions, passing any value produced + by the first as an argument to the second. +
(>>) :: m a -> m b -> m b
Sequentially compose two actions, discarding any value produced + by the first, like sequencing operators (such as the semicolon) + in imperative languages. +
return :: a -> m a
Inject a value into the monadic type. +
fail :: String -> m a
Fail with a message. This operation is not part of the + mathematical definition of a monad, but is invoked on pattern-match + failure in a do expression. +
show/hide Instances
runInteractiveProcess
:: FilePathFilename of the executable +
-> [String]Arguments to pass to the executable +
-> Maybe FilePathOptional path to the working directory +
-> Maybe [(String, String)]Optional environment (otherwise inherit) +
-> IO (Handle, Handle, Handle, ProcessHandle)

Runs a raw command, and returns Handles that may be used to communicate + with the process via its stdin, stdout and stderr respectively. +

For example, to start a process and feed a string to its stdin: +

(inp,out,err,pid) <- runInteractiveProcess "..." + forkIO (hPutStr inp str) +

The Handles are initially in binary mode; if you need them to be + in text mode then use hSetBinaryMode. +

data MVar a
An MVar (pronounced "em-var") is a synchronising variable, used +for communication between concurrent threads. It can be thought of +as a a box, which may be empty or full. +
Constructors
MVar (MVar# RealWorld a)
show/hide Instances
newEmptyMVar :: IO (MVar a)
Create an MVar which is initially empty. +

Bugs: +

  • [] a +
  • No instances list +
  • No docs on function arguments +
Produced by Haddock version 2.5.0
hunk ./src/Haddock/Backends/Html.hs 1601 -ppr_mono_ty _ (HsSpliceTy {}) _ = error "ppr_mono_ty HsSpliceTy" -ppr_mono_ty _ (HsQuasiQuoteTy {}) _ = error "ppr_mono_ty HsQuasiQuoteTy" +ppr_mono_ty _ (HsSpliceTy _) _ = error "ppr_mono_ty HsSpliceTy" +ppr_mono_ty _ (HsSpliceTyOut _) _ = error "ppr_mono_ty HsSpliceTyOut" hunk ./src/Haddock/Backends/Html.hs 1604 -ppr_mono_ty _ (HsRecTy {}) _ = error "ppr_mono_ty HsRecTy" +ppr_mono_ty _ (HsRecTy _) _ = error "ppr_mono_ty HsRecTy" hunk ./src/Haddock/Convert.hs 52 - (map (\i -> noLoc $ synifyIdSig DeleteTopLevelQuantification i) + (map (noLoc . synifyIdSig DeleteTopLevelQuantification) hunk ./src/Haddock/Convert.hs 61 -synifyClassAT tc = noLoc $ synifyTyCon tc +synifyClassAT = noLoc . synifyTyCon hunk ./src/Haddock/Convert.hs 188 -synifyName n = noLoc (getName n) +synifyName = noLoc . getName hunk ./src/Haddock/Convert.hs 195 -synifyCtx ps = noLoc (map synifyPred ps) +synifyCtx = noLoc . map synifyPred hunk ./src/Haddock/Interface/Create.hs 283 - ++ "will be filtered out:\n " ++ (concat $ intersperse ", " + ++ "will be filtered out:\n " ++ concat (intersperse ", " hunk ./src/Haddock/Interface/Create.hs 292 - ++ "These instances are affected:\n" ++ (concat $ intersperse ", " instances) ] + ++ "These instances are affected:\n" ++ concat (intersperse ", " instances) ] hunk ./src/Haddock/Interface/Create.hs 449 - lookupExport (IEGroup lev docStr) = liftErrMsg $ do + lookupExport (IEGroup lev docStr) = liftErrMsg $ hunk ./src/Haddock/Interface/Create.hs 452 - lookupExport (IEDoc docStr) = liftErrMsg $ do + lookupExport (IEDoc docStr) = liftErrMsg $ hunk ./src/Haddock/Interface/Create.hs 455 - lookupExport (IEDocNamed str) = liftErrMsg $ do + lookupExport (IEDocNamed str) = liftErrMsg $ hunk ./src/Haddock/Interface/Create.hs 609 - isExported n = n `elem` exported_names + isExported = (`elem` exported_names) hunk ./src/Haddock/Interface/Create.hs 666 - return $ fmap (\doc -> ExportGroup lev "" doc) mbDoc + return $ fmap (ExportGroup lev "") mbDoc hunk ./src/Haddock/Interface/ExtractFnArgDocs.hs 1 -{-# LANGUAGE PatternGuards #-} hunk ./src/Haddock/Interface/LexParseRn.hs 61 - Just doc -> do - return (Just (rnHsDoc gre doc)) + Just doc -> return (Just (rnHsDoc gre doc)) hunk ./src/Haddock/ModuleTree.hs 18 -import Module ( Module, moduleNameString, moduleName, modulePackageId ) -import Module (packageIdString) +import Module ( Module, moduleNameString, moduleName, modulePackageId, + packageIdString ) hunk ./src/Haddock/ModuleTree.hs 29 - fn (mod_,pkg,short) trees = addToTrees mod_ pkg short trees + fn (mod_,pkg,short) = addToTrees mod_ pkg short hunk ./src/Haddock/Types.hs 31 +import Control.Arrow hunk ./src/Haddock/Types.hs 384 - fmap f (WriterGhc x) = WriterGhc (fmap (\(a,msgs)->(f a,msgs)) x) + fmap f (WriterGhc x) = WriterGhc (fmap (first f) x) hunk ./src/Haddock/Types.hs 388 - fmap (\ (b, msgs2) -> (b, msgs1 ++ msgs2)) (runWriterGhc (k a)) + fmap (second (msgs1 ++)) (runWriterGhc (k a)) hunk ./src/Main.hs 93 - putStrLn $ "haddock: " ++ (show e) + putStrLn $ "haddock: " ++ show e hunk ./src/Main.hs 98 -handleGhcExceptions inner = +handleGhcExceptions = hunk ./src/Main.hs 100 - handleGhcException (\e -> do + handleGhcException $ \e -> do hunk ./src/Main.hs 108 - ) inner hunk ./src/Main.hs 234 - when (Flag_GenContents `elem` flags && Flag_GenIndex `elem` flags) $ do + when (Flag_GenContents `elem` flags && Flag_GenIndex `elem` flags) $ hunk ./src/Main.hs 324 - then throwE ("Couldn't parse GHC options: " ++ (unwords origFlags)) + then throwE ("Couldn't parse GHC options: " ++ unwords origFlags) hunk ./src/Main.hs 333 -getHaddockLibDir flags = do +getHaddockLibDir flags = hunk ./src/Main.hs 344 -getGhcLibDir flags = do +getGhcLibDir flags = hunk ./src/Main.hs 376 - when (Flag_UseUnicode `elem` flags && not (Flag_Html `elem` flags)) $ - throwE ("Unicode can only be enabled for HTML output.") + when (Flag_UseUnicode `elem` flags && Flag_Html `notElem` flags) $ + throwE "Unicode can only be enabled for HTML output." hunk ./src/Main.hs 381 - throwE ("-h cannot be used with --gen-index or --gen-contents") + throwE "-h cannot be used with --gen-index or --gen-contents" hunk ./src/Main.hs 391 -updateHTMLXRefs packages = do - writeIORef html_xrefs_ref (Map.fromList mapping) +updateHTMLXRefs packages = writeIORef html_xrefs_ref (Map.fromList mapping) hunk ./src/Haddock/Interface/Create.hs 396 -{- -attachATs :: [IE Name] -> ([IE Name], [Name]) -attachATs exports = - where - ats = <- export ] --} - - hunk ./tests/runtests.hs 23 - where - stripLinks f = subRegex (mkRegexWithOpts "]*>" False False) f "" hunk ./tests/runtests.hs 24 +stripLinks f = subRegex (mkRegexWithOpts "]*>" False False) f "" hunk ./tests/runtests.hs 44 + let ref' = stripLinks ref + out' = stripLinks out + let reffile' = "output" takeFileName reffile ++ ".nolinks" + outfile' = "output" takeFileName outfile ++ ".nolinks" + writeFile reffile' ref' + writeFile outfile' out' hunk ./tests/runtests.hs 52 - then system $ "colordiff " ++ reffile ++ " " ++ outfile - else system $ "diff " ++ reffile ++ " " ++ outfile + then system $ "colordiff " ++ reffile' ++ " " ++ outfile' + else system $ "diff " ++ reffile' ++ " " ++ outfile' hunk ./tests/runtests.hs 27 - result <- findProgramOnPath silent p + result <- findProgramOnPath p silent hunk ./tests/tests/CrossPackageDocs.hs 1 -module CrossPackageDocs (map, Monad(..), runInteractiveProcess, MVar(..), newEmptyMVar {- $ Bugs -}) where +module CrossPackageDocs (map, Monad(..), runInteractiveProcess) where hunk ./tests/tests/CrossPackageDocs.hs 4 -import GHC.MVar - --- $ Bugs: --- --- * [] a --- --- * No instances list --- --- * No docs on function arguments hunk ./tests/copy.hs 8 +import Text.Regex + hunk ./tests/copy.hs 18 - else + else hunk ./tests/copy.hs 21 + hunk ./tests/copy.hs 24 - print file + print file hunk ./tests/copy.hs 26 - copyFile file ("tests" takeFileName file <.> ".ref") + contents <- readFile file + writeFile new (stripLinks contents) + + +stripLinks f = subRegex (mkRegexWithOpts "]*>" False False) f "" hunk ./tests/tests/Bug3.html.ref 26 ->ContentsContentsIndexIndexfoo :: Intfoo :: Int :: Int :: IntProduced by HaddockProduced by HaddockContentsContentsIndexIndexfoo :: Intfoo :: Int :: Int :: IntProduced by HaddockProduced by HaddockContentsContentsIndexIndex A = A Int A = A Int B = B B = Bb :: Intb :: Int C = C C = Cc1 :: Intc1 :: Intc2 :: Intc2 :: Int D = D Int Int D = D Int Int E = E Int E = E Int Int Int :: Int :: Int :: Int :: Int :: Int :: Int Int Int Int Int Int IntProduced by HaddockProduced by HaddockContentsContentsIndexIndex a (a -> Int) a (a -> Int)Produced by HaddockProduced by HaddockIndexIndexmapmap Monad Monad(>>=)(>>=)(>>)(>>)ContentsContentsIndexIndex H1 H1C1 :: H1C1 :: H1C2 :: Ord a => [a] -> H1C2 :: Ord a => [a] -> H1C3C3field :: Intfield :: Int} -> H1 Int Int} -> H1 Int IntC4C4field2field2} -> H1 Int a} -> H1 Int a :: H1 :: H1 :: Ord a => [a] -> H1 :: Ord a => [a] -> H1 :: Int -> H1 Int Int :: Int -> H1 Int Int :: Int :: Int :: a -> H1 Int a :: a -> H1 Int aProduced by HaddockProduced by HaddockContentsContentsIndexIndexThe The Operations on Operations on The The HashTable HashTablenew :: (Eq key, Hash key) => Int -> IO (HashTablenew :: (Eq key, Hash key) => Int -> IO (HashTableinsert :: (Eq key, Hash key) => key -> val -> IOinsert :: (Eq key, Hash key) => key -> val -> IOlookup :: Hash key => key -> IO (Maybelookup :: Hash key => key -> IO (Maybe Hash Hashhash :: a -> Inthash :: a -> IntEqEq :: (Eq key, Hash key) => Int -> IO (HashTable :: (Eq key, Hash key) => Int -> IO (HashTable :: (Eq key, Hash key) => key -> val -> IO :: (Eq key, Hash key) => key -> val -> IO :: Hash key => key -> IO (Maybe :: Hash key => key -> IO (MaybeJustJustNothingNothing :: a -> Int :: a -> IntIntIntHash FloatHash FloatHash IntHash Int(Hash a, Hash b) => Hash(Hash a, Hash b) => HashProduced by HaddockProduced by HaddockContentsContentsIndexIndexg :: Intg :: Int :: Int :: IntProduced by HaddockProduced by HaddockContentsContentsIndexIndex Integer Integer String String BinOp Expr Expr BinOp Expr Expr String StringData ExprData ExprShow ExprShow ExprTypeable ExprTypeable ExprData BinOpData BinOpShow BinOpShow BinOpTypeable BinOpTypeable BinOp :: Expr -> Integer :: Expr -> Integer :: String :: StringProduced by HaddockProduced by HaddockContentsContentsIndexIndex :: Integer :: IntegerProduced by HaddockProduced by HaddockContentsContentsIndexIndexType declarations +>Type declarations hunk ./tests/tests/Test.html.ref 92 ->Data types +>Data types hunk ./tests/tests/Test.html.ref 96 ->Records +>Records hunk ./tests/tests/Test.html.ref 102 ->Class declarations +>Class declarations hunk ./tests/tests/Test.html.ref 106 ->Function types +>Function types hunk ./tests/tests/Test.html.ref 110 ->Auxiliary stuff +>Auxiliary stuff hunk ./tests/tests/Test.html.ref 114 ->A hidden module +>A hidden module hunk ./tests/tests/Test.html.ref 118 ->A visible module +>A visible module hunk ./tests/tests/Test.html.ref 122 ->Existential / Universal types +>Existential / Universal types hunk ./tests/tests/Test.html.ref 126 ->Type signatures with argument docs +>Type signatures with argument docs hunk ./tests/tests/Test.html.ref 130 ->A section +>A section hunk ./tests/tests/Test.html.ref 136 ->A subsection +>A subsection hunk ./tests/tests/Test.html.ref 159 ->TTffggvisiblevisible T T= A Int (Maybe Float)= A Int (Maybe Float)| B (T a b, T Int Float)| B (T a b, T Int Float) T2 T2 T3 T3= A1= A1| B1| B1 T4 T4= A2= A2| B2| B2 T5 T5= A3= A3| B3| B3 T6 T6= A4= A4| B4| B4| C4| C4 N1 a = N1 N1 a = N1 N2 a b = N2 N2 a b = N2nn N3 a b = N3 N3 a b = N3n3n3 N4 N4 N5 a b = N5 N5 a b = N5n5n5 N6 a b = N6 N6 a b = N6n6n6 N7 a b = N7 N7 a b = N7n7n7 R R= C1= C1p :: Intp :: Intqqr :: Intr :: Ints :: Ints :: Int| C2| C2t :: T1 -> T2 Int Int -> T3 Bool Bool -> T4 Float Float -> T5t :: T1 -> T2 Int Int -> T3 Bool Bool -> T4 Float Float -> T5u :: Intu :: Intv :: Intv :: Int R1 = C3 R1 = C3s1 :: Ints1 :: Ints2 :: Ints2 :: Ints3 :: Ints3 :: Int D a => C D a => Ca :: IOa :: IObb D Dd :: Td :: Tee E E F Ffffff :: C a => a -> Intf :: C a => a -> Intg :: Int -> IOg :: Int -> IOhidden :: Int -> Inthidden :: Int -> Intmodule Visiblemodule Visible Ex Ex b . C b => Ex1 b . C b => Ex1 b . Ex2 b . Ex2 b . C a => Ex3 b . C a => Ex3| Ex4| Ex4k :: T () () -> T2 Int Int -> (T3 Bool Bool -> T4 Float Float) -> T5 () () -> IOk :: T () () -> T2 Int Int -> (T3 Bool Bool -> T4 Float Float) -> T5 () () -> IOl :: (Int, Int, Float) -> Intl :: (Int, Int, Float) -> Intm :: R -> N1 () -> IO Intm :: R -> N1 () -> IO Into :: Float -> IO Floato :: Float -> IO Floatf' :: Intf' :: Int Int (Maybe Float) Int (Maybe Float)AA (T a b, T Int Float) (T a b, T Int Float)BBA3A3B3B3A4A4B4B4C4C4n3n3N7N7RRppqqrrssC1C1 :: Int :: Intppqq :: Int :: Intrrss :: Int :: IntrrssC2C2 :: T1 -> T2 Int Int -> T3 Bool Bool -> T4 Float Float -> T5 :: T1 -> T2 Int Int -> T3 Bool Bool -> T4 Float Float -> T5 :: Int :: Int :: Int :: IntC3C3 :: Int :: Ints1s1 :: Int :: Ints2s2 :: Int :: Ints3s3 D DCC :: IO :: IOaabb :: T :: TD FloatD FloatD IntD Int :: C a => a -> Int :: C a => a -> IntTTFooFooRRWe can also include URLs in documentation: http://www.haskell.org/We can also include URLs in documentation: http://www.haskell.org/ :: Int -> IO :: Int -> IO :: Int -> Int :: Int -> Intmodule Visiblemodule Visible b . C b . C b . C b . C:: T:: TTT-> T2 Int Int-> T2 Int Int-> T3 Bool Bool -> T4 Float Float-> T3 Bool Bool -> T4 Float Float-> T5-> T5-> IO-> IO:: (Int, Int, Float):: (Int, Int, Float)-> Int-> IntIntInt:: R:: R-> N1-> N1-> IO Int-> IO Int:: Float:: Float-> IO Float-> IO Float :: Int :: Intf'f'Produced by HaddockProduced by HaddockContentsContentsIndexIndex G G A A B Bf :: B a Intf :: B a Int F F :: B a Int :: B a IntA IntA IntProduced by HaddockProduced by HaddockContentsContentsIndexIndex :: Int -> Int :: Int -> IntProduced by HaddockProduced by HaddockContentsContentsreturnreturnfail :: Stringfail :: StringrunInteractiveProcess :: FilePath -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> IO (Handle, Handle, Handle, ProcessHandlerunInteractiveProcess :: FilePath -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> IO (Handle, Handle, Handle, ProcessHandledata MVar a = MVar (MVar# RealWorld a)newEmptyMVar :: IO (MVar a)mapmapMonadMonad>>=>>=returnreturnMonadMonadMonadMonadFunctorFunctorMonadMonadPreludePrelude :: String :: StringMonadMonadMonad IOMonad IOMonadMonadMonad MaybeMonad MaybeMonadMonad:: FilePath:: FilePath-> [String-> [String-> Maybe FilePath-> Maybe FilePath-> Maybe [(String, String-> Maybe [(String, String-> IO (Handle, Handle, Handle, ProcessHandle-> IO (Handle, Handle, Handle, ProcessHandleHandleHandleHandleHandlehSetBinaryModehSetBinaryModedata MVar a
An MVar (pronounced "em-var") is a synchronising variable, used -for communication between concurrent threads. It can be thought of -as a a box, which may be empty or full. -
Constructors
MVar (MVar# RealWorld a)
show/hide Instances
newEmptyMVar :: IO (MVar a)Create an MVar which is initially empty. -

Bugs: -

Produced by HaddockProduced by HaddockContentsContentsIndexIndex Foo = Foo Foo = Foo Bar BarBar Foo FooBar Foo FooJust one instance +Bar Foo FooBar Foo FooJust one instance +Produced by HaddockProduced by HaddockContentsContentsIndexIndexProduced by HaddockProduced by HaddockThis document describes Haddock version 2.5.0, a Haskell + This document describes Haddock version 2.6.0, a Haskell hunk ./haddock.cabal 2 -version: 2.5.0 +version: 2.6.0 hunk ./haddock.spec 20 -%define version 2.5.0 +%define version 2.6.0 hunk ./src/Haddock/Backends/Html.hs 812 - DocForDecl DocName -> [InstHead DocName] -> [(DocName, DocForDecl DocName)] -> Bool -> HtmlTable + DocForDecl DocName -> [DocInstance DocName] -> [(DocName, DocForDecl DocName)] -> Bool -> HtmlTable hunk ./src/Haddock/Backends/Html.hs 958 - aboves (map (declBox . ppInstHead unicode) instances) + aboves (map (ppDocInstance unicode) instances) hunk ./src/Haddock/Backends/Html.hs 1153 -ppClassDecl :: Bool -> LinksInfo -> [InstHead DocName] -> SrcSpan +ppClassDecl :: Bool -> LinksInfo -> [DocInstance DocName] -> SrcSpan hunk ./src/Haddock/Backends/Html.hs 1194 - spacedTable1 << ( - aboves (map (declBox . ppInstHead unicode) instances) - )) + spacedTable1 << aboves (map (ppDocInstance unicode) instances) + ) hunk ./src/Haddock/Backends/Html.hs 1199 +-- | Print a possibly commented instance. The instance header is printed inside +-- an 'argBox'. The comment is printed to the right of the box in normal comment +-- style. +ppDocInstance :: Bool -> DocInstance DocName -> HtmlTable +ppDocInstance unicode (_, instHead, maybeDoc) = + argBox (ppInstHead unicode instHead) <-> maybeRDocBox maybeDoc + + hunk ./src/Haddock/Backends/Html.hs 1259 -ppDataDecl :: Bool -> LinksInfo -> [InstHead DocName] -> +ppDataDecl :: Bool -> LinksInfo -> [DocInstance DocName] -> hunk ./src/Haddock/Backends/Html.hs 1313 - spacedTable1 << ( - aboves (map (declBox . ppInstHead unicode) instances) + spacedTable1 << aboves (map (ppDocInstance unicode) instances hunk ./src/Haddock/Backends/Html.hs 1383 - <-> maybeRDocBox mbLDoc + <-> maybeRDocBox mbDoc hunk ./src/Haddock/Backends/Html.hs 1387 - maybeRDocBox mbLDoc + maybeRDocBox mbDoc hunk ./src/Haddock/Backends/Html.hs 1393 - <-> maybeRDocBox mbLDoc + <-> maybeRDocBox mbDoc hunk ./src/Haddock/Backends/Html.hs 1410 - ) <-> maybeRDocBox mbLDoc + ) <-> maybeRDocBox mbDoc hunk ./src/Haddock/Backends/Html.hs 1421 - -- The 'fmap' and 'join' are in Maybe - mbLDoc = fmap noLoc $ join $ fmap fst $ - lookup (unLoc $ con_name con) subdocs + -- 'join' is in Maybe. + mbDoc = join $ fmap fst $ lookup (unLoc $ con_name con) subdocs hunk ./src/Haddock/Backends/Html.hs 1428 - <+> dcolon unicode <+> ppLType unicode ltype) <-> - maybeRDocBox mbLDoc + <+> dcolon unicode <+> ppLType unicode ltype) <-> maybeRDocBox mbDoc hunk ./src/Haddock/Backends/Html.hs 1431 - mbLDoc = fmap noLoc $ join $ fmap fst $ lookup name subdocs + mbDoc = join $ fmap fst $ lookup name subdocs hunk ./src/Haddock/Backends/Html.hs 1770 + hunk ./src/Haddock/Backends/Html.hs 1897 -maybeRDocBox :: Maybe (LHsDoc DocName) -> HtmlTable +maybeRDocBox :: Maybe (HsDoc DocName) -> HtmlTable hunk ./src/Haddock/Backends/Html.hs 1899 -maybeRDocBox (Just ldoc) = rdocBox (docToHtml (unLoc ldoc)) +maybeRDocBox (Just doc) = rdocBox (docToHtml doc) hunk ./src/Haddock/Interface.hs 64 - interfaces' <- attachInstances interfaces + interfaces' <- attachInstances interfaces instIfaceMap hunk ./src/Haddock/Interface/AttachInstances.hs 21 +import Control.Arrow hunk ./src/Haddock/Interface/AttachInstances.hs 23 +import qualified Data.Map as Map hunk ./src/Haddock/Interface/AttachInstances.hs 45 -attachInstances :: [Interface] -> Ghc [Interface] -attachInstances = mapM attach +attachInstances :: [Interface] -> InstIfaceMap -> Ghc [Interface] +attachInstances ifaces instIfaceMap = mapM attach ifaces hunk ./src/Haddock/Interface/AttachInstances.hs 51 + where + attachExport export@ExportDecl{expItemDecl = L _ (TyClD d)} = do + mb_info <- getAllInfo (unLoc (tcdLName d)) + return $ export { expItemInstances = case mb_info of + Just (_, _, instances) -> + let insts = map (first synifyInstHead) $ sortImage (first instHead) + [ (instanceHead i, getName i) | i <- instances ] + in [ (name, inst, lookupInstDoc name iface instIfaceMap) + | (inst, name) <- insts ] + Nothing -> [] + } + attachExport export = return export hunk ./src/Haddock/Interface/AttachInstances.hs 64 - attachExport export@ExportDecl{expItemDecl = L _ (TyClD d)} = do - mb_info <- getAllInfo (unLoc (tcdLName d)) - return $ export { expItemInstances = case mb_info of - Just (_, _, instances) -> - map synifyInstHead . sortImage instHead . map instanceHead $ instances - Nothing -> - [] - } - attachExport export = return export + +lookupInstDoc :: Name -> Interface -> InstIfaceMap -> Maybe (HsDoc Name) +-- TODO: capture this pattern in a function (when we have streamlined the +-- handling of instances) +lookupInstDoc name iface ifaceMap = + case Map.lookup name (ifaceInstanceDocMap iface) of + Just doc -> Just doc + Nothing -> do -- in Maybe + instIface <- Map.lookup modName ifaceMap + (Just doc, _) <- Map.lookup name (instDocMap instIface) + return doc + where + modName = nameModule name hunk ./src/Haddock/Interface/AttachInstances.hs 84 + hunk ./src/Haddock/Interface/Create.hs 59 - let decls = filterOutInstances decls0 + + let instances = ghcInstances ghcMod + localInsts = filter (nameIsLocalOrFrom mdl . getName) instances + declDocs = [ (decl, doc) | (L _ decl, (Just doc, _), _) <- decls0 ] + instanceDocMap = mkInstanceDocMap localInsts declDocs + + decls = filterOutInstances decls0 hunk ./src/Haddock/Interface/Create.hs 71 - instances = ghcInstances ghcMod hunk ./src/Haddock/Interface/Create.hs 101 - ifaceInstances = ghcInstances ghcMod + ifaceInstances = instances, + ifaceInstanceDocMap = instanceDocMap hunk ./src/Haddock/Interface/Create.hs 137 + +mkInstanceDocMap :: [Instance] -> [(HsDecl name, doc)] -> Map Name doc +mkInstanceDocMap instances decls = + -- We relate Instances to InstDecls using the SrcSpans buried inside them. + -- That should work for normal user-written instances (from looking at GHC + -- sources). We can assume that commented instances are user-written. + -- This lets us relate Names (from Instances) to comments (associated + -- with InstDecls). + let docMap = Map.fromList [ (loc, doc) + | (InstD (InstDecl (L loc _) _ _ _), doc) <- decls ] + + in Map.fromList [ (name, doc) | inst <- instances + , let name = getName inst + , Just doc <- [ Map.lookup (getSrcSpan name) docMap ] ] + + hunk ./src/Haddock/Interface/Create.hs 162 --- Make a map from names to 'DeclInfo's. Exclude declarations that don't --- have names (instances and stand-alone documentation comments). Include +-- Make a map from names to 'DeclInfo's. Exclude declarations that don't have +-- names (e.g. instances and stand-alone documentation comments). Include hunk ./src/Haddock/Interface/Create.hs 168 - | (parent@(L _ d), doc, subs) <- decls + | (parent@(L _ d), doc, subs) <- decls hunk ./src/Haddock/Interface/Rename.hs 40 - docMap = Map.map (\(_,x,_) -> x) (ifaceDeclMap iface) - docs = Map.toList docMap + docMap = Map.map (\(_,x,_) -> x) (ifaceDeclMap iface) + + -- make instance docs into 'docForDecls' + instDocs = [ (name, (Just doc, Map.empty)) + | (name, doc) <- Map.toList (ifaceInstanceDocMap iface) ] + + docs = Map.toList docMap ++ instDocs hunk ./src/Haddock/Interface/Rename.hs 456 - instances' <- mapM renameInstHead instances + instances' <- forM instances $ \(name, inst, idoc) -> do + name' <- rename name + inst' <- renameInstHead inst + idoc' <- mapM renameDoc idoc + return (name', inst', idoc') hunk ./src/Haddock/Types.hs 43 +type DocInstance name = (name, InstHead name, Maybe (HsDoc name)) + hunk ./src/Haddock/Types.hs 103 - -- | Instances relevant to this declaration - expItemInstances :: [InstHead name] + -- | Instances relevant to this declaration, possibly with documentation + expItemInstances :: [DocInstance name] hunk ./src/Haddock/Types.hs 136 +-- | The head of an instance. Consists of a context, a class name and a list of +-- instance types. hunk ./src/Haddock/Types.hs 139 + + hunk ./src/Haddock/Types.hs 224 - ifaceInstances :: ![Instance] + ifaceInstances :: ![Instance], + + -- | Docs for instances defined in this module + ifaceInstanceDocMap :: Map Name (HsDoc Name) hunk ./src/Main.hs 377 - throwE "Unicode can only be enabled for HTML output." + throwE "Unicode can only be enabled for HTML output." hunk ./src/Haddock/Interface/Create.hs 78 - + hunk ./src/Haddock/Interface/Create.hs 81 - let + let hunk ./src/Haddock/Interface/Create.hs 85 - + hunk ./src/Haddock/Interface/Create.hs 98 - ifaceVisibleExports = visibleNames, + ifaceVisibleExports = visibleNames, hunk ./src/Haddock/Interface/Create.hs 115 - opts <- case mbOpts of + opts <- case mbOpts of hunk ./src/Haddock/Interface/Create.hs 120 - if Flag_HideModule (moduleString mdl) `elem` flags + if Flag_HideModule (moduleString mdl) `elem` flags hunk ./src/Haddock/Interface/Create.hs 164 --- subordinate names, but map them to their parent declarations. +-- subordinate names, but map them to their parent declarations. hunk ./src/Haddock/Interface/Create.hs 221 - dataSubs = constrs ++ fields + dataSubs = constrs ++ fields hunk ./src/Haddock/Interface/Create.hs 236 --- source location, with documentation attached if it exists. +-- source location, with documentation attached if it exists. hunk ./src/Haddock/Interface/Create.hs 243 - where + where hunk ./src/Haddock/Interface/Create.hs 258 --- | The top-level declarations of a module that we care about, +-- | The top-level declarations of a module that we care about, hunk ./src/Haddock/Interface/Create.hs 260 -topDecls :: HsGroup Name -> [(Decl, MaybeDocStrings)] +topDecls :: HsGroup Name -> [(Decl, MaybeDocStrings)] hunk ./src/Haddock/Interface/Create.hs 271 -declsFromGroup group_ = +declsFromGroup group_ = hunk ./src/Haddock/Interface/Create.hs 339 -filterClasses decls = [ if isClassD d then (L loc (filterClass d), doc) else x +filterClasses decls = [ if isClassD d then (L loc (filterClass d), doc) else x hunk ./src/Haddock/Interface/Create.hs 343 - TyClD $ c { tcdSigs = filter isVanillaLSig $ tcdSigs c } + TyClD $ c { tcdSigs = filter isVanillaLSig $ tcdSigs c } hunk ./src/Haddock/Interface/Create.hs 351 --- we sort the declarations by their SrcLoc and "collect" the docs for each +-- we sort the declarations by their SrcLoc and "collect" the docs for each hunk ./src/Haddock/Interface/Create.hs 426 - -> Module -- this module + -> Module -- this module hunk ./src/Haddock/Interface/Create.hs 428 - -> [Name] -- exported names (orig) + -> [Name] -- exported names (orig) hunk ./src/Haddock/Interface/Create.hs 430 - -> Map Name DeclInfo -- maps local names to declarations + -> Map Name DeclInfo -- maps local names to declarations hunk ./src/Haddock/Interface/Create.hs 433 - -> Bool -- --ignore-all-exports flag + -> Bool -- --ignore-all-exports flag hunk ./src/Haddock/Interface/Create.hs 445 --- creating export items for intsances (unfinished experiment) --- instances = [ d | d@(L _ decl, _, _) <- decls, isInstD decl ] hunk ./src/Haddock/Interface/Create.hs 448 - + hunk ./src/Haddock/Interface/Create.hs 452 - -- | Just fam <- Map.lookup t famMap = absFam fam - -- | otherwise = declWith t - -- where - -- absFam (Just (famDecl, doc), instances) = return $ [ ExportDecl famDecl doc [] ] ++ matchingInsts t - -- absFam (Nothing, instances) = - hunk ./src/Haddock/Interface/Create.hs 467 + hunk ./src/Haddock/Interface/Create.hs 473 + hunk ./src/Haddock/Interface/Create.hs 609 + hunk ./src/Haddock/Interface/Create.hs 618 + hunk ./src/Haddock/Interface/Create.hs 621 + hunk ./src/Haddock/Interface/Create.hs 623 - | m == this_mod = liftErrMsg $ fullContentsOfThisModule gre decls - | otherwise = - case Map.lookup m modMap of - Just iface - | OptHide `elem` ifaceOptions iface - -> return (ifaceExportItems iface) - | otherwise -> return [ ExportModule m ] - - Nothing -> -- we have to try to find it in the installed interfaces - -- (external packages) - case Map.lookup modname (Map.mapKeys moduleName instIfaceMap) of - Just iface -> return [ ExportModule (instMod iface) ] - Nothing -> do - liftErrMsg $ - tell ["Warning: " ++ pretty this_mod ++ ": Could not find " ++ - "documentation for exported module: " ++ pretty modname] - return [] + | m == this_mod = liftErrMsg $ fullContentsOfThisModule gre decls + | otherwise = + case Map.lookup m modMap of + Just iface + | OptHide `elem` ifaceOptions iface -> return (ifaceExportItems iface) + | otherwise -> return [ ExportModule m ] + + Nothing -> -- we have to try to find it in the installed interfaces + -- (external packages) + case Map.lookup modname (Map.mapKeys moduleName instIfaceMap) of + Just iface -> return [ ExportModule (instMod iface) ] + Nothing -> do + liftErrMsg $ + tell ["Warning: " ++ pretty this_mod ++ ": Could not find " ++ + "documentation for exported module: " ++ pretty modname] + return [] hunk ./src/Haddock/Interface/Create.hs 643 - + hunk ./src/Haddock/Interface/Create.hs 645 - findDecl n + findDecl n hunk ./src/Haddock/Interface/Create.hs 648 - Just iface -> Map.lookup n (ifaceDeclMap iface) + Just iface -> Map.lookup n (ifaceDeclMap iface) hunk ./src/Haddock/Interface/Create.hs 685 --- cases we have to extract the required declaration (and somehow cobble +-- cases we have to extract the required declaration (and somehow cobble hunk ./src/Haddock/Interface/Create.hs 690 - | otherwise = + | otherwise = hunk ./src/Haddock/Interface/Create.hs 692 - TyClD d | isClassDecl d -> + TyClD d | isClassDecl d -> hunk ./src/Haddock/Interface/Create.hs 695 --- let assocMathes = [ tyDecl | at <- tcdATs d, ] - in case matches of + in case matches of hunk ./src/Haddock/Interface/Create.hs 699 - _ -> error "internal: extractDecl" - TyClD d | isDataDecl d -> + _ -> error "internal: extractDecl" + TyClD d | isDataDecl d -> hunk ./src/Haddock/Interface/Create.hs 715 - L _ (HsForAllTy expl tvs (L _ preds) ty) -> + L _ (HsForAllTy expl tvs (L _ preds) ty) -> hunk ./src/Haddock/Interface/Create.hs 720 - ctxt preds = noLoc (HsClassP c (map toTypeNoLoc tvs0)) : preds + ctxt preds = noLoc (HsClassP c (map toTypeNoLoc tvs0)) : preds hunk ./src/Haddock/Interface/Create.hs 730 - RecCon fields | (ConDeclField n ty _ : _) <- matching_fields fields -> + RecCon fields | (ConDeclField n ty _ : _) <- matching_fields fields -> hunk ./src/Haddock/Interface/Create.hs 733 - where - matching_fields flds = [ f | f@(ConDeclField n _ _) <- flds, unLoc n == nm ] + where + matching_fields flds = [ f | f@(ConDeclField n _ _) <- flds, unLoc n == nm ] hunk ./src/Haddock/Interface/Create.hs 741 - where hasDoc (ExportDecl{expItemMbDoc = (d, _)}) = isJust d - hasDoc _ = True + where + hasDoc (ExportDecl{expItemMbDoc = (d, _)}) = isJust d + hasDoc _ = True hunk ./src/Haddock/Interface/Create.hs 755 - where subs = map fst (expItemSubDocs e) + where subs = map fst (expItemSubDocs e) hunk ./src/Haddock/Interface/Create.hs 768 - search ((DocD (DocCommentNamed name' doc)):rest) + search ((DocD (DocCommentNamed name' doc)):rest) hunk ./src/Haddock/Types.hs 91 - = ExportDecl { - + = ExportDecl { + hunk ./src/Haddock/Types.hs 94 - expItemDecl :: LHsDecl name, - + expItemDecl :: LHsDecl name, + hunk ./src/Haddock/Types.hs 105 - - } -- ^ An exported declaration - + + } -- ^ An exported declaration + hunk ./src/Haddock/Types.hs 114 - } -- ^ An exported entity for which we have no - -- documentation (perhaps because it resides in - -- another package) + } -- ^ An exported entity for which we have no + -- documentation (perhaps because it resides in + -- another package) hunk ./src/Haddock/Types.hs 118 - | ExportGroup { + | ExportGroup { hunk ./src/Haddock/Types.hs 124 - expItemSectionId :: String, - + expItemSectionId :: String, + hunk ./src/Haddock/Types.hs 152 --- | This structure holds the module information we get from GHC's +-- | This structure holds the module information we get from GHC's hunk ./src/Haddock/Types.hs 169 --- is the "interface" of the module. The core of Haddock lies in creating this +-- is the "interface" of the module. The core of Haddock lies in creating this hunk ./src/Haddock/Types.hs 180 - -- | Textual information about the module + -- | Textual information about the module hunk ./src/Haddock/Types.hs 238 - -- | Textual information about the module + -- | Textual information about the module hunk ./src/Haddock/Interface.hs 69 - let (interfaces'', msgs) = + let (interfaces'', msgs) = hunk ./src/Haddock/Interface.hs 73 - return (interfaces'', homeLinks) + return (interfaces'', homeLinks) hunk ./src/Haddock/Interface.hs 140 -type FullyCheckedMod = (ParsedSource, - RenamedSource, - TypecheckedSource, +type FullyCheckedMod = (ParsedSource, + RenamedSource, + TypecheckedSource, hunk ./src/Haddock/Interface.hs 147 -mkGhcModule :: CheckedMod -> DynFlags -> GhcModule +mkGhcModule :: CheckedMod -> DynFlags -> GhcModule hunk ./src/Haddock/Interface.hs 157 - ghcNamesInScope = fromJust $ modInfoTopLevelScope modInfo, + ghcNamesInScope = fromJust $ modInfoTopLevelScope modInfo, hunk ./src/Haddock/Interface.hs 176 --- +-- hunk ./src/Haddock/Backends/Html.hs 1203 -ppDocInstance unicode (_, instHead, maybeDoc) = +ppDocInstance unicode (instHead, maybeDoc) = hunk ./src/Haddock/Interface/AttachInstances.hs 58 - in [ (name, inst, lookupInstDoc name iface instIfaceMap) + in [ (inst, lookupInstDoc name iface instIfaceMap) hunk ./src/Haddock/Interface/Rename.hs 456 - instances' <- forM instances $ \(name, inst, idoc) -> do - name' <- rename name + instances' <- forM instances $ \(inst, idoc) -> do hunk ./src/Haddock/Interface/Rename.hs 459 - return (name', inst', idoc') + return (inst', idoc') hunk ./src/Haddock/Types.hs 43 -type DocInstance name = (name, InstHead name, Maybe (HsDoc name)) +type DocInstance name = (InstHead name, Maybe (HsDoc name)) hunk ./haddock.cabal 75 - ghc >= 6.10 && < 6.14 + ghc >= 6.12 && < 6.14 hunk ./haddock.cabal 119 - -- Cabal doesn't define __GHC_PATCHLEVEL__ - if impl(ghc == 6.10.1) - cpp-options: -D__GHC_PATCHLEVEL__=1 - if impl(ghc == 6.10.2) - cpp-options: -D__GHC_PATCHLEVEL__=2 - if impl(ghc == 6.10.3) - cpp-options: -D__GHC_PATCHLEVEL__=3 - if impl(ghc == 6.10.4) - cpp-options: -D__GHC_PATCHLEVEL__=4 - hunk ./haddock.cabal 130 - -- Cabal doesn't define __GHC_PATCHLEVEL__ - if impl(ghc == 6.10.1) - cpp-options: -D__GHC_PATCHLEVEL__=1 - if impl(ghc == 6.10.2) - cpp-options: -D__GHC_PATCHLEVEL__=2 - if impl(ghc == 6.10.3) - cpp-options: -D__GHC_PATCHLEVEL__=3 - if impl(ghc == 6.10.4) - cpp-options: -D__GHC_PATCHLEVEL__=4 - hunk ./haddock.cabal 132 - hunk ./src/Haddock/Backends/Html.hs 1609 -#endif + hunk ./src/Haddock/Convert.hs 183 -#if __GLASGOW_HASKELL__ >= 611 hunk ./src/Haddock/Convert.hs 184 -#endif hunk ./src/Haddock/GhcUtils.hs 25 -#if __GLASGOW_HASKELL__ >= 611 hunk ./src/Haddock/GhcUtils.hs 27 -#endif hunk ./src/Haddock/GhcUtils.hs 54 -#if __GLASGOW_HASKELL__ >= 611 + hunk ./src/Haddock/GhcUtils.hs 66 -#endif + hunk ./src/Haddock/HsDoc.hs 6 -#if __GLASGOW_HASKELL__ <= 610 - -import HsDoc -- just re-export - -#else hunk ./src/Haddock/HsDoc.hs 8 - hunk ./src/Haddock/HsDoc.hs 65 - -#endif - hunk ./src/Haddock/Interface.hs 82 -#if (__GLASGOW_HASKELL__ == 610 && __GHC_PATCHLEVEL__ >= 2) || __GLASGOW_HASKELL__ >= 611 hunk ./src/Haddock/Interface.hs 85 -#if __GLASGOW_HASKELL__ < 611 - let needsTemplateHaskell = any (dopt Opt_TemplateHaskell . ms_hspp_opts) -#endif hunk ./src/Haddock/Interface.hs 93 -#else - let modgraph' = modgraph -#endif hunk ./src/Haddock/Interface.hs 155 -#if __GLASGOW_HASKELL__ >= 611 hunk ./src/Haddock/Interface.hs 156 -#else - (group_, _, mbExports, mbDoc, info) = renamed - mbDocHdr = (info, mbDoc) -#endif hunk ./src/Haddock/Interface/AttachInstances.hs 31 - -#if __GLASGOW_HASKELL__ > 610 || (__GLASGOW_HASKELL__ == 610 && __GHC_PATCHLEVEL__ >= 2) hunk ./src/Haddock/Interface/AttachInstances.hs 32 -#else -import TypeRep -#endif - hunk ./src/Haddock/Interface/LexParseRn.hs 22 - -import Data.Maybe - -#if __GLASGOW_HASKELL__ >= 611 hunk ./src/Haddock/Interface/LexParseRn.hs 27 +import Data.Maybe hunk ./src/Haddock/Interface/LexParseRn.hs 29 -#endif - hunk ./src/Haddock/Interface/LexParseRn.hs 45 -#if __GLASGOW_HASKELL__ >= 611 hunk ./src/Haddock/Interface/LexParseRn.hs 56 -#else -lexParseRnHaddockComment _ _ doc = return (Just doc) -#endif hunk ./src/Haddock/Interface/LexParseRn.hs 63 -#if __GLASGOW_HASKELL__ >= 611 hunk ./src/Haddock/Interface/LexParseRn.hs 75 -#else -lexParseRnHaddockModHeader _ hdr = return hdr -#endif - hunk ./src/Haddock/Interface/Rename.hs 159 -#if __GLASGOW_HASKELL__ >= 611 + hunk ./src/Haddock/Interface/Rename.hs 162 -#else -renameLDocHsSyn :: LHsDoc Name -> RnM (LHsDoc DocName) -renameLDocHsSyn = renameLDoc - --- This is inside the #if to avoid a defined-but-not-used warning. -renameLDoc :: LHsDoc Name -> RnM (LHsDoc DocName) -renameLDoc = mapM renameDoc -#endif hunk ./src/Haddock/Interface/Rename.hs 331 -#if __GLASGOW_HASKELL__ >= 611 hunk ./src/Haddock/Interface/Rename.hs 334 -#else - ForeignType lname a b -> do - lname' <- renameL lname - return (ForeignType lname' a b) -#endif hunk ./src/Haddock/InterfaceFile.hs 57 -#if __GLASGOW_HASKELL__ == 610 -binaryInterfaceVersion = 14 -#elif __GLASGOW_HASKELL__ == 611 -binaryInterfaceVersion = 15 -#elif __GLASGOW_HASKELL__ == 612 +#if __GLASGOW_HASKELL__ == 612 hunk ./src/Haddock/Types.hs 2 -{-# LANGUAGE DeriveDataTypeable #-} +{-# LANGUAGE DeriveDataTypeable, DeriveFunctor #-} hunk ./src/Haddock/Types.hs 20 --- avoid duplicate-export warnings, use the conditional to only --- mention things not defined in this module: -#if __GLASGOW_HASKELL__ >= 611 hunk ./src/Haddock/Types.hs 21 -#else - , HsDoc(..), LHsDoc, HaddockModInfo(..), emptyHaddockModInfo -#endif hunk ./src/Haddock/Types.hs 39 -#if __GLASGOW_HASKELL__ <= 610 -type HsDocString = HsDoc Name -type LHsDocString = Located HsDocString -#endif hunk ./src/Haddock/Types.hs 136 -#if __GLASGOW_HASKELL__ >= 611 + hunk ./src/Haddock/Types.hs 138 -#else -type GhcDocHdr = (HaddockModInfo Name, Maybe (HsDoc Name)) -#endif + hunk ./src/Haddock/Types.hs 267 -unrenameHsDoc = fmapHsDoc getName +unrenameHsDoc = fmap getName hunk ./src/Haddock/Types.hs 272 -#if __GLASGOW_HASKELL__ >= 611 + hunk ./src/Haddock/Types.hs 289 - deriving (Eq, Show) + deriving (Eq, Show, Functor) + hunk ./src/Haddock/Types.hs 293 -#endif + hunk ./src/Haddock/Types.hs 313 -#if __GLASGOW_HASKELL__ >= 611 + hunk ./src/Haddock/Types.hs 321 + hunk ./src/Haddock/Types.hs 329 -#endif hunk ./src/Haddock/Types.hs 387 - --- When HsDoc syntax is part of the Haddock codebase, we'll just --- declare a Functor instance. -fmapHsDoc :: (a->b) -> HsDoc a -> HsDoc b -fmapHsDoc _ DocEmpty = DocEmpty -fmapHsDoc f (DocAppend a b) = DocAppend (fmapHsDoc f a) (fmapHsDoc f b) -fmapHsDoc _ (DocString s) = DocString s -fmapHsDoc _ (DocModule s) = DocModule s -fmapHsDoc _ (DocURL s) = DocURL s -fmapHsDoc _ (DocPic s) = DocPic s -fmapHsDoc _ (DocAName s) = DocAName s -fmapHsDoc f (DocParagraph a) = DocParagraph (fmapHsDoc f a) -fmapHsDoc f (DocEmphasis a) = DocEmphasis (fmapHsDoc f a) -fmapHsDoc f (DocMonospaced a) = DocMonospaced (fmapHsDoc f a) -fmapHsDoc f (DocCodeBlock a) = DocMonospaced (fmapHsDoc f a) -fmapHsDoc f (DocIdentifier a) = DocIdentifier (map f a) -fmapHsDoc f (DocOrderedList a) = DocOrderedList (map (fmapHsDoc f) a) -fmapHsDoc f (DocUnorderedList a) = DocUnorderedList (map (fmapHsDoc f) a) -fmapHsDoc f (DocDefList a) = DocDefList (map (\(b,c)->(fmapHsDoc f b, fmapHsDoc f c)) a) - hunk ./src/Haddock/Convert.hs 2 - --- This functionality may be moved into GHC at some point, and then --- we can use the GHC version (#if GHC version is new enough). +----------------------------------------------------------------------------- +-- | +-- Module : Haddock.Convert +-- Copyright : (c) Isaac Dupree 2009, +-- License : BSD-like +-- +-- Maintainer : haddock@projects.haskell.org +-- Stability : experimental +-- Portability : portable +-- +-- Conversion between TyThing and HsDecl. This functionality may be moved into +-- GHC at some point. +----------------------------------------------------------------------------- hunk ./haddock.cabal 100 - Haddock.Utils.FastMutInt2 hunk ./src/Haddock/Utils/FastMutInt2.hs 1 -{-# OPTIONS_GHC -cpp -fglasgow-exts #-} --- --- (c) The University of Glasgow 2002 --- --- Unboxed mutable Ints - -module Haddock.Utils.FastMutInt2( - FastMutInt, newFastMutInt, - readFastMutInt, writeFastMutInt, - incFastMutInt, incFastMutIntBy - ) where - -#include "MachDeps.h" - -#ifndef SIZEOF_HSINT -#define SIZEOF_HSINT INT_SIZE_IN_BYTES -#endif - - -#if __GLASGOW_HASKELL__ < 503 -import GlaExts -import PrelIOBase -#else -import GHC.Base -#endif - -#if __GLASGOW_HASKELL__ < 411 -newByteArray# = newCharArray# -#endif - -#ifdef __GLASGOW_HASKELL__ -data FastMutInt = FastMutInt (MutableByteArray# RealWorld) - -newFastMutInt :: IO FastMutInt -newFastMutInt = IO $ \s0 -> - case newByteArray# size s0 of { (# s, arr #) -> - (# s, FastMutInt arr #) } - where !(I# size) = SIZEOF_HSINT - -readFastMutInt :: FastMutInt -> IO Int -readFastMutInt (FastMutInt arr) = IO $ \s0 -> - case readIntArray# arr 0# s0 of { (# s, i #) -> - (# s, I# i #) } - -writeFastMutInt :: FastMutInt -> Int -> IO () -writeFastMutInt (FastMutInt arr) (I# i) = IO $ \s0 -> - case writeIntArray# arr 0# i s0 of { s -> - (# s, () #) } - -incFastMutInt :: FastMutInt -> IO Int -- Returns original value -incFastMutInt (FastMutInt arr) = IO $ \s0 -> - case readIntArray# arr 0# s0 of { (# s1, i #) -> - case writeIntArray# arr 0# (i +# 1#) s1 of { s -> - (# s, I# i #) } } - -incFastMutIntBy :: FastMutInt -> Int -> IO Int -- Returns original value -incFastMutIntBy (FastMutInt arr) (I# n) = IO $ \s0 -> - case readIntArray# arr 0# s0 of { (# s1, i #) -> - case writeIntArray# arr 0# (i +# n) s1 of { s -> - (# s, I# i #) } } -#endif - rmfile ./src/Haddock/Utils/FastMutInt2.hs move ./src/Distribution ./src/Documentation hunk ./haddock.cabal 122 - exposed-modules: Distribution.Haddock + exposed-modules: + Documentation.Haddock + hunk ./src/Documentation/Haddock.hs 8 -module Distribution.Haddock ( +module Documentation.Haddock ( hunk ./src/Documentation/Haddock.hs 23 - hunk ./src/Main.hs 274 - putStrLn (" " ++ show err) + putStrLn (" " ++ err) hunk ./haddock.cabal 66 +flag test + default: False + manual: True + hunk ./haddock.cabal 87 + if flag(test) + cpp-options: -DTEST + build-depends: QuickCheck + hunk ./haddock.cabal 89 - build-depends: QuickCheck + build-depends: QuickCheck >= 2.1 && < 3 hunk ./src/Haddock/Types.hs 32 +#ifdef TEST +import Test.QuickCheck +#endif hunk ./src/Haddock/Types.hs 295 +#ifdef TEST +-- TODO: use derive +instance Arbitrary a => Arbitrary (HsDoc a) where + arbitrary = + oneof [ return DocEmpty + , do { a <- arbitrary; b <- arbitrary; return (DocAppend a b) } + , fmap DocString arbitrary + , fmap DocParagraph arbitrary + , fmap DocIdentifier arbitrary + , fmap DocModule arbitrary + , fmap DocEmphasis arbitrary + , fmap DocMonospaced arbitrary + , fmap DocUnorderedList arbitrary + , fmap DocOrderedList arbitrary + , fmap DocDefList arbitrary + , fmap DocCodeBlock arbitrary + , fmap DocURL arbitrary + , fmap DocPic arbitrary + , fmap DocAName arbitrary ] +#endif + + move ./src/Haddock/HsDoc.hs ./src/Haddock/Doc.hs hunk ./haddock.cabal 119 - Haddock.HsDoc + Haddock.Doc hunk ./src/Haddock/Backends/Hoogle.hs 38 -ppHoogle :: String -> String -> String -> Maybe (HsDoc RdrName) -> [Interface] -> FilePath -> IO () +ppHoogle :: String -> String -> String -> Maybe (Doc RdrName) -> [Interface] -> FilePath -> IO () hunk ./src/Haddock/Backends/Hoogle.hs 171 -lookupCon :: [(Name, DocForDecl Name)] -> Located Name -> Maybe (HsDoc Name) +lookupCon :: [(Name, DocForDecl Name)] -> Located Name -> Maybe (Doc Name) hunk ./src/Haddock/Backends/Hoogle.hs 201 -doc :: Outputable o => Maybe (HsDoc o) -> [String] +doc :: Outputable o => Maybe (Doc o) -> [String] hunk ./src/Haddock/Backends/Hoogle.hs 205 -docWith :: Outputable o => String -> Maybe (HsDoc o) -> [String] +docWith :: Outputable o => String -> Maybe (Doc o) -> [String] hunk ./src/Haddock/Backends/Html.hs 66 - -> Maybe (HsDoc GHC.RdrName) -- prologue text, maybe + -> Maybe (Doc GHC.RdrName) -- prologue text, maybe hunk ./src/Haddock/Backends/Html.hs 309 - -> [InstalledInterface] -> Bool -> Maybe (HsDoc GHC.RdrName) + -> [InstalledInterface] -> Bool -> Maybe (Doc GHC.RdrName) hunk ./src/Haddock/Backends/Html.hs 344 -ppPrologue :: String -> Maybe (HsDoc GHC.RdrName) -> HtmlTable +ppPrologue :: String -> Maybe (Doc GHC.RdrName) -> HtmlTable hunk ./src/Haddock/Backends/Html.hs 803 -declWithDoc :: Bool -> LinksInfo -> SrcSpan -> DocName -> Maybe (HsDoc DocName) -> Html -> HtmlTable +declWithDoc :: Bool -> LinksInfo -> SrcSpan -> DocName -> Maybe (Doc DocName) -> Html -> HtmlTable hunk ./src/Haddock/Backends/Html.hs 931 -ppTyFam :: Bool -> Bool -> LinksInfo -> SrcSpan -> Maybe (HsDoc DocName) -> +ppTyFam :: Bool -> Bool -> LinksInfo -> SrcSpan -> Maybe (Doc DocName) -> hunk ./src/Haddock/Backends/Html.hs 988 -ppTyInst :: Bool -> Bool -> LinksInfo -> SrcSpan -> Maybe (HsDoc DocName) -> +ppTyInst :: Bool -> Bool -> LinksInfo -> SrcSpan -> Maybe (Doc DocName) -> hunk ./src/Haddock/Backends/Html.hs 1154 - -> Maybe (HsDoc DocName) -> [(DocName, DocForDecl DocName)] + -> Maybe (Doc DocName) -> [(DocName, DocForDecl DocName)] hunk ./src/Haddock/Backends/Html.hs 1261 - SrcSpan -> Maybe (HsDoc DocName) -> TyClDecl DocName -> Bool -> HtmlTable + SrcSpan -> Maybe (Doc DocName) -> TyClDecl DocName -> Bool -> HtmlTable hunk ./src/Haddock/Backends/Html.hs 1741 -docToHtml :: HsDoc DocName -> Html +docToHtml :: Doc DocName -> Html hunk ./src/Haddock/Backends/Html.hs 1744 -origDocToHtml :: HsDoc Name -> Html +origDocToHtml :: Doc Name -> Html hunk ./src/Haddock/Backends/Html.hs 1747 -rdrDocToHtml :: HsDoc RdrName -> Html +rdrDocToHtml :: Doc RdrName -> Html hunk ./src/Haddock/Backends/Html.hs 1755 -unParagraph :: HsDoc a -> HsDoc a +unParagraph :: Doc a -> Doc a hunk ./src/Haddock/Backends/Html.hs 1761 -htmlCleanup :: DocMarkup a (HsDoc a) +htmlCleanup :: DocMarkup a (Doc a) hunk ./src/Haddock/Backends/Html.hs 1897 -maybeRDocBox :: Maybe (HsDoc DocName) -> HtmlTable +maybeRDocBox :: Maybe (Doc DocName) -> HtmlTable hunk ./src/Haddock/Doc.hs 1 -module Haddock.HsDoc ( +module Haddock.Doc ( hunk ./src/Haddock/Doc.hs 12 -docAppend :: HsDoc id -> HsDoc id -> HsDoc id +docAppend :: Doc id -> Doc id -> Doc id hunk ./src/Haddock/Doc.hs 32 -docParagraph :: HsDoc id -> HsDoc id +docParagraph :: Doc id -> Doc id hunk ./src/Haddock/Doc.hs 59 -docCodeBlock :: HsDoc id -> HsDoc id +docCodeBlock :: Doc id -> Doc id hunk ./src/Haddock/Interface/AttachInstances.hs 59 -lookupInstDoc :: Name -> Interface -> InstIfaceMap -> Maybe (HsDoc Name) +lookupInstDoc :: Name -> Interface -> InstIfaceMap -> Maybe (Doc Name) hunk ./src/Haddock/Interface/LexParseRn.hs 26 -import Haddock.HsDoc +import Haddock.Doc hunk ./src/Haddock/Interface/LexParseRn.hs 34 -lexParseRnHaddockCommentList :: HaddockCommentType -> GlobalRdrEnv -> [HsDocString] -> ErrMsgM (Maybe (HsDoc Name)) +lexParseRnHaddockCommentList :: HaddockCommentType -> GlobalRdrEnv -> [HsDocString] -> ErrMsgM (Maybe (Doc Name)) hunk ./src/Haddock/Interface/LexParseRn.hs 44 - GlobalRdrEnv -> HsDocString -> ErrMsgM (Maybe (HsDoc Name)) + GlobalRdrEnv -> HsDocString -> ErrMsgM (Maybe (Doc Name)) hunk ./src/Haddock/Interface/LexParseRn.hs 55 - Just doc -> return (Just (rnHsDoc gre doc)) + Just doc -> return (Just (rnDoc gre doc)) hunk ./src/Haddock/Interface/LexParseRn.hs 57 -lexParseRnMbHaddockComment :: HaddockCommentType -> GlobalRdrEnv -> Maybe HsDocString -> ErrMsgM (Maybe (HsDoc Name)) +lexParseRnMbHaddockComment :: HaddockCommentType -> GlobalRdrEnv -> Maybe HsDocString -> ErrMsgM (Maybe (Doc Name)) hunk ./src/Haddock/Interface/LexParseRn.hs 62 -lexParseRnHaddockModHeader :: GlobalRdrEnv -> GhcDocHdr -> ErrMsgM (HaddockModInfo Name, Maybe (HsDoc Name)) +lexParseRnHaddockModHeader :: GlobalRdrEnv -> GhcDocHdr -> ErrMsgM (HaddockModInfo Name, Maybe (Doc Name)) hunk ./src/Haddock/Interface/LexParseRn.hs 74 - return (rnHaddockModInfo gre info, Just (rnHsDoc gre doc)) + return (rnHaddockModInfo gre info, Just (rnDoc gre doc)) hunk ./src/Haddock/Interface/Parse.y 15 -import Haddock.Types (HsDoc(..)) -import Haddock.HsDoc +import Haddock.Types (Doc(..)) +import Haddock.Doc hunk ./src/Haddock/Interface/Parse.y 48 -doc :: { HsDoc RdrName } +doc :: { Doc RdrName } hunk ./src/Haddock/Interface/Parse.y 54 -apara :: { HsDoc RdrName } +apara :: { Doc RdrName } hunk ./src/Haddock/Interface/Parse.y 60 -ulpara :: { HsDoc RdrName } +ulpara :: { Doc RdrName } hunk ./src/Haddock/Interface/Parse.y 63 -olpara :: { HsDoc RdrName } +olpara :: { Doc RdrName } hunk ./src/Haddock/Interface/Parse.y 66 -defpara :: { (HsDoc RdrName, HsDoc RdrName) } +defpara :: { (Doc RdrName, Doc RdrName) } hunk ./src/Haddock/Interface/Parse.y 69 -para :: { HsDoc RdrName } +para :: { Doc RdrName } hunk ./src/Haddock/Interface/Parse.y 73 -codepara :: { HsDoc RdrName } +codepara :: { Doc RdrName } hunk ./src/Haddock/Interface/Parse.y 77 -seq :: { HsDoc RdrName } +seq :: { Doc RdrName } hunk ./src/Haddock/Interface/Parse.y 81 -elem :: { HsDoc RdrName } +elem :: { Doc RdrName } hunk ./src/Haddock/Interface/Parse.y 85 -seq1 :: { HsDoc RdrName } +seq1 :: { Doc RdrName } hunk ./src/Haddock/Interface/Parse.y 90 -elem1 :: { HsDoc RdrName } +elem1 :: { Doc RdrName } hunk ./src/Haddock/Interface/ParseModuleHeader.hs 29 -parseModuleHeader :: String -> Either String (HaddockModInfo RdrName, HsDoc RdrName) +parseModuleHeader :: String -> Either String (HaddockModInfo RdrName, Doc RdrName) hunk ./src/Haddock/Interface/ParseModuleHeader.hs 46 - description1 :: Either String (Maybe (HsDoc RdrName)) + description1 :: Either String (Maybe (Doc RdrName)) hunk ./src/Haddock/Interface/Rename.hs 149 -renameDocForDecl :: (Maybe (HsDoc Name), FnArgsDoc Name) -> RnM (Maybe (HsDoc DocName), FnArgsDoc DocName) +renameDocForDecl :: (Maybe (Doc Name), FnArgsDoc Name) -> RnM (Maybe (Doc DocName), FnArgsDoc DocName) hunk ./src/Haddock/Interface/Rename.hs 156 -renameMaybeDoc :: Maybe (HsDoc Name) -> RnM (Maybe (HsDoc DocName)) +renameMaybeDoc :: Maybe (Doc Name) -> RnM (Maybe (Doc DocName)) hunk ./src/Haddock/Interface/Rename.hs 164 -renameDoc :: HsDoc Name -> RnM (HsDoc DocName) +renameDoc :: Doc Name -> RnM (Doc DocName) hunk ./src/Haddock/Interface/Rn.hs 2 -module Haddock.Interface.Rn ( rnHsDoc, rnHaddockModInfo ) where +module Haddock.Interface.Rn ( rnDoc, rnHaddockModInfo ) where hunk ./src/Haddock/Interface/Rn.hs 14 - HaddockModInfo (fmap (rnHsDoc gre) desc) port stab maint + HaddockModInfo (fmap (rnDoc gre) desc) port stab maint hunk ./src/Haddock/Interface/Rn.hs 23 -rnHsDoc :: GlobalRdrEnv -> HsDoc RdrName -> HsDoc Name -rnHsDoc gre = unId . do_rn +rnDoc :: GlobalRdrEnv -> Doc RdrName -> Doc Name +rnDoc gre = unId . do_rn hunk ./src/Haddock/InterfaceFile.hs 375 -instance (Binary id) => Binary (HsDoc id) where +instance (Binary id) => Binary (Doc id) where hunk ./src/Haddock/ModuleTree.hs 15 -import Haddock.Types ( HsDoc ) +import Haddock.Types ( Doc ) hunk ./src/Haddock/ModuleTree.hs 21 -data ModuleTree = Node String Bool (Maybe String) (Maybe (HsDoc Name)) [ModuleTree] +data ModuleTree = Node String Bool (Maybe String) (Maybe (Doc Name)) [ModuleTree] hunk ./src/Haddock/ModuleTree.hs 23 -mkModuleTree :: Bool -> [(Module, Maybe (HsDoc Name))] -> [ModuleTree] +mkModuleTree :: Bool -> [(Module, Maybe (Doc Name))] -> [ModuleTree] hunk ./src/Haddock/ModuleTree.hs 31 -addToTrees :: [String] -> Maybe String -> Maybe (HsDoc Name) -> [ModuleTree] -> [ModuleTree] +addToTrees :: [String] -> Maybe String -> Maybe (Doc Name) -> [ModuleTree] -> [ModuleTree] hunk ./src/Haddock/ModuleTree.hs 42 -mkSubTree :: [String] -> Maybe String -> Maybe (HsDoc Name) -> [ModuleTree] +mkSubTree :: [String] -> Maybe String -> Maybe (Doc Name) -> [ModuleTree] hunk ./src/Haddock/Types.hs 38 -type Doc = HsDoc Name hunk ./src/Haddock/Types.hs 39 -type DocInstance name = (InstHead name, Maybe (HsDoc name)) +type DocInstance name = (InstHead name, Maybe (Doc name)) hunk ./src/Haddock/Types.hs 44 -type FnArgsDoc name = Map Int (HsDoc name) -type DocForDecl name = (Maybe (HsDoc name), FnArgsDoc name) +type FnArgsDoc name = Map Int (Doc name) +type DocForDecl name = (Maybe (Doc name), FnArgsDoc name) hunk ./src/Haddock/Types.hs 119 - expItemSectionText :: HsDoc name + expItemSectionText :: Doc name hunk ./src/Haddock/Types.hs 123 - | ExportDoc (HsDoc name) -- ^ Some documentation + | ExportDoc (Doc name) -- ^ Some documentation hunk ./src/Haddock/Types.hs 135 -type DocMap = Map Name (HsDoc DocName) +type DocMap = Map Name (Doc DocName) hunk ./src/Haddock/Types.hs 174 - ifaceDoc :: !(Maybe (HsDoc Name)), + ifaceDoc :: !(Maybe (Doc Name)), hunk ./src/Haddock/Types.hs 177 - ifaceRnDoc :: Maybe (HsDoc DocName), + ifaceRnDoc :: Maybe (Doc DocName), hunk ./src/Haddock/Types.hs 217 - ifaceInstanceDocMap :: Map Name (HsDoc Name) + ifaceInstanceDocMap :: Map Name (Doc Name) hunk ./src/Haddock/Types.hs 268 -unrenameHsDoc :: HsDoc DocName -> HsDoc Name -unrenameHsDoc = fmap getName +unrenameDoc :: Doc DocName -> Doc Name +unrenameDoc = fmap getName hunk ./src/Haddock/Types.hs 272 - (fmap unrenameHsDoc mbDoc, fmap unrenameHsDoc fnArgsDoc) + (fmap unrenameDoc mbDoc, fmap unrenameDoc fnArgsDoc) hunk ./src/Haddock/Types.hs 275 -data HsDoc id +data Doc id hunk ./src/Haddock/Types.hs 277 - | DocAppend (HsDoc id) (HsDoc id) + | DocAppend (Doc id) (Doc id) hunk ./src/Haddock/Types.hs 279 - | DocParagraph (HsDoc id) + | DocParagraph (Doc id) hunk ./src/Haddock/Types.hs 282 - | DocEmphasis (HsDoc id) - | DocMonospaced (HsDoc id) - | DocUnorderedList [HsDoc id] - | DocOrderedList [HsDoc id] - | DocDefList [(HsDoc id, HsDoc id)] - | DocCodeBlock (HsDoc id) + | DocEmphasis (Doc id) + | DocMonospaced (Doc id) + | DocUnorderedList [Doc id] + | DocOrderedList [Doc id] + | DocDefList [(Doc id, Doc id)] + | DocCodeBlock (Doc id) hunk ./src/Haddock/Types.hs 296 -instance Arbitrary a => Arbitrary (HsDoc a) where +instance Arbitrary a => Arbitrary (Doc a) where hunk ./src/Haddock/Types.hs 316 -type LHsDoc id = Located (HsDoc id) +type LDoc id = Located (Doc id) hunk ./src/Haddock/Types.hs 339 - hmi_description :: Maybe (HsDoc name), + hmi_description :: Maybe (Doc name), hunk ./src/Haddock/Utils.hs 36 - -- * HsDoc markup + -- * Doc markup hunk ./src/Haddock/Utils.hs 105 -toDescription :: Interface -> Maybe (HsDoc Name) +toDescription :: Interface -> Maybe (Doc Name) hunk ./src/Haddock/Utils.hs 109 -toInstalledDescription :: InstalledInterface -> Maybe (HsDoc Name) +toInstalledDescription :: InstalledInterface -> Maybe (Doc Name) hunk ./src/Haddock/Utils.hs 314 -markup :: DocMarkup id a -> HsDoc id -> a +markup :: DocMarkup id a -> Doc id -> a hunk ./src/Haddock/Utils.hs 331 -markupPair :: DocMarkup id a -> (HsDoc id, HsDoc id) -> (a, a) +markupPair :: DocMarkup id a -> (Doc id, Doc id) -> (a, a) hunk ./src/Haddock/Utils.hs 335 -idMarkup :: DocMarkup a (HsDoc a) +idMarkup :: DocMarkup a (Doc a) hunk ./src/Main.hs 397 -getPrologue :: [Flag] -> IO (Maybe (HsDoc RdrName)) +getPrologue :: [Flag] -> IO (Maybe (Doc RdrName)) move ./src/Haddock/Interface/Lex.x ./src/Haddock/Lex.x move ./src/Haddock/Interface/Parse.y ./src/Haddock/Parse.y hunk ./haddock.cabal 103 - Haddock.Interface.Lex - Haddock.Interface.Parse hunk ./haddock.cabal 106 + Haddock.Lex + Haddock.Parse hunk ./src/Haddock/Interface/LexParseRn.hs 22 -import Haddock.Interface.Lex -import Haddock.Interface.Parse +import Haddock.Lex +import Haddock.Parse hunk ./src/Haddock/Interface/LexParseRn.hs 49 - NormalHaddockComment -> parseHaddockParagraphs - DocSectionComment -> parseHaddockString + NormalHaddockComment -> parseParas + DocSectionComment -> parseString hunk ./src/Haddock/Lex.x 6 --- This file was modified and integrated into GHC by David Waern 2006 +-- This file was modified and integrated into GHC by David Waern 2006. +-- Then moved back into Haddock by Isaac Dupree in 2009 :-) hunk ./src/Haddock/Lex.x 18 -module Haddock.Interface.Lex ( +module Haddock.Lex ( hunk ./src/Haddock/Parse.y 9 -module Haddock.Interface.Parse ( - parseHaddockParagraphs, - parseHaddockString -) where +module Haddock.Parse where hunk ./src/Haddock/Parse.y 11 -import Haddock.Interface.Lex +import Haddock.Lex hunk ./src/Haddock/Parse.y 40 -%name parseHaddockParagraphs doc -%name parseHaddockString seq +%name parseParas doc +%name parseString seq hunk ./src/Main.hs 25 -import Haddock.Interface.Lex -import Haddock.Interface.Parse +import Haddock.Lex +import Haddock.Parse hunk ./src/Main.hs 403 - case parseHaddockParagraphs (tokenise str) of + case parseParas (tokenise str) of hunk ./tests/tests/A.html.ref 26 ->ContentsContentsIndexIndexProduced by Haddock version 2.5.0Produced by Haddock version 2.6.0ContentsContentsIndexIndexmodule Amodule AProduced by Haddock version 2.5.0Produced by Haddock version 2.6.0ContentsContentsIndexIndex T = T T = TTTProduced by Haddock version 2.5.0Produced by Haddock version 2.6.0ContentsContentsIndexIndex :: A :: AProduced by Haddock version 2.5.0Produced by Haddock version 2.6.0 version 2.5.0 version 2.6.0 version 2.5.0 version 2.6.0 version 2.5.0 version 2.6.0 version 2.5.0 version 2.6.0ContentsContentsIndexIndex (String, [Typ (String, [Typ (String, [String (String, [StringProduced by Haddock version 2.5.0Produced by Haddock version 2.6.0 version 2.5.0 version 2.6.0 version 2.5.0 version 2.6.0 version 2.5.0 version 2.6.0 version 2.5.0 version 2.6.0ContentsContentsIndexIndexProduced by Haddock version 2.5.0Produced by Haddock version 2.6.0 version 2.5.0 version 2.6.0 version 2.5.0 version 2.6.0 version 2.5.0 version 2.6.0ContentsContentsIndexIndexProduced by Haddock version 2.5.0Produced by Haddock version 2.6.0 version 2.5.0 version 2.6.0 version 2.5.0 version 2.6.0ContentsContentsIndexIndexProduced by Haddock version 2.5.0Produced by Haddock version 2.6.0 version 2.5.0 version 2.6.0ContentsContentsIndexIndexstuff +>stuff hunk ./tests/tests/TypeOperators.html.ref 96 -> a :-: a :-: (a :+: (a :+: Op Op O g f a = O O g f a = OunOunObiO :: (g `ObiO :: (g `O Flip (~>) b a = Flip Flip (~>) b a = FlipunFlipunFlip :: (g `O :: (g `OProduced by Haddock version 2.5.0Produced by Haddock version 2.6.0 version 2.5.0 version 2.6.0 - -syn match hsHdocChunk "$\i\+" contained -syn match hsHdocMod /"\(\i\|[.]\)\+"/ contained -syn match hsHdocLink "'\(\i\|[.#]\)\+'" contained -syn region hsHdocAnchor start="\\\@" contained oneline -syn region hsHdocCode start="\\\@" contained -" match only the > using a look-behind -syn match hsHdocLTracks "\(^\s*--\s*\)\@<=>" contained - -" todo: numbered lists, mark haddock start separately -"syn match hsHdocStart "\([$^|]\|\*\+\)" contained - -syn cluster hsHdocSpecial - \ contains=hsHdocMod,hsHdocLink,hsHdocEm,hsHdocCode,hsHdocURL, - \ hsHdocAnchor,hsHdocChunk - -syn region hsHdocDef start="^\s*\(--\)\?\s*\[" end="\]" contained contains=hsHdocSpecial - -syn region hsHdocLines start="--\s*\([$\^|]\|\*\+\)" - \ skip="^\s*\(--.*\)$" - \ end="^\s*\(\$\|--\)\@!" - \ contains=@hsHdocSpecial,hsHdocLTracks,hsHdocLHeading,hsHdocLCodeBlock,hsHdocDef -syn region hsHdocBlock start="{-\s*\([$\^|]\|\*\+\)" end="-}" - \ contains=@hsHdocSpecial,hsHdocBTracks,hsHdocBHeading,hsHdocBCodeBlock,hsHdocDef - -syn sync minlines=20 - -if version >= 508 || !exists("did_haddock_syntax_inits") - if version < 508 - let did_haddock_syntax_inits = 1 - command -nargs=+ HiLink hi link - else - command -nargs=+ HiLink hi def link - endif - - HiLink hsHdocLines hsHdoc - HiLink hsHdocBlock hsHdoc - HiLink hsHdoc PreProc - HiLink hsHdocAnchor Special - HiLink hsHdocChunk Special - HiLink hsHdocMod Special - HiLink hsHdocLink Special - HiLink hsHdocEm Special - HiLink hsHdocURL Special - HiLink hsHdocCode Special - HiLink hsHdocLHeading Special - HiLink hsHdocBHeading Special - HiLink hsHdocLTracks Special - HiLink hsHdocBTracks Special - HiLink hsHdocBCodeBlock Special - HiLink hsHdocLCodeBlock Special - HiLink hsHdocSpecial Special - - delcommand HiLink -endif - -" Options for vi: sw=2 sts=2 nowrap ft=vim +" Attempt to add haddock highlighting for haskell comments +" It should be placed in ~/.vim/after/syntax/haskell.vim +" Brad Bowman + +syn match hsHdocChunk "$\i\+" contained +syn match hsHdocMod /"\(\i\|[.]\)\+"/ contained +syn match hsHdocLink "'\(\i\|[.#]\)\+'" contained +syn region hsHdocAnchor start="\\\@" contained oneline +syn region hsHdocCode start="\\\@" contained +" match only the > using a look-behind +syn match hsHdocLTracks "\(^\s*--\s*\)\@<=>" contained + +" todo: numbered lists, mark haddock start separately +"syn match hsHdocStart "\([$^|]\|\*\+\)" contained + +syn cluster hsHdocSpecial + \ contains=hsHdocMod,hsHdocLink,hsHdocEm,hsHdocCode,hsHdocURL, + \ hsHdocAnchor,hsHdocChunk + +syn region hsHdocDef start="^\s*\(--\)\?\s*\[" end="\]" contained contains=hsHdocSpecial + +syn region hsHdocLines start="--\s*\([$\^|]\|\*\+\)" + \ skip="^\s*\(--.*\)$" + \ end="^\s*\(\$\|--\)\@!" + \ contains=@hsHdocSpecial,hsHdocLTracks,hsHdocLHeading,hsHdocLCodeBlock,hsHdocDef +syn region hsHdocBlock start="{-\s*\([$\^|]\|\*\+\)" end="-}" + \ contains=@hsHdocSpecial,hsHdocBTracks,hsHdocBHeading,hsHdocBCodeBlock,hsHdocDef + +syn sync minlines=20 + +if version >= 508 || !exists("did_haddock_syntax_inits") + if version < 508 + let did_haddock_syntax_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + + HiLink hsHdocLines hsHdoc + HiLink hsHdocBlock hsHdoc + HiLink hsHdoc PreProc + HiLink hsHdocAnchor Special + HiLink hsHdocChunk Special + HiLink hsHdocMod Special + HiLink hsHdocLink Special + HiLink hsHdocEm Special + HiLink hsHdocURL Special + HiLink hsHdocCode Special + HiLink hsHdocLHeading Special + HiLink hsHdocBHeading Special + HiLink hsHdocLTracks Special + HiLink hsHdocBTracks Special + HiLink hsHdocBCodeBlock Special + HiLink hsHdocLCodeBlock Special + HiLink hsHdocSpecial Special + + delcommand HiLink +endif + +" Options for vi: sw=2 sts=2 nowrap ft=vim hunk ./src/Haddock/Interface/Create.hs 302 - tell $ nub [ + tell [ hunk ./src/Haddock/Interface/Create.hs 312 - tell $ nub [ + tell [ hunk ./src/Haddock/Interface/ParseModuleHeader.hs 16 -import Haddock.Interface.Lex -import Haddock.Interface.Parse +import Haddock.Lex +import Haddock.Parse hunk ./src/Haddock/Interface/ParseModuleHeader.hs 49 - Just description -> case parseHaddockString . tokenise $ description of + Just description -> case parseString . tokenise $ description of hunk ./src/Haddock/Interface/ParseModuleHeader.hs 55 - Right docOpt -> case parseHaddockParagraphs . tokenise $ str8 of + Right docOpt -> case parseParas . tokenise $ str8 of hunk ./tests/runtests.hs 27 - result <- findProgramOnPath p silent + result <- findProgramLocation silent p hunk ./src/Haddock/Backends/Html.hs 861 + | not (null (unLoc lctxt)) hunk ./src/Haddock/Backends/Html.hs 864 - do_largs (n+1) (darrow unicode) ltype + do_largs n (darrow unicode) ltype + -- if we're not showing any 'forall' or class constraints or + -- anything, skip having an empty line for the context. + | otherwise + = do_largs n leader ltype addfile ./tests/tests/FunArgs.hs hunk ./tests/tests/FunArgs.hs 1 +module FunArgs where + +f :: Ord a => Int -- ^ First argument + -> a -- ^ Second argument + -> Bool -- ^ Third argument + -> () -- ^ Result +f = undefined hunk ./src/Haddock/Backends/Html.hs 870 - = (argBox (leader <+> ppLType unicode lt) <-> rdocBox (argDocHtml n)) + = (argBox (leader <+> ppLFunLhType unicode lt) <-> rdocBox (argDocHtml n)) hunk ./src/Haddock/Backends/Html.hs 1568 -ppLType, ppLParendType :: Bool -> Located (HsType DocName) -> Html +ppLType, ppLParendType, ppLFunLhType :: Bool -> Located (HsType DocName) -> Html hunk ./src/Haddock/Backends/Html.hs 1571 +ppLFunLhType unicode y = ppFunLhType unicode (unLoc y) hunk ./src/Haddock/Backends/Html.hs 1574 -ppType, ppParendType :: Bool -> HsType DocName -> Html +ppType, ppParendType, ppFunLhType :: Bool -> HsType DocName -> Html hunk ./src/Haddock/Backends/Html.hs 1577 +ppFunLhType unicode ty = ppr_mono_ty pREC_FUN ty unicode hunk ./tests/tests/FunArgs.hs 3 -f :: Ord a => Int -- ^ First argument +f :: forall a. Ord a + => Int -- ^ First argument hunk ./tests/tests/FunArgs.hs 7 + -> (a -> a) -- ^ Fourth argument addfile ./tests/tests/FunArgs.html.ref hunk ./tests/tests/FunArgs.html.ref 1 + + +FunArgs
 ContentsIndex
FunArgs
Documentation
f
:: forall a . Ord a
=> IntFirst argument +
-> aSecond argument +
-> BoolThird argument +
-> (a -> a)Fourth argument +
-> ()Result +
Produced by Haddock version 2.6.0
hunk ./tests/tests/FunArgs.hs 11 + +g :: a -- ^ First argument + -> b -- ^ Second argument + -> c -- ^ Third argument + -> d -- ^ Result +g = undefined + hunk ./tests/tests/FunArgs.html.ref 134 +>g
:: aFirst argument +
-> bSecond argument +
-> cThird argument +
-> dResult +
-> T3-> (T3)= 611 +ppr_mono_ty _ (HsSpliceTy {}) _ = error "ppr_mono_ty HsSpliceTy" +ppr_mono_ty _ (HsQuasiQuoteTy {}) _ = error "ppr_mono_ty HsQuasiQuoteTy" hunk ./src/Haddock/Backends/Html.hs 1616 - hunk ./src/Haddock/GhcUtils.hs 94 - = case collectAcc d [] of + = case collectHsBindBinders d of hunk ./src/Haddock/GhcUtils.hs 96 - (name:_) -> Just (unLoc name) + (name:_) -> Just name hunk ./src/Haddock/GhcUtils.hs 34 -import LazyUniqFM +import UniqFM hunk ./src/Haddock/Backends/Html.hs 1516 -ppBang HsUnbox = toHtml "!" -- unboxed args is an implementation detail, +ppBang HsUnpack = toHtml "!" -- unboxed args is an implementation detail, hunk ./src/Haddock/Backends/Html.hs 1518 +ppBang HsUnpackFailed = toHtml "!" -- unboxed args is an implementation detail, hunk ./src/Haddock/Convert.hs 20 +import BasicTypes hunk ./src/Haddock/Convert.hs 30 -import BasicTypes hunk ./src/Haddock/Convert.hs 170 - MarkedStrict -> noLoc $ HsBangTy HsStrict tySyn - MarkedUnboxed -> noLoc $ HsBangTy HsUnbox tySyn - NotMarkedStrict -> - -- HsNoBang never appears, it's implied instead. - tySyn + -- HsNoBang never appears, it's implied instead. + HsNoBang -> tySyn + _ -> noLoc $ HsBangTy strict tySyn hunk ./src/Haddock/Convert.hs 20 -import BasicTypes hunk ./src/Haddock/Backends/Html.hs 1515 -ppBang HsStrict = toHtml "!" -ppBang HsUnpack = toHtml "!" -- unboxed args is an implementation detail, - -- so we just show the strictness annotation -ppBang HsUnpackFailed = toHtml "!" -- unboxed args is an implementation detail, - +ppBang _ = toHtml "!" -- Unpacked args is an implementation detail, hunk ./src/Haddock/Convert.hs 166 - linear_tys = zipWith (\ty strict -> + linear_tys = zipWith (\ty bang -> hunk ./src/Haddock/Convert.hs 168 - in case strict of - -- HsNoBang never appears, it's implied instead. - HsNoBang -> tySyn - _ -> noLoc $ HsBangTy strict tySyn + in case bang of + HsUnpackFailed -> noLoc $ HsBangTy HsStrict tySyn + HsNoBang -> tySyn + -- HsNoBang never appears, it's implied instead. + _ -> noLoc $ HsBangTy bang tySyn + hunk ./ghc.mk 15 - "$(RM)" $(RM_OPTS) -r $@ + "$(RM)" $(RM_OPTS_REC) $@ hunk ./src/Main.hs 104 +#if ! MIN_VERSION_ghc(6,13,0) hunk ./src/Main.hs 106 +#endif hunk ./src/Haddock/Backends/Html.hs 402 - id_s = "n:" ++ show id_ + id_s = "n." ++ show id_ hunk ./src/Haddock/Interface/Create.hs 561 - -- *here* is that we behave reasonably when we run into one of + -- /here/ is that we behave reasonably when we run into one of hunk ./haddock.cabal 134 + Haddock.Lex + Haddock.Parse hunk ./src/Documentation/Haddock.hs 1 +----------------------------------------------------------------------------- +-- | +-- Module : Documentation.Haddock +-- Copyright : (c) David Waern 2010 +-- License : BSD-like hunk ./src/Documentation/Haddock.hs 7 --- Haddock - A Haskell Documentation Tool --- --- (c) Simon Marlow 2003 +-- Maintainer : haddock@projects.haskellorg +-- Stability : experimental +-- Portability : portable hunk ./src/Documentation/Haddock.hs 11 +-- The Haddock API: A rudimentory, highly experimental API exposing some of +-- the internals of Haddock. Don't expect it to be stable. +----------------------------------------------------------------------------- hunk ./src/Documentation/Haddock.hs 17 + + -- * Interface + Interface(..), + InstalledInterface(..), + createInterfaces, + + -- * Export items & declarations + ExportItem(..), + DeclInfo, + DocForDecl, + FnArgsDoc, + + -- * Hyperlinking + LinkEnv, + DocName(..), + docNameOcc, + + -- * Instances + DocInstance, + InstHead(..), + + -- * Documentation comments + Doc(..), + DocMarkup(..), + + -- * Interface Files + -- | (.haddock files) + InterfaceFile(..), hunk ./src/Documentation/Haddock.hs 49 - InterfaceFile(..), - LinkEnv, - InstalledInterface(..), - DocName(..), - docNameOcc + + -- * Flags and options + Flag(..), + DocOption(..) + hunk ./src/Documentation/Haddock.hs 58 +import Haddock.Interface hunk ./src/Documentation/Haddock.hs 60 +import Haddock.Options hunk ./src/Haddock/Interface.hs 43 --- | Turn a topologically sorted list of module names/filenames into interfaces. Also --- return the home link environment created in the process. -createInterfaces :: Verbosity -> [String] -> [Flag] -> [InterfaceFile] - -> Ghc ([Interface], LinkEnv) +-- | Create 'Interface' structures by typechecking the list of modules +-- using the GHC API and processing the resulting syntax trees. +createInterfaces + :: Verbosity -- ^ Verbosity of logging to 'stdout' + -> [String] -- ^ A list of file or module names sorted by module topology + -> [Flag] -- ^ Command-line flags + -> [InterfaceFile] -- ^ Interface files of package dependencies + -> Ghc ([Interface], LinkEnv) + -- ^ Resulting list of interfaces and renaming environment hunk ./src/Haddock/Types.hs 39 + +-- | An instance head that may have documentation. hunk ./src/Haddock/Types.hs 57 --- | A 'DocName' identifies something that may have documentation. The 'Module' --- argument specifies where we prefer to link to in the documentation. It may --- be different than the original module. -data DocName = Documented Name Module | Undocumented Name - deriving Eq +-- | An extension of 'Name' that may contain the preferred place to link to in +-- the documentation. +data DocName = Documented Name Module | Undocumented Name deriving Eq +-- TODO: simplify to data DocName = DocName Name (Maybe Module) hunk ./src/Haddock/Types.hs 63 --- | The 'OccName' belonging to this name +-- | The 'OccName' of this name. hunk ./src/Haddock/Types.hs 74 +-- | Source-level options for controlling the documentation. hunk ./src/Haddock/Types.hs 139 + +-- | An environment used to create hyper-linked syntax. hunk ./src/Haddock/Types.hs 163 --- | This is the data structure used to render a Haddock page for a module - it --- is the "interface" of the module. The core of Haddock lies in creating this +-- | The data structure used to render a Haddock page for a module - it is +-- the interface of the module. The core of Haddock lies in creating this hunk ./src/Haddock/Types.hs 169 - -- | The module represented by this interface + -- | The module represented by this interface. hunk ./src/Haddock/Types.hs 172 - -- | The original filename for this module + -- | Original file name of the module. hunk ./src/Haddock/Types.hs 175 - -- | Textual information about the module + -- | Textual information about the module. hunk ./src/Haddock/Types.hs 178 - -- | The documentation header for this module + -- | Documentation header. hunk ./src/Haddock/Types.hs 181 - -- | The renamed documentation header for this module + -- | Documentation header with link information. hunk ./src/Haddock/Types.hs 184 - -- | The Haddock options for this module (prune, ignore-exports, etc) + -- | Haddock options for this module (prune, ignore-exports, etc). hunk ./src/Haddock/Types.hs 187 - -- | The declarations of the module. Excludes declarations that don't - -- have names (instances and stand-alone documentation comments). Includes - -- subordinate names, but they are mapped to their parent declarations. + -- | Declarations originating from the module. Excludes declarations without + -- names (instances and stand-alone documentation comments). Includes + -- names of subordinate declarations mapped to their parent declarations. hunk ./src/Haddock/Types.hs 192 - -- | Everything declared in the module (including subordinates) that has docs + -- | Documentation of declarations originating from the module (including + -- subordinates). hunk ./src/Haddock/Types.hs 201 - -- | All names defined in this module + -- | All names defined in the module. hunk ./src/Haddock/Types.hs 204 - -- | All names exported by this module + -- | All names exported by the module. hunk ./src/Haddock/Types.hs 207 - -- | All the visible names exported by this module - -- For a name to be visible, it has to: - -- - -- * be exported normally, and not via a full module re-exportation. - -- - -- * have a declaration in this module or any of it's imports, with the - -- exception that it can't be from another package. - -- - -- Basically, a visible name is a name that will show up in the documentation - -- for this module. + -- | All \"visible\" names exported by the module. + -- A visible name is a name that will show up in the documentation of the + -- module. hunk ./src/Haddock/Types.hs 212 - -- | The instances exported by this module + -- | Instances exported by the module. hunk ./src/Haddock/Types.hs 215 - -- | Docs for instances defined in this module + -- | Documentation of instances defined in the module. hunk ./src/Haddock/Types.hs 220 --- | A smaller version of 'Interface' that we can get from the Haddock --- interface files. +-- | A smaller version of 'Interface' that can be created from Haddock's +-- interface files ('InterfaceFile'). hunk ./src/Haddock/Types.hs 224 - -- | The module represented by this interface + -- | The module represented by this interface. hunk ./src/Haddock/Types.hs 227 - -- | Textual information about the module + -- | Textual information about the module. hunk ./src/Haddock/Types.hs 230 - -- | Everything declared in the module (including subordinates) that has docs + -- | Documentation of declarations originating from the module (including + -- subordinates). hunk ./src/Haddock/Types.hs 234 - -- | All names exported by this module + -- | All names exported by this module. hunk ./src/Haddock/Types.hs 237 - -- | All the visible names exported by this module - -- For a name to be visible, it has to: - -- - -- * be exported normally, and not via a full module re-exportation. - -- - -- * have a declaration in this module or any of it's imports, with the - -- exception that it can't be from another package. - -- - -- Basically, a visible name is a name that will show up in the documentation - -- for this module. + -- | All \"visible\" names exported by the module. + -- A visible name is a name that will show up in the documentation of the + -- module. hunk ./src/Haddock/Types.hs 242 - -- | The Haddock options for this module (prune, ignore-exports, etc) + -- | Haddock options for this module (prune, ignore-exports, etc). hunk ./tests/runtests.hs 78 - let basepath = init libdir ++ "/../../share/doc/ghc/html/libraries/base/" + let basepath = init libdir ++ "/../../share/doc/ghc/html/libraries/base-4.2.0.0/" hunk ./tests/runtests.hs 80 - let processpath = init libdir ++ "/../../share/doc/ghc/html/libraries/process/" + let processpath = init libdir ++ "/../../share/doc/ghc/html/libraries/process-1.0.1.2/" hunk ./src/Haddock/Interface/Create.hs 68 - localNames = ghcDefinedNames ghcMod hunk ./src/Haddock/Interface/Create.hs 92 - ifaceLocals = localNames, hunk ./src/Haddock/Types.hs 201 - -- | All names defined in the module. - ifaceLocals :: ![Name], - hunk ./src/Documentation/Haddock.hs 41 + HaddockModInfo(..), hunk ./src/Documentation/Haddock.hs 43 - -- * Interface Files + -- * Interface files hunk ./tests/runtests.hs 64 - let mods = filter ((==) ".hs" . takeExtension) contents + + let mods = + case args of + x:_ | x /= "all" -> [x ++ ".hs"] + _ -> filter ((==) ".hs" . takeExtension) contents + hunk ./doc/haddock.xml 19 - This document describes Haddock version 2.6.0, a Haskell + This document describes Haddock version 2.7.0, a Haskell hunk ./haddock.cabal 2 -version: 2.6.0 +version: 2.7.0 hunk ./haddock.spec 20 -%define version 2.6.0 +%define version 2.7.0 hunk ./ANNOUNCE 2 --- Haddock 2.6.0 +-- Haddock 2.7.0 hunk ./ANNOUNCE 7 -This is the version that comes with GHC 6.12.1. It contains the main results of -Isaac Dupree's Summer of Code project, which are: - - * Cross-package documentation (exporting something that comes from another - package is handled correctly. The full documentation of that thing shows - up in your documentation) - - * Lexing and parsing of Haddock comment markup is moved from GHC back into - Haddock. This will make it easier to make changes to the markup format - -We have decided to drop compatibility with older GHC versions in order to speed -up development. - hunk ./ANNOUNCE 8 --- Full list of changes in version 2.6.0 +-- Changes in version 2.7.0 hunk ./ANNOUNCE 11 - * Drop support for GHC 6.10.* - - * Add support for GHC 6.12.1 - - * Cross-package documentation - - * Move lexing and parsing of the Haddock comment markup back to Haddock - - * Slightly prettier printing of instance heads - - * Support platforms for which GHC has no native code generator + * Instances can be commented hunk ./ANNOUNCE 13 - * Add a flag --print-ghc-libdir + * The Haddock API now exposes more of the internals of Haddock hunk ./ANNOUNCE 15 - * Minor bug fixes + * Bug fixes (most importantly #128) hunk ./ANNOUNCE 25 - http://hackage.haskell.org/cgi-bin/hackage-scripts/package/haddock-2.6.0 + http://hackage.haskell.org/cgi-bin/hackage-scripts/package/haddock-2.7.0 hunk ./ANNOUNCE 43 - Ian Lynagh - Simon Peyton-Jones + Yitzchak Gale hunk ./CHANGES 1 +Changes in version 2.7.0: + + * Instances can be commented + + * The Haddock API now exposes more of the internals of Haddock + + * Bug fixes (most importantly #128) + +----------------------------------------------------------------------------- + hunk ./haddock.cabal 2 -version: 2.7.0 +version: 2.6.0 hunk ./haddock.cabal 127 + build-depends: + base >= 4.0.0.0 && < 4.3.0.0, + filepath, + directory, + pretty, + containers, + array, + Cabal >= 1.5, + ghc >= 6.12 && < 6.14, + ghc-paths + + if flag(test) + cpp-options: -DTEST + build-depends: QuickCheck >= 2.1 && < 3 + hunk ./haddock.cabal 145 + ghc-options: -funbox-strict-fields -O2 -Wall + hunk ./haddock.cabal 151 + Haddock.Interface + Haddock.Interface.Rename + Haddock.Interface.Create + Haddock.Interface.ExtractFnArgDocs + Haddock.Interface.AttachInstances + Haddock.Interface.Rn + Haddock.Interface.LexParseRn + Haddock.Interface.ParseModuleHeader hunk ./haddock.cabal 161 + Haddock.Utils.BlockTable + Haddock.Utils.Html + Haddock.Utils + Haddock.Backends.Html + Haddock.Backends.HaddockDB + Haddock.Backends.DevHelp + Haddock.Backends.HH + Haddock.Backends.HH2 + Haddock.Backends.Hoogle + Haddock.ModuleTree hunk ./haddock.cabal 172 + Haddock.Doc + Haddock.Version hunk ./haddock.cabal 175 - Haddock.Utils + Haddock.Options hunk ./haddock.cabal 177 + Haddock.Convert hunk ./haddock.cabal 2 -version: 2.6.0 +version: 2.7.0 hunk ./doc/haddock.xml 19 - This document describes Haddock version 2.7.0, a Haskell + This document describes Haddock version 2.7.1, a Haskell hunk ./haddock.cabal 2 -version: 2.7.0 +version: 2.7.1 hunk ./haddock.spec 20 -%define version 2.7.0 +%define version 2.7.1 hunk ./CHANGES 1 +Changes in version 2.7.1: + + * Fix problems with library part of .cabal file + +----------------------------------------------------------------------------- + hunk ./haddock.cabal 178 + Paths_haddock hunk ./CHANGES 1 +Changes in version 2.7.2 + + * Add Paths_haddock to library + +----------------------------------------------------------------------------- + hunk ./doc/haddock.xml 19 - This document describes Haddock version 2.7.1, a Haskell + This document describes Haddock version 2.7.2, a Haskell hunk ./haddock.cabal 2 -version: 2.7.1 +version: 2.7.2 hunk ./haddock.spec 20 -%define version 2.7.1 +%define version 2.7.2 hunk ./src/Documentation/Haddock.hs 36 - InstHead(..), + InstHead, hunk ./src/Haddock/Backends/Hoogle.hs 148 - (map (reL . HsTyVar . tyVar . unL) (tcdTyVars x)) - - tyVar (UserTyVar v _) = v - tyVar (KindedTyVar v _) = v + (map (reL . HsTyVar . hsTyVarName . unL) (tcdTyVars x)) hunk ./src/Haddock/Backends/Hoogle.hs 191 - ResTyH98 -> apps $ map (reL . HsTyVar) $ unL (tcdLName dat) : [x | UserTyVar x _ <- map unL $ tcdTyVars dat] + ResTyH98 -> apps $ map (reL . HsTyVar) $ unL (tcdLName dat) : [hsTyVarName v | v@UserTyVar {} <- map unL $ tcdTyVars dat] hunk ./src/Haddock/Backends/Html.hs 1371 +#if __GLASGOW_HASKELL__ == 612 +ppConstrHdr :: HsExplicitForAll -> [Name] -> HsContext DocName -> Bool -> Html +#else hunk ./src/Haddock/Backends/Html.hs 1375 +#endif hunk ./src/Haddock/Backends/Html.hs 1584 +#if __GLASGOW_HASKELL__ == 612 +ppForAll :: HsExplicitForAll -> [Located (HsTyVarBndr DocName)] +#else hunk ./src/Haddock/Backends/Html.hs 1588 +#endif hunk ./src/Haddock/Backends/Html.hs 1618 +#if __GLASGOW_HASKELL__ == 612 +ppr_mono_ty _ (HsSpliceTyOut {}) _ = error "ppr_mono_ty HsQuasiQuoteTy" +#else hunk ./src/Haddock/Backends/Html.hs 1622 -ppr_mono_ty _ (HsRecTy _) _ = error "ppr_mono_ty HsRecTy" +#endif +ppr_mono_ty _ (HsRecTy {}) _ = error "ppr_mono_ty HsRecTy" hunk ./src/Haddock/Convert.hs 23 +#if __GLASGOW_HASKELL__ == 612 +import Type ( splitKindFunTys ) +#else hunk ./src/Haddock/Convert.hs 27 +#endif hunk ./src/Haddock/Convert.hs 232 +#if __GLASGOW_HASKELL__ == 612 + then UserTyVar name +#else hunk ./src/Haddock/Convert.hs 236 +#endif hunk ./src/Haddock/GhcUtils.hs 93 -getMainDeclBinder (ValD d) - = case collectHsBindBinders d of - [] -> Nothing - (name:_) -> Just name +getMainDeclBinder (ValD d) = +#if __GLASGOW_HASKELL__ == 612 + case collectAcc d [] of + [] -> Nothing + (name:_) -> Just (unLoc name) +#else + case collectHsBindBinders d of + [] -> Nothing + (name:_) -> Just name +#endif + + hunk ./tests/tests/A.html.ref 114 -> version 2.6.0 version 2.7.2 version 2.6.0 version 2.7.2 version 2.6.0 version 2.7.2 version 2.6.0 version 2.7.2 version 2.6.0 version 2.7.2 version 2.6.0 version 2.7.2 version 2.6.0 version 2.7.2 version 2.6.0 version 2.7.2 version 2.6.0 version 2.7.2 version 2.6.0 version 2.7.2 version 2.6.0 version 2.7.2 version 2.6.0 version 2.7.2 version 2.6.0 version 2.7.2 version 2.6.0 version 2.7.2 version 2.6.0 version 2.7.2 version 2.6.0 version 2.7.2 version 2.6.0 version 2.7.2 version 2.6.0 version 2.7.2 version 2.6.0 version 2.7.2 version 2.6.0 version 2.7.2 version 2.6.0 version 2.7.2 version 2.6.0 version 2.7.2 version 2.6.0 version 2.7.2 version 2.6.0 version 2.7.2 version 2.6.0 version 2.7.2= 6.12 && < 6.14, - ghc-paths + ghc >= 6.12 && < 6.14 + + if flag(in-ghc-tree) + cpp-options: -DIN_GHC_TREE + extensions: ForeignFunctionInterface + else + build-depends: ghc-paths hunk ./src/Haddock/GhcUtils.hs 34 +#if __GLASGOW_HASKELL__ >= 613 hunk ./src/Haddock/GhcUtils.hs 36 +#else +import LazyUniqFM +#endif addfile ./tests/tests/Examples.hs hunk ./tests/tests/Examples.hs 1 +module Examples where + +-- | Fibonacci number of given 'Integer'. +-- +-- Examples: +-- +-- ghci> fib 5 +-- 5 +-- ghci> fib 10 +-- 55 +-- +-- ghci> fib 10 +-- 55 +-- +-- One more Example: +-- +-- ghci> fib 5 +-- 5 +-- +-- One more Example: +-- +-- ghci> fib 5 +-- 5 +-- +-- Example with an import: +-- +-- ghci> import Data.Char +-- ghci> isSpace 'a' +-- False +-- +fib :: Integer -> Integer +fib 0 = 0 +fib 1 = 1 +fib n = fib (n - 1) + fib (n - 2) addfile ./tests/tests/Examples.html.ref hunk ./tests/tests/Examples.html.ref 1 + + +Examples
 ContentsIndex
Examples
Synopsis
fib :: Integer -> Integer
Documentation
fib :: Integer -> Integer

Fibonacci number of given Integer. +

Examples: +

ghci> fib 5
+5
+ghci> fib 10
+55
+
ghci> fib 10
+55
+

One more Example: +

ghci> fib 5
+5
+

One more Example: +

ghci> fib 5
+5
+

Example with an import: +

ghci> import Data.Char
+ghci> isSpace 'a'
+False
+
Produced by Haddock version 2.7.2
hunk ./tests/runtests.hs 62 + + x <- doesFileExist (".." "dist" "build" "haddock" "haddock") + when (not x) $ die "you need to run 'cabal build' successfully first" + hunk ./src/Haddock/Lex.x 40 -$ident = [$alphanum \'\_\.\!\#\$\%\&\*\+\/\<\=\>\?\@\\\\\^\|\-\~] +$ident = [$alphanum \'\_\.\!\#\$\%\&\*\+\/\<\=\>\?\@\\\\\^\|\-\~\:] addfile ./tests/tests/Ticket75.hs hunk ./tests/tests/Ticket75.hs 1 +module Ticket75 where + +data a :- b = Q + +-- | A reference to ':-' +f :: Int +f = undefined addfile ./tests/tests/Ticket75.html.ref hunk ./tests/tests/Ticket75.html.ref 1 + + +Ticket75
 ContentsIndex
Ticket75
Synopsis
data a :- b = Q
f :: Int
Documentation
data a :- b
Constructors
Q
f :: Int
A reference to :- +
Produced by Haddock version 2.7.2
hunk ./src/Haddock/Lex.x 71 - \<\<.*\>\> { strtoken $ \s -> TokPic (init $ init $ tail $ tail s) } - \<.*\> { strtoken $ \s -> TokURL (init (tail s)) } - \#.*\# { strtoken $ \s -> TokAName (init (tail s)) } + \<\< [^\>]* \>\> { strtoken $ \s -> TokPic (init $ init $ tail $ tail s) } + \< [^\>]* \> { strtoken $ \s -> TokURL (init (tail s)) } + \# [^\#]* \# { strtoken $ \s -> TokAName (init (tail s)) } addfile ./tests/tests/NonGreedy.hs hunk ./tests/tests/NonGreedy.hs 1 +module NonGreedy where + +-- | +f :: a +f = undefined addfile ./tests/tests/NonGreedy.html.ref hunk ./tests/tests/NonGreedy.html.ref 1 + + +NonGreedy
 ContentsIndex
NonGreedy
Synopsis
f :: a
Documentation
f :: a
url1 url2 +
Produced by Haddock version 2.7.2
hunk ./src/Haddock/Lex.x 57 + $ws* ghci \> { strtoken TokExamplePrompt `andBegin` exampleexpr } hunk ./src/Haddock/Interface.hs 95 - let addHscAsm m = m { ms_hspp_opts = (ms_hspp_opts m) { hscTarget = defaultObjectTarget } } - return (map addHscAsm modgraph) + let addDefTarget m = m { ms_hspp_opts = (ms_hspp_opts m) { hscTarget = defaultObjectTarget } } + return (map addDefTarget modgraph) hunk ./src/Main.hs 144 - startGhc libDir (ghcFlags flags) $ \_ -> handleSrcErrors $ do + withGhc libDir (ghcFlags flags) $ \_ -> handleSrcErrors $ do hunk ./src/Main.hs 299 --- compilation and linking. -startGhc :: String -> [String] -> (DynFlags -> Ghc a) -> IO a -startGhc libDir flags ghcActs = do +-- compilation and linking. Then run the given 'Ghc' action. +withGhc :: String -> [String] -> (DynFlags -> Ghc a) -> IO a +withGhc libDir flags ghcActs = do hunk ./doc/haddock.xml 1412 - Additionally, the character > has - a special meaning at the beginning of a line, and the - following characters have special meanings at the beginning of - a paragraph: - *, -. These characters - can also be escaped using \. + Additionally, the character > and + the character sequence ghci> have special + meanings at the beginning of a line. The following characters + have special meanings at the beginning of a paragraph: + *, -. The single + characters can also be escaped using \. To + get a literal ghci> at the beginning of a + line, prefix the > with a + backslash. hunk ./doc/haddock.xml 1471 +
+ Interactive Examples + + Haddock has markup support for interactive examples, that + illustrate the use of source constructs in a + read-eval-print loop (REPL). An + interactive example is introduced with + ghci> followed by an expression followed + by zero or more result lines: + + +-- | Two examples are given bellow: +-- +-- ghci> fib 10 +-- 55 +-- +-- ghci> putStrLn "foo\nbar" +-- foo +-- bar + +
+ + hunk ./doc/haddock.xml 1412 - Additionally, the character > and - the character sequence ghci> have special - meanings at the beginning of a line. The following characters - have special meanings at the beginning of a paragraph: - *, -. The single - characters can also be escaped using \. To - get a literal ghci> at the beginning of a - line, prefix the > with a - backslash. + Additionally, the character > has + a special meaning at the beginning of a line, and the + following characters have special meanings at the beginning of + a paragraph: + *, -. These characters + can also be escaped using \. + + Furthermore, the character sequence ghci> + has a special meaning at the beginning of a line. To + escape it, just prefix the > character with a + backslash. hunk ./doc/haddock.xml 1474 - Interactive Examples + Examples hunk ./doc/haddock.xml 1476 - Haddock has markup support for interactive examples, that - illustrate the use of source constructs in a - read-eval-print loop (REPL). An - interactive example is introduced with + Haddock has markup support for examples of interaction with a + read-eval-print loop (REPL). An + example is introduced with hunk ./CHANGES 1 +Changes in version 2.6.1 (bug fix release from the stable branch) + + * Fix #128 + +----------------------------------------------------------------------------- + addfile ./tests/parsetests.hs hunk ./tests/parsetests.hs 1 +module Main (main) where + +import Test.HUnit +import RdrName (RdrName) +import DynFlags (defaultDynFlags) +import Haddock.Lex (tokenise) +import Haddock.Parse (parseParas) +import Haddock.Types + +instance Show RdrName where + show x = "RdrName" + +data ParseTest = ParseTest { + input :: String + , result :: (Maybe (Doc RdrName)) + } + +tests :: [ParseTest] +tests = [ + ParseTest { + input = "foobar" + , result = Just $ DocParagraph $ DocString "foobar\n" + } + + , ParseTest { + input = "foobar\n\nghci> fib 10\n55" + , result = Just $ DocAppend (DocParagraph $ DocString "foobar\n") (DocExamples $ [Example "fib 10" ["55"]]) + } + + , ParseTest { + input = "foobar\nghci> fib 10\n55" + , result = Nothing -- parse error + } + + , ParseTest { + input = "foobar\n\n> some code" + , result = Just (DocAppend (DocParagraph (DocString "foobar\n")) (DocCodeBlock (DocString " some code\n"))) + } + + , ParseTest { + input = "foobar\n> some code" + , result = Nothing -- parse error + } + ] + + +main = do + _ <- runTestTT $ TestList $ map testFromParseTest tests + return (); + where + + testFromParseTest :: ParseTest -> Test + testFromParseTest (ParseTest input result) = TestCase $ assertEqual input (parse input) result + + parse :: String -> Maybe (Doc RdrName) + parse input = parseParas $ tokenise defaultDynFlags input (0,0) addfile ./tests/runparsetests.sh hunk ./tests/runparsetests.sh 1 +#!/bin/sh +cd `dirname $0` + +runhaskell -hide-all-packages -cpp \ + -packagecontainers \ + -packagearray \ + -packagebase \ + -packageghc \ + -packagexhtml \ + -packageghc-paths \ + -packageHUnit \ + -i../dist/build/ \ + -i../src/ \ + parsetests.hs hunk ./tests/README 1 -This is a little output test suit for Haddock. To add a test: hunk ./tests/README 2 - 1 Create a module in the "tests" directory - 2 Run runtests.hs - You should now have output/.html but the test will always - pass since there is no reference output to compare with - 3 To add reference output, do - runhaskell copy.hs +A testsuite for Haddock that uses the concept of "golden files" (compares +output files against a set of reference files). hunk ./tests/README 5 -Tips: +To add a new test: hunk ./tests/README 7 -You can do + 1) Create a module in the "tests" directory. + + 2) Run runtests.hs. You should now have output/.html. The test + passes since there is no reference file to compare with. + + 3) To make a reference file from the output file, do + runhaskell copy.hs + +Tips and tricks: + +You can hunk ./tests/README 19 -to copy all output into reference files hunk ./tests/README 20 -You can do +to copy all output files into reference files. + +You can hunk ./tests/README 24 -to continue despite a failing test + +to continue despite a failing test. adddir ./tests/gold move ./tests/README ./tests/gold/README move ./tests/copy.hs ./tests/gold/copy.hs move ./tests/gold ./tests/golden-tests move ./tests/output ./tests/golden-tests/output move ./tests/runtests.hs ./tests/golden-tests/runtests.hs move ./tests/tests ./tests/golden-tests/tests adddir ./tests/unit move ./tests/parsetests.hs ./tests/unit/parsetests.hs move ./tests/runparsetests.sh ./tests/unit/runparsetests.sh move ./tests/unit ./tests/unit-tests hunk ./tests/golden-tests/README 2 -A testsuite for Haddock that uses the concept of "golden files" (compares -output files against a set of reference files). +This is a testsuite for Haddock that uses the concept of "golden files". That +is, it compares output files against a set of reference files. hunk ./tests/unit-tests/parsetests.hs 48 - _ <- runTestTT $ TestList $ map testFromParseTest tests + _ <- runTestTT $ TestList $ map toTestCase tests hunk ./tests/unit-tests/parsetests.hs 52 - testFromParseTest :: ParseTest -> Test - testFromParseTest (ParseTest input result) = TestCase $ assertEqual input (parse input) result + toTestCase :: ParseTest -> Test + toTestCase (ParseTest input result) = TestCase $ assertEqual input (parse input) result hunk ./tests/unit-tests/runparsetests.sh 12 - -i../dist/build/ \ - -i../src/ \ + -i../../dist/build/ \ + -i../../src/ \ hunk ./src/Haddock/Convert.hs 25 +import BasicTypes hunk ./src/Haddock/Convert.hs 174 +#if __GLASGOW_HASKELL__ >= 613 hunk ./src/Haddock/Convert.hs 179 +#else + MarkedStrict -> noLoc $ HsBangTy HsStrict tySyn + MarkedUnboxed -> noLoc $ HsBangTy HsUnbox tySyn + NotMarkedStrict -> tySyn + -- HsNoBang never appears, it's implied instead. +#endif hunk ./src/Haddock/Interface.hs 53 - -- part 1, create interfaces + -- Part 1, create interfaces hunk ./src/Haddock/Interface.hs 59 - -- part 2, build link environment + -- Part 2, build link environment hunk ./src/Haddock/Interface.hs 61 - -- combine the link envs of the external packages into one + -- Combine the link envs of the external packages into one hunk ./src/Haddock/Interface.hs 63 - homeLinks = buildHomeLinks interfaces -- build the environment for the home + homeLinks = buildHomeLinks interfaces -- Build the environment for the home hunk ./src/Haddock/Interface.hs 67 - -- part 3, attach instances + -- Part 3, attach instances hunk ./src/Haddock/Interface.hs 71 - -- part 4, rename interfaces + -- Part 4, rename interfaces hunk ./src/Haddock/Interface/Create.hs 38 --- | Process the data in the GhcModule to produce an interface. +-- | Process the data in a GhcModule to produce an interface. hunk ./src/Haddock/Interface/Create.hs 40 --- sort. That's what's in the module map. -createInterface :: GhcModule -> [Flag] -> ModuleMap -> InstIfaceMap +-- sort. That's what's in the interface map. +createInterface :: GhcModule -> [Flag] -> IfaceMap -> InstIfaceMap hunk ./src/Haddock/Interface/Create.hs 423 - :: ModuleMap + :: IfaceMap hunk ./src/Haddock/Types.hs 136 -type ModuleMap = Map Module Interface +type IfaceMap = Map Module Interface hunk ./src/Documentation/Haddock.hs 14 - - hunk ./src/Haddock/Backends/DevHelp.hs 12 - hunk ./src/Haddock/Backends/HH.hs 11 - hunk ./src/Haddock/Backends/HH2.hs 11 - hunk ./src/Haddock/Backends/HaddockDB.hs 11 - hunk ./src/Haddock/Backends/Hoogle.hs 14 - hunk ./src/Haddock/Convert.hs 15 - +module Haddock.Convert where hunk ./src/Haddock/Convert.hs 18 -module Haddock.Convert where hunk ./src/Haddock/Doc.hs 30 + hunk ./src/Haddock/GhcUtils.hs 16 - hunk ./src/Haddock/Interface/AttachInstances.hs 14 - hunk ./src/Haddock/Interface/Create.hs 12 - hunk ./src/Haddock/Interface/ExtractFnArgDocs.hs 11 - hunk ./src/Haddock/Interface/LexParseRn.hs 1 - hunk ./src/Haddock/Interface/LexParseRn.hs 11 - hunk ./src/Haddock/Interface/ParseModuleHeader.hs 1 - hunk ./src/Haddock/Interface/ParseModuleHeader.hs 11 - hunk ./src/Haddock/Interface/Rename.hs 12 - hunk ./src/Haddock/Interface/Rn.hs 1 - hunk ./src/Haddock/InterfaceFile.hs 14 - hunk ./src/Haddock/ModuleTree.hs 12 - hunk ./src/Haddock/Options.hs 14 - - hunk ./src/Haddock/Utils.hs 13 - - hunk ./src/Haddock/Version.hs 11 - hunk ./src/Main.hs 18 - hunk ./src/Main.hs 71 + hunk ./src/Main.hs 334 + hunk ./src/Main.hs 346 + hunk ./src/Main.hs 426 + hunk ./src/Main.hs 437 + hunk ./src/Haddock/Convert.hs 19 + hunk ./src/Haddock/Convert.hs 39 + hunk ./src/Haddock/Convert.hs 73 + hunk ./src/Haddock/Convert.hs 79 + hunk ./src/Haddock/Convert.hs 155 + hunk ./src/Haddock/Convert.hs 210 + hunk ./src/Haddock/Convert.hs 214 + hunk ./src/Haddock/Convert.hs 222 + hunk ./src/Haddock/Convert.hs 240 + hunk ./src/Haddock/Convert.hs 255 + hunk ./src/Haddock/Convert.hs 271 + hunk ./src/Haddock/Convert.hs 311 + hunk ./src/Haddock/InterfaceFile.hs 42 + hunk ./src/Haddock/InterfaceFile.hs 127 + hunk ./src/Haddock/InterfaceFile.hs 149 + hunk ./src/Haddock/InterfaceFile.hs 210 + hunk ./src/Haddock/InterfaceFile.hs 267 + hunk ./src/Haddock/InterfaceFile.hs 279 + hunk ./src/Haddock/InterfaceFile.hs 282 + hunk ./src/Haddock/InterfaceFile.hs 306 + hunk ./src/Haddock/InterfaceFile.hs 317 --- Hmm, why didn't we dare to make this instance already? It makes things --- much easier. + hunk ./src/Haddock/ModuleTree.hs 14 + hunk ./src/Haddock/ModuleTree.hs 21 + hunk ./src/Haddock/ModuleTree.hs 24 + hunk ./src/Haddock/ModuleTree.hs 33 + hunk ./src/Haddock/ModuleTree.hs 45 + hunk ./src/Haddock/ModuleTree.hs 51 + hunk ./src/Haddock/Utils.hs 41 - -- * Binary extras --- FormatVersion, mkFormatVersion - hunk ./src/Haddock/Utils.hs 49 + hunk ./src/Haddock/Utils.hs 100 --- | extract a module's short description. +-- | Extract a module's short description. hunk ./src/Haddock/Utils.hs 104 --- | extract a module's short description. + +-- | Extract a module's short description. hunk ./src/Haddock/Utils.hs 113 + hunk ./src/Haddock/Utils.hs 127 + hunk ./src/Haddock/Utils.hs 149 + hunk ./src/Haddock/Utils.hs 163 + hunk ./src/Haddock/Utils.hs 173 + hunk ./src/Haddock/Utils.hs 177 + hunk ./src/Haddock/Utils.hs 182 + hunk ./src/Haddock/Utils.hs 189 + hunk ./src/Haddock/Utils.hs 195 + hunk ./src/Haddock/Utils.hs 201 + hunk ./src/Haddock/Utils.hs 206 + hunk ./src/Haddock/Utils.hs 216 + hunk ./src/Haddock/Utils.hs 220 + hunk ./src/Haddock/Utils.hs 229 + hunk ./src/Haddock/Utils.hs 233 + hunk ./src/Haddock/Utils.hs 240 + hunk ./src/Haddock/Utils.hs 244 + hunk ./src/Haddock/Utils.hs 248 + hunk ./src/Haddock/Utils.hs 252 + hunk ./src/Haddock/Utils.hs 256 + hunk ./src/Haddock/Utils.hs 261 + hunk ./src/Haddock/Utils.hs 266 + hunk ./src/Haddock/Utils.hs 270 + hunk ./src/Haddock/Utils.hs 290 + hunk ./src/Haddock/Utils.hs 294 + hunk ./src/Haddock/Utils.hs 315 + hunk ./src/Haddock/Utils.hs 320 + hunk ./src/Haddock/Utils.hs 338 + hunk ./src/Haddock/Utils.hs 356 + hunk ./src/Haddock/Utils.hs 360 + hunk ./src/Haddock/Utils.hs 385 + hunk ./src/Haddock/Utils.hs 388 + hunk ./src/Haddock/Utils.hs 392 + hunk ./src/Haddock/Utils.hs 396 + hunk ./src/Documentation/Haddock.hs 23 + Decl, hunk ./src/Documentation/Haddock.hs 39 + Example(..), hunk ./src/Haddock/Types.hs 163 --- | The data structure used to render a Haddock page for a module - it is --- the interface of the module. The core of Haddock lies in creating this --- structure (see Haddock.Interface). The structure also holds intermediate --- data needed during its creation. +-- | 'Interface' holds all information used to render a single Haddock page. +-- It represents the /interface/ of a module. The core business of Haddock +-- lies in creating this structure. Note that the record contains some fields +-- that are only used to create the final record, and that are not used by the +-- backends. hunk ./src/Haddock/Interface.hs 5 --- David Waern 2006-2009 +-- David Waern 2006-2010 hunk ./src/Haddock/Interface.hs 12 --- Here we build the actual module interfaces. By interface we mean the --- information that is used to render a Haddock page for a module. Parts of --- this information are also stored in the .haddock files. +-- This module typechecks Haskell modules using the GHC API and processes +-- the result to create 'Interface's. The typechecking and the 'Interface' +-- creation is interleaved, so that when a module is processed, the +-- 'Interface's of all previously processed modules are available. The +-- creation of an 'Interface' from a typechecked module is delegated to +-- "Haddock.Interface.Create". +-- +-- When all modules have been typechecked and processed, information about +-- instances are attached to each 'Interface'. This task is delegated to +-- "Haddock.Interface.AttachInstances". Note that this is done as a separate +-- step because GHC can't know about all instances until all modules have been +-- typechecked. +-- +-- As a last step a link environment is built which maps names to the \"best\" +-- places to link to in the documentation, and all 'Interface's are \"renamed\" +-- using this environment. hunk ./src/Haddock/Interface.hs 66 - -- Part 1, create interfaces + + out verbosity verbose "Creating interfaces..." hunk ./src/Haddock/Interface.hs 70 - out verbosity verbose "Creating interfaces..." hunk ./src/Haddock/Interface.hs 72 - -- Part 2, build link environment + out verbosity verbose "Attaching instances..." + interfaces' <- attachInstances interfaces instIfaceMap + hunk ./src/Haddock/Interface.hs 76 - -- Combine the link envs of the external packages into one + -- Combine the link envs of the external packages into one hunk ./src/Haddock/Interface.hs 81 - - -- Part 3, attach instances - out verbosity verbose "Attaching instances..." - interfaces' <- attachInstances interfaces instIfaceMap - - -- Part 4, rename interfaces + hunk ./src/Haddock/Utils.hs 55 -import Binary hunk ./src/Haddock/Utils.hs 64 -import Data.Word ( Word8 ) -import Data.Bits ( testBit ) hunk ./src/Haddock/GhcUtils.hs 27 +import Exception hunk ./src/Haddock/GhcUtils.hs 231 + + +------------------------------------------------------------------------------- +-- Utils that work in monads defined by GHC +------------------------------------------------------------------------------- + + +modifySessionDynFlags :: (DynFlags -> DynFlags) -> Ghc () +modifySessionDynFlags f = do + dflags <- getSessionDynFlags + _ <- setSessionDynFlags (f dflags) + return () + + +-- | A variant of 'gbracket' where the return value from the first computation +-- is not required. +gbracket_ :: ExceptionMonad m => m a -> m b -> m c -> m c +gbracket_ before after thing = gbracket before (const after) (const thing) + + +------------------------------------------------------------------------------- +-- DynFlags +------------------------------------------------------------------------------- + + +setObjectDir, setHiDir, setStubDir, setOutputDir :: String -> DynFlags -> DynFlags +setObjectDir f d = d{ objectDir = Just f} +setHiDir f d = d{ hiDir = Just f} +setStubDir f d = d{ stubDir = Just f, includePaths = f : includePaths d } + -- -stubdir D adds an implicit -I D, so that gcc can find the _stub.h file + -- \#included from the .hc file when compiling with -fvia-C. +setOutputDir f = setObjectDir f . setHiDir f . setStubDir f + hunk ./src/Haddock/Interface.hs 29 - hunk ./src/Haddock/Interface.hs 34 +import Haddock.GhcUtils +import Haddock.InterfaceFile hunk ./src/Haddock/Interface.hs 39 -import Haddock.Types hunk ./src/Haddock/Interface.hs 40 -import Haddock.GhcUtils +import Haddock.Types hunk ./src/Haddock/Interface.hs 42 -import Haddock.InterfaceFile hunk ./src/Haddock/Interface.hs 43 -import qualified Data.Map as Map +import Control.Monad hunk ./src/Haddock/Interface.hs 45 +import qualified Data.Map as Map hunk ./src/Haddock/Interface.hs 47 -import Control.Monad -import Control.Exception ( evaluate ) hunk ./src/Haddock/Interface.hs 48 +import System.Directory +import System.FilePath hunk ./src/Haddock/Interface.hs 51 -import GHC hiding (verbosity, flags) hunk ./src/Haddock/Interface.hs 52 +import Exception +import GHC hiding (verbosity, flags) hunk ./src/Haddock/Interface.hs 94 + let useTempDir = Flag_NoTmpCompDir `notElem` flags + + -- Output dir needs to be set before calling depanal since it uses it to + -- compute output file names that are stored in the DynFlags of the + -- resulting ModSummaries. + tmp <- liftIO getTemporaryDirectory + x <- liftIO getProcessID + let tempDir = tmp ".haddock-" ++ show x + when useTempDir $ modifySessionDynFlags (setOutputDir tempDir) + hunk ./src/Haddock/Interface.hs 106 + -- Dependency analysis. hunk ./src/Haddock/Interface.hs 109 - -- If template haskell is used by the package, we can not use - -- HscNothing as target since we might need to run code generated from - -- one or more of the modules during typechecking. - modgraph' <- if needsTemplateHaskell modgraph - then do - dflags <- getSessionDynFlags - _ <- setSessionDynFlags dflags { hscTarget = defaultObjectTarget } - -- we need to set defaultObjectTarget on all the ModSummaries as well - let addDefTarget m = m { ms_hspp_opts = (ms_hspp_opts m) { hscTarget = defaultObjectTarget } } - return (map addDefTarget modgraph) - else return modgraph + -- If template haskell is used by the package, we can't use HscNothing as + -- target since we might need to run code generated from one or more of the + -- modules during typechecking. + if needsTemplateHaskell modgraph + then + -- Create a temporary directory in wich to write compilation output, + -- unless the user has asked us not to. + (if useTempDir then withTempDir tempDir else id) $ do + -- Turn on compilation. + let enableComp d = d { hscTarget = defaultObjectTarget } + modifySessionDynFlags enableComp + -- We need to update the DynFlags of the ModSummaries as well. + let upd m = m { ms_hspp_opts = enableComp (ms_hspp_opts m) } + let modgraph' = map upd modgraph hunk ./src/Haddock/Interface.hs 124 - let orderedMods = flattenSCCs $ topSortModuleGraph False modgraph' Nothing - (ifaces, _) <- foldM (\(ifaces, modMap) modsum -> do - x <- processModule verbosity modsum flags modMap instIfaceMap - case x of - Just interface -> - return $ (interface : ifaces , Map.insert (ifaceMod interface) interface modMap) - Nothing -> return (ifaces, modMap) - ) ([], Map.empty) orderedMods + processModules verbosity flags instIfaceMap modgraph' + else + processModules verbosity flags instIfaceMap modgraph + + +withTempDir :: (ExceptionMonad m, MonadIO m) => FilePath -> m a -> m a +withTempDir dir = gbracket_ (liftIO $ createDirectory dir) + (liftIO $ removeDirectoryRecursive dir) + + +processModules :: Verbosity -> [Flag] -> InstIfaceMap -> [ModSummary] + -> Ghc [Interface] +processModules verbosity flags instIfaceMap mods = do + let sortedMods = flattenSCCs $ topSortModuleGraph False mods Nothing + (ifaces, _) <- foldM f ([], Map.empty) sortedMods hunk ./src/Haddock/Interface.hs 140 + where + f (ifaces, ifaceMap) modSummary = do + x <- processModule verbosity modSummary flags ifaceMap instIfaceMap + return $ case x of + Just iface -> (iface:ifaces, Map.insert (ifaceMod iface) iface ifaceMap) + Nothing -> (ifaces, ifaceMap) -- Boot modules don't generate ifaces. hunk ./src/Haddock/Interface.hs 148 -processModule :: Verbosity -> ModSummary -> [Flag] -> ModuleMap -> InstIfaceMap -> Ghc (Maybe Interface) +processModule :: Verbosity -> ModSummary -> [Flag] -> IfaceMap -> InstIfaceMap -> Ghc (Maybe Interface) hunk ./src/Haddock/Options.hs 95 + | Flag_NoTmpCompDir hunk ./src/Haddock/Options.hs 166 - Option ['w'] ["no-warnings"] (NoArg Flag_NoWarnings) "turn off all warnings" + Option ['w'] ["no-warnings"] (NoArg Flag_NoWarnings) "turn off all warnings", + Option [] ["no-tmp-comp-dir"] (NoArg Flag_NoTmpCompDir) + "don't re-direct compilation output to a temporary directory" hunk ./src/Haddock/Utils.hs 46 - out + out, + + -- * System tools + getProcessID hunk ./src/Haddock/Utils.hs 75 +#ifndef mingw32_HOST_OS +import qualified System.Posix.Internals +#else /* Must be Win32 */ +import Foreign +import Foreign.C.String +#endif + hunk ./src/Haddock/Utils.hs 389 ------------------------------------------------------------------------------ --- put here temporarily - - -newtype FormatVersion = FormatVersion Int deriving (Eq,Ord) - - -nullFormatVersion :: FormatVersion -nullFormatVersion = mkFormatVersion 0 - +-- ----------------------------------------------------------------------------- +-- System tools hunk ./src/Haddock/Utils.hs 392 -mkFormatVersion :: Int -> FormatVersion -mkFormatVersion = FormatVersion hunk ./src/Haddock/Utils.hs 393 +#ifdef mingw32_HOST_OS +foreign import ccall unsafe "_getpid" getProcessID :: IO Int -- relies on Int == Int32 on Windows +#else +getProcessID :: IO Int +getProcessID = System.Posix.Internals.c_getpid >>= return . fromIntegral +#endif hunk ./src/Haddock/Utils.hs 400 -instance Binary FormatVersion where - put_ bh (FormatVersion i) = - case compare i 0 of - EQ -> return () - GT -> put_ bh (-i) - LT -> error ( - "Binary.hs: negative FormatVersion " ++ show i - ++ " is not allowed") - get bh = - do - (w8 :: Word8) <- get bh - if testBit w8 7 - then - do - i <- get bh - return (FormatVersion (-i)) - else - return nullFormatVersion hunk ./src/Haddock/Options.hs 12 --- Definition of the command line interface of Haddock +-- Definition of the command line interface of Haddock. hunk ./src/Main.hs 169 -------------------------------------------------------------------------------- --- Rendering -------------------------------------------------------------------------------- - - --- | Render the interfaces with whatever backend is specified in the flags +-- | Render the interfaces with whatever backend is specified in the flags. hunk ./src/Main.hs 293 + hunk ./src/Main.hs 137 - -- We have one global error handler for all GHC source errors. Other kinds - -- of exceptions will be propagated to the top-level error handler. + -- Catches all GHC source errors, then prints and re-throws them. hunk ./src/Main.hs 142 - -- initialize GHC + -- Initialize GHC. hunk ./src/Main.hs 120 - -- parse command-line flags and handle some of them initially + -- Parse command-line flags and handle some of them initially. hunk ./src/Main.hs 145 - -- get packages supplied with --read-interface + -- Get packages supplied with --read-interface. hunk ./src/Main.hs 148 - - -- create the interfaces -- this is the core part of Haddock + -- Create the interfaces -- this is the core part of Haddock. hunk ./src/Main.hs 151 - hunk ./src/Main.hs 152 - -- render the interfaces + -- Render the interfaces. hunk ./src/Main.hs 155 - -- last but not least, dump the interface file + -- Last but not least, dump the interface file. hunk ./src/Main.hs 159 - -- get packages supplied with --read-interface + -- Get packages supplied with --read-interface. hunk ./src/Main.hs 162 - -- render even though there are no input files (usually contents/index) + -- Render even though there are no input files (usually contents/index). hunk ./src/Haddock/Interface.hs 82 - + hunk ./doc/haddock.xml 810 + + + + + If the input modules use Template Haskell, Haddock has to + perform compilation (using GHC). This results in .o, .hi, and stub files that + are written to a temporary directory by default. When this flag is specified, + however, the files are written to the present directory (or another path if you + tell GHC, for example like this: --optghc=-odir --optghc=path). + Note that not only will files be written to this directory, GHC will also look for + already existing files there, and use them in order to skip compilation. + + + + + + hunk ./src/Haddock/Utils.hs 121 -restrictTo :: [Name] -> (LHsDecl Name) -> (LHsDecl Name) +restrictTo :: [Name] -> LHsDecl Name -> LHsDecl Name hunk ./src/Haddock/Utils.hs 397 -getProcessID = System.Posix.Internals.c_getpid >>= return . fromIntegral +getProcessID = fmap fromIntegral System.Posix.Internals.c_getpid hunk ./haddock.cabal 72 - base >= 4.0.0.0 && < 4.3.0.0, + base >= 4.0.0.0 && < 4.4.0.0, hunk ./haddock.cabal 128 - base >= 4.0.0.0 && < 4.3.0.0, + base >= 4.0.0.0 && < 4.4.0.0, hunk ./haddock.cabal 78 + xhtml >= 3000.2 && < 3000.3, addfile ./html/xhaddock.css hunk ./html/xhaddock.css 1 +* { + margin: 0; + padding: 0; +} + +body { + background-color: #ffffff; + color: #000000; + font-size: 100%; + font-family: sans-serif; + padding: 8px; +} + +a:link { color: #0000e0; text-decoration: none } +a:visited { color: #0000a0; text-decoration: none } +a:hover { background-color: #e0e0ff; text-decoration: none } + +/* font is a little too small in MSIE */ +tt { font-size: 100%; } +pre { font-size: 100%; } +span.keyword { text-decoration: underline; } + +h1 { + padding-top: 15px; + font-weight: bold; + font-size: 150% + } + +h2 { + padding-top: 10px; + font-weight: bold; + font-size: 130% + } + +h3 { + padding-top: 5px; + font-weight: bold; + font-size: 110% + } + +h4 { + font-weight: bold; + font-size: 100% + } + +p { + padding-top: 2px; + padding-left: 10px; + margin-bottom: 1em; +} + +pre { + padding-top: 2px; + padding-left: 20px; + margin-bottom: 1em; +} + +h1 + p, h2 + p, h3 + p, h4 + p { + margin-top: 1em; +} + +p.caption { + margin: 0; + padding: 0; +} + +div.package-header { + color: #ffffff; + padding: 5px 5px 5px 31px; + margin: 0 0 1px; + background: #000099 url(haskell_icon.gif) no-repeat 5px 6px; + position: relative; +} + +div.package-header a:link { color: #ffffff } +div.package-header a:visited { color: #ffff00 } +div.package-header a:hover { background-color: #6060ff; } +div.package-header ul.links li:hover { background-color: #6060ff; } + +ul.links { + list-style: none; + text-align: left; + position: absolute; + right: 5px; + top: 5px; + display: inline-table; +} + +ul.links li { + display: inline; + border-left-width: 1px; + border-left-color: #ffffff; + border-left-style: solid; + white-space: nowrap; + padding: 1px 5px; +} + +div.module-header { + background-color: #0077dd; + padding: 5px; + position: relative; + height: 3em; +} + +div.module-header p { + font-size: 200%; + height: 1.5em; + padding-top: .25em; +} + +dl.info { + color: #ffffff; + display: block; + position: absolute; + top: 3px; + right: 5px; +} + +dl.info dt { + float: left; + width: 5em; + font-weight: bold; + display: block; +} + +dl.info dd { + display: block; + padding-left: 6em; +} + +div.table-of-contents { + margin-top: 1em; + margin-bottom: 1em; +} + +div.table-of-contents p { + font-weight: bold; +} + +div.table-of-contents ul { + margin-top: 1em; + margin-bottom: 1em; + list-style-type: none; +} + +div.table-of-contents ul ul { + margin-left: 2.5em; +} + +ul.synopsis { + margin-top: 1em; + margin-bottom: 1em; +} +ul.synopsis li { + background-color: #f0f0f0; + font-family: monospace; + vertical-align: top; + margin-top: 8px; + margin-bottom: 8px; + padding: 2px; + margin-left: 10px; + list-style-type: none; +} + + +p.decl { + padding: 3px; + background-color: #f0f0f0; + font-family: monospace; + margin-bottom: 0; +} + + +p.decl a.link { + float: right; + border-left-width: 1px; + border-left-color: #000099; + border-left-style: solid; + white-space: nowrap; + font-size: small; + padding: 0 4px 2px 5px; +} + +p.arg { + margin-bottom: 0; +} +p.arg span { + background-color: #f0f0f0; + font-family: monospace; + white-space: nowrap; + float: none; +} + +p.inst-header { + font-weight: bold; + margin-bottom: 0; +} + +p.inst-header img { + width : 0.75em; height: 0.75em; margin-bottom: 0; margin-right: 0.5em +} + +ul.int { + margin-top: 1em; + margin-bottom: 1em; +} +ul.inst li { + background-color: #f0f0f0; + font-family: monospace; + vertical-align: top; + margin-top: 1px; + margin-bottom: 1px; + padding: 2px; + margin-left: 20px; + list-style-type: none; +} + + + +div.bottom { + background-color: #000099; + color: #ffffff; + padding: 5px + } +div.bottom a:link { + color: #ffffff; + text-decoration: underline + } +div.bottom a:visited { + color: #ffff00 + } +div.bottom a:hover { + background-color: #6060ff + } + +/* @group Original Selectors */ + +/* --------- Contents page ---------- */ + +div.node { + padding-left: 3em; +} + +div.cnode { + padding-left: 1.75em; +} + +span.pkg { + position: absolute; + left: 50em; +} + +/* --------- Mini Synopsis for Frame View --------- */ + +.outer { + margin: 0 0; + padding: 0 0; +} + +.mini-synopsis { + padding: 0.25em 0.25em; +} + +.mini-synopsis h1 { font-size: 130%; } +.mini-synopsis h2 { font-size: 110%; } +.mini-synopsis h3 { font-size: 100%; } +.mini-synopsis h1, .mini-synopsis h2, .mini-synopsis h3 { + margin-top: 0.5em; + margin-bottom: 0.25em; + padding: 0 0; +} + +.mini-synopsis h1 { border-bottom: 1px solid #ccc; } + +.mini-topbar { + font-size: 130%; + background: #0077dd; + padding: 0.25em; +} + +/* @end */ + + + + + adddir ./src/Haddock/Backends/Xhtml addfile ./src/Haddock/Backends/Xhtml.hs hunk ./src/Haddock/Backends/Xhtml.hs 1 +----------------------------------------------------------------------------- +-- | +-- Module : Haddock.Backends.Html +-- Copyright : (c) Simon Marlow 2003-2006, +-- David Waern 2006-2009, +-- Mark Lentczner 2010 +-- License : BSD-like +-- +-- Maintainer : haddock@projects.haskell.org +-- Stability : experimental +-- Portability : portable +----------------------------------------------------------------------------- + +module Haddock.Backends.Xhtml ( + ppHtml, copyHtmlBits, + ppHtmlIndex, ppHtmlContents, + ppHtmlHelpFiles +) where + + +import Prelude hiding (div) + +import Haddock.Backends.DevHelp +import Haddock.Backends.HH +import Haddock.Backends.HH2 +import Haddock.Backends.Xhtml.Decl +import Haddock.Backends.Xhtml.DocMarkup +import Haddock.Backends.Xhtml.Layout +import Haddock.Backends.Xhtml.Names +import Haddock.Backends.Xhtml.Types +import Haddock.Backends.Xhtml.Util +import Haddock.ModuleTree +import Haddock.Types +import Haddock.Version +import Haddock.Utils +import Text.XHtml hiding ( name, title, p, quote ) +import qualified Text.XHtml as Html +import Haddock.GhcUtils + +import Control.Exception ( bracket ) +import Control.Monad ( when, unless ) +import Control.Monad.Instances ( ) -- for Functor Either a +import Data.Char ( toUpper ) +import Data.Either +import Data.List ( sortBy, groupBy ) +import Data.Maybe +import Foreign.Marshal.Alloc ( allocaBytes ) +import System.IO ( IOMode(..), hClose, hGetBuf, hPutBuf, openFile ) +import System.Directory hiding ( copyFile ) +import Data.Map ( Map ) +import qualified Data.Map as Map hiding ( Map ) +import Data.Function +import Data.Ord ( comparing ) + +import GHC hiding ( NoLink, moduleInfo ) +import Name +import Module + + + +-- ----------------------------------------------------------------------------- +-- Generating HTML documentation + +ppHtml :: String + -> Maybe String -- package + -> [Interface] + -> FilePath -- destination directory + -> Maybe (Doc GHC.RdrName) -- prologue text, maybe + -> Maybe String -- the Html Help format (--html-help) + -> SourceURLs -- the source URL (--source) + -> WikiURLs -- the wiki URL (--wiki) + -> Maybe String -- the contents URL (--use-contents) + -> Maybe String -- the index URL (--use-index) + -> Bool -- whether to use unicode in output (--use-unicode) + -> IO () + +ppHtml doctitle maybe_package ifaces odir prologue maybe_html_help_format + maybe_source_url maybe_wiki_url + maybe_contents_url maybe_index_url unicode = do + let + visible_ifaces = filter visible ifaces + visible i = OptHide `notElem` ifaceOptions i + when (not (isJust maybe_contents_url)) $ + ppHtmlContents odir doctitle maybe_package + maybe_html_help_format maybe_index_url maybe_source_url maybe_wiki_url + (map toInstalledIface visible_ifaces) + False -- we don't want to display the packages in a single-package contents + prologue + + when (not (isJust maybe_index_url)) $ + ppHtmlIndex odir doctitle maybe_package maybe_html_help_format + maybe_contents_url maybe_source_url maybe_wiki_url + (map toInstalledIface visible_ifaces) + + when (not (isJust maybe_contents_url && isJust maybe_index_url)) $ + ppHtmlHelpFiles doctitle maybe_package ifaces odir maybe_html_help_format [] + + mapM_ (ppHtmlModule odir doctitle + maybe_source_url maybe_wiki_url + maybe_contents_url maybe_index_url unicode) visible_ifaces + +ppHtmlHelpFiles + :: String -- doctitle + -> Maybe String -- package + -> [Interface] + -> FilePath -- destination directory + -> Maybe String -- the Html Help format (--html-help) + -> [FilePath] -- external packages paths + -> IO () +ppHtmlHelpFiles doctitle maybe_package ifaces odir maybe_html_help_format pkg_paths = do + let + visible_ifaces = filter visible ifaces + visible i = OptHide `notElem` ifaceOptions i + + -- Generate index and contents page for Html Help if requested + case maybe_html_help_format of + Nothing -> return () + Just "mshelp" -> ppHHProject odir doctitle maybe_package visible_ifaces pkg_paths + Just "mshelp2" -> do + ppHH2Files odir maybe_package visible_ifaces pkg_paths + ppHH2Collection odir doctitle maybe_package + Just "devhelp" -> ppDevHelpFile odir doctitle maybe_package visible_ifaces + Just format -> fail ("The "++format++" format is not implemented") + +copyFile :: FilePath -> FilePath -> IO () +copyFile fromFPath toFPath = + (bracket (openFile fromFPath ReadMode) hClose $ \hFrom -> + bracket (openFile toFPath WriteMode) hClose $ \hTo -> + allocaBytes bufferSize $ \buffer -> + copyContents hFrom hTo buffer) + where + bufferSize = 1024 + + copyContents hFrom hTo buffer = do + count <- hGetBuf hFrom buffer bufferSize + when (count > 0) $ do + hPutBuf hTo buffer count + copyContents hFrom hTo buffer + + +copyHtmlBits :: FilePath -> FilePath -> Maybe FilePath -> IO () +copyHtmlBits odir libdir maybe_css = do + let + libhtmldir = pathJoin [libdir, "html"] + css_file = case maybe_css of + Nothing -> pathJoin [libhtmldir, 'x':cssFile] + Just f -> f + css_destination = pathJoin [odir, cssFile] + copyLibFile f = do + copyFile (pathJoin [libhtmldir, f]) (pathJoin [odir, f]) + copyFile css_file css_destination + mapM_ copyLibFile [ iconFile, plusFile, minusFile, jsFile, framesFile ] + +footer :: Html +footer = + thediv ! [theclass "bottom"] << paragraph << ( + "Produced by " +++ + (anchor ! [href projectUrl] << toHtml projectName) +++ + (" version " ++ projectVersion) + ) + +srcButton :: SourceURLs -> Maybe Interface -> Maybe Html +srcButton (Just src_base_url, _, _) Nothing = + Just (anchor ! [href src_base_url] << "Source code") +srcButton (_, Just src_module_url, _) (Just iface) = + let url = spliceURL (Just $ ifaceOrigFilename iface) + (Just $ ifaceMod iface) Nothing Nothing src_module_url + in Just (anchor ! [href url] << "Source code") +srcButton _ _ = + Nothing + + +wikiButton :: WikiURLs -> Maybe Module -> Maybe Html +wikiButton (Just wiki_base_url, _, _) Nothing = + Just (anchor ! [href wiki_base_url] << "User Comments") + +wikiButton (_, Just wiki_module_url, _) (Just mdl) = + let url = spliceURL Nothing (Just mdl) Nothing Nothing wiki_module_url + in Just (anchor ! [href url] << "User Comments") + +wikiButton _ _ = + Nothing + +contentsButton :: Maybe String -> Maybe Html +contentsButton maybe_contents_url + = Just (anchor ! [href url] << "Contents") + where url = maybe contentsHtmlFile id maybe_contents_url + +indexButton :: Maybe String -> Maybe Html +indexButton maybe_index_url + = Just (anchor ! [href url] << "Index") + where url = maybe indexHtmlFile id maybe_index_url + +simpleHeader :: String -> Maybe String -> Maybe String + -> SourceURLs -> WikiURLs -> Html +simpleHeader doctitle maybe_contents_url maybe_index_url + maybe_source_url maybe_wiki_url = + thediv ! [theclass "package-header"] << ( + paragraph ! [theclass "caption"] << doctitle +++ + unordList (catMaybes [ + srcButton maybe_source_url Nothing, + wikiButton maybe_wiki_url Nothing, + contentsButton maybe_contents_url, + indexButton maybe_index_url + ]) ! [theclass "links"] + ) + +pageHeader :: String -> Interface -> String + -> SourceURLs -> WikiURLs + -> Maybe String -> Maybe String -> Html +pageHeader mdl iface doctitle + maybe_source_url maybe_wiki_url + maybe_contents_url maybe_index_url = + thediv ! [theclass "package-header"] << ( + paragraph ! [theclass "caption"] << (doctitle +++ spaceHtml) +++ + unordList (catMaybes [ + srcButton maybe_source_url (Just iface), + wikiButton maybe_wiki_url (Just $ ifaceMod iface), + contentsButton maybe_contents_url, + indexButton maybe_index_url + ]) ! [theclass "links"] + ) +++ + thediv ! [theclass "module-header"] << ( + paragraph ! [theclass "caption"] << mdl +++ + moduleInfo iface + ) + +moduleInfo :: Interface -> Html +moduleInfo iface = + let + info = ifaceInfo iface + + doOneEntry :: (String, (HaddockModInfo GHC.Name) -> Maybe String) -> Maybe (String, String) + doOneEntry (fieldName, field) = field info >>= \a -> return (fieldName, a) + + entries :: [(String, String)] + entries = mapMaybe doOneEntry [ + ("Portability",hmi_portability), + ("Stability",hmi_stability), + ("Maintainer",hmi_maintainer) + ] + in + case entries of + [] -> noHtml + _ -> defList entries ! [theclass "info"] + +-- --------------------------------------------------------------------------- +-- Generate the module contents + +ppHtmlContents + :: FilePath + -> String + -> Maybe String + -> Maybe String + -> Maybe String + -> SourceURLs + -> WikiURLs + -> [InstalledInterface] -> Bool -> Maybe (Doc GHC.RdrName) + -> IO () +ppHtmlContents odir doctitle + maybe_package maybe_html_help_format maybe_index_url + maybe_source_url maybe_wiki_url ifaces showPkgs prologue = do + let tree = mkModuleTree showPkgs + [(instMod iface, toInstalledDescription iface) | iface <- ifaces] + html = + header + (documentCharacterEncoding +++ + thetitle (toHtml doctitle) +++ + styleSheet +++ + (script ! [src jsFile, thetype "text/javascript"] $ noHtml)) +++ + body << ( + simpleHeader doctitle Nothing maybe_index_url + maybe_source_url maybe_wiki_url +++ + vanillaTable << ( + ppPrologue doctitle prologue + ppModuleTree doctitle tree) +++ + footer + ) + createDirectoryIfMissing True odir + writeFile (pathJoin [odir, contentsHtmlFile]) (renderToString html) + + -- XXX: think of a better place for this? + ppHtmlContentsFrame odir doctitle ifaces + + -- Generate contents page for Html Help if requested + case maybe_html_help_format of + Nothing -> return () + Just "mshelp" -> ppHHContents odir doctitle maybe_package tree + Just "mshelp2" -> ppHH2Contents odir doctitle maybe_package tree + Just "devhelp" -> return () + Just format -> fail ("The "++format++" format is not implemented") + +ppPrologue :: String -> Maybe (Doc GHC.RdrName) -> HtmlTable +ppPrologue _ Nothing = emptyTable +ppPrologue title (Just doc) = + (tda [theclass "section1"] << toHtml title) + docBox (rdrDocToHtml doc) + +ppModuleTree :: String -> [ModuleTree] -> HtmlTable +ppModuleTree _ ts = + tda [theclass "section1"] << toHtml "Modules" + td << vanillaTable2 << htmlTable + where + genTable tbl id_ [] = (tbl, id_) + genTable tbl id_ (x:xs) = genTable (tbl u) id' xs + where + (u,id') = mkNode [] x 0 id_ + + (htmlTable,_) = genTable emptyTable 0 ts + +mkNode :: [String] -> ModuleTree -> Int -> Int -> (HtmlTable,Int) +mkNode ss (Node s leaf pkg short ts) depth id_ = htmlNode + where + htmlNode = case ts of + [] -> (td_pad_w 1.25 depth << htmlModule <-> shortDescr <-> htmlPkg,id_) + _ -> (td_w depth << (collapsebutton id_s +++ htmlModule) <-> shortDescr <-> htmlPkg + (td_subtree << sub_tree), id') + + mod_width = 50::Int {-em-} + + td_pad_w :: Double -> Int -> Html -> HtmlTable + td_pad_w pad depth_ = + tda [thestyle ("padding-left: " ++ show pad ++ "em;" ++ + "width: " ++ show (mod_width - depth_*2) ++ "em")] + + td_w depth_ = + tda [thestyle ("width: " ++ show (mod_width - depth_*2) ++ "em")] + + td_subtree = + tda [thestyle ("padding: 0; padding-left: 2em")] + + shortDescr :: HtmlTable + shortDescr = case short of + Nothing -> cell $ td empty + Just doc -> tda [theclass "rdoc"] (origDocToHtml doc) + + htmlModule + | leaf = ppModule (mkModule (stringToPackageId pkgName) + (mkModuleName mdl)) "" + | otherwise = toHtml s + + -- ehm.. TODO: change the ModuleTree type + (htmlPkg, pkgName) = case pkg of + Nothing -> (td << empty, "") + Just p -> (td << toHtml p, p) + + mdl = foldr (++) "" (s' : map ('.':) ss') + (s':ss') = reverse (s:ss) + -- reconstruct the module name + + id_s = "n." ++ show id_ + + (sub_tree,id') = genSubTree emptyTable (id_+1) ts + + genSubTree :: HtmlTable -> Int -> [ModuleTree] -> (Html,Int) + genSubTree htmlTable id__ [] = (sub_tree_, id__) + where + sub_tree_ = collapsed vanillaTable2 id_s htmlTable + genSubTree htmlTable id__ (x:xs) = genSubTree (htmlTable u) id__' xs + where + (u,id__') = mkNode (s:ss) x (depth+1) id__ + + +-- | 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 -> [InstalledInterface] -> IO () +ppHtmlContentsFrame odir doctitle ifaces = do + let mods = flatModuleTree ifaces + html = + header + (documentCharacterEncoding +++ + thetitle (toHtml doctitle) +++ + styleSheet +++ + (script ! [src jsFile, thetype "text/javascript"] $ noHtml)) +++ + body << vanillaTable << Html.p << ( + foldr (+++) noHtml (map (+++br) mods)) + createDirectoryIfMissing True odir + writeFile (pathJoin [odir, frameIndexHtmlFile]) (renderToString html) + +-- --------------------------------------------------------------------------- +-- Generate the index + +ppHtmlIndex :: FilePath + -> String + -> Maybe String + -> Maybe String + -> Maybe String + -> SourceURLs + -> WikiURLs + -> [InstalledInterface] + -> IO () +ppHtmlIndex odir doctitle maybe_package maybe_html_help_format + maybe_contents_url maybe_source_url maybe_wiki_url ifaces = do + let html = + header (documentCharacterEncoding +++ + thetitle (toHtml (doctitle ++ " (Index)")) +++ + styleSheet +++ + (script ! [src jsFile, thetype "text/javascript"] $ noHtml)) +++ + body << ( + simpleHeader doctitle maybe_contents_url Nothing + maybe_source_url maybe_wiki_url +++ + vanillaTable << index_html + ) + + createDirectoryIfMissing True odir + + when split_indices $ + mapM_ (do_sub_index index) initialChars + + writeFile (pathJoin [odir, indexHtmlFile]) (renderToString html) + + -- Generate index and contents page for Html Help if requested + case maybe_html_help_format of + Nothing -> return () + Just "mshelp" -> ppHHIndex odir maybe_package ifaces + Just "mshelp2" -> ppHH2Index odir maybe_package ifaces + Just "devhelp" -> return () + Just format -> fail ("The "++format++" format is not implemented") + where + + index_html + | split_indices = + tda [theclass "section1"] << + toHtml ("Index") + indexInitialLetterLinks + | otherwise = + cell $ td << setTrClass (table ! [identifier "indexlist", cellpadding 0, cellspacing 5] << + aboves (map indexElt index)) + + -- an arbitrary heuristic: + -- too large, and a single-page will be slow to load + -- too small, and we'll have lots of letter-indexes with only one + -- or two members in them, which seems inefficient or + -- unnecessarily hard to use. + split_indices = length index > 150 + + setTrClass :: Html -> Html + setTrClass = id + -- XHtml is more strict about not allowing you to poke inside a structure + -- hence this approach won't work for now -- since the whole table is + -- going away soon, this is just disabled for now. +{- + setTrClass (Html xs) = Html $ map f xs + where + f (HtmlTag name attrs inner) + | map toUpper name == "TR" = HtmlTag name (theclass "indexrow":attrs) inner + | otherwise = HtmlTag name attrs (setTrClass inner) + f x = x +-} + indexInitialLetterLinks = + td << setTrClass (table ! [cellpadding 0, cellspacing 5] << + besides [ td << anchor ! [href (subIndexHtmlFile c)] << + toHtml [c] + | c <- initialChars + , any ((==c) . toUpper . head . fst) index ]) + + -- todo: what about names/operators that start with Unicode + -- characters? + -- Exports beginning with '_' can be listed near the end, + -- presumably they're not as important... but would be listed + -- with non-split index! + initialChars = [ 'A'..'Z' ] ++ ":!#$%&*+./<=>?@\\^|-~" ++ "_" + + do_sub_index this_ix c + = unless (null index_part) $ + writeFile (pathJoin [odir, subIndexHtmlFile c]) (renderToString html) + where + html = header (documentCharacterEncoding +++ + thetitle (toHtml (doctitle ++ " (Index)")) +++ + styleSheet) +++ + body << ( + simpleHeader doctitle maybe_contents_url Nothing + maybe_source_url maybe_wiki_url +++ + vanillaTable << ( + indexInitialLetterLinks + tda [theclass "section1"] << + toHtml ("Index (" ++ c:")") + td << setTrClass (table ! [identifier "indexlist", cellpadding 0, cellspacing 5] << + aboves (map indexElt index_part) ) + )) + + index_part = [(n,stuff) | (n,stuff) <- this_ix, toUpper (head n) == c] + + + index :: [(String, Map GHC.Name [(Module,Bool)])] + index = sortBy cmp (Map.toAscList full_index) + where cmp (n1,_) (n2,_) = map toUpper n1 `compare` map toUpper n2 + + -- for each name (a plain string), we have a number of original HsNames that + -- it can refer to, and for each of those we have a list of modules + -- that export that entity. Each of the modules exports the entity + -- in a visible or invisible way (hence the Bool). + full_index :: Map String (Map GHC.Name [(Module,Bool)]) + full_index = Map.fromListWith (flip (Map.unionWith (++))) + (concat (map getIfaceIndex ifaces)) + + getIfaceIndex iface = + [ (getOccString name + , Map.fromList [(name, [(mdl, name `elem` instVisibleExports iface)])]) + | name <- instExports iface ] + where mdl = instMod iface + + indexElt :: (String, Map GHC.Name [(Module,Bool)]) -> HtmlTable + indexElt (str, entities) = + case Map.toAscList entities of + [(nm,entries)] -> + tda [ theclass "indexentry" ] << toHtml str <-> + indexLinks nm entries + many_entities -> + tda [ theclass "indexentry" ] << toHtml str + aboves (map doAnnotatedEntity (zip [1..] many_entities)) + + doAnnotatedEntity :: (Integer, (Name, [(Module, Bool)])) -> HtmlTable + doAnnotatedEntity (j,(nm,entries)) + = tda [ theclass "indexannot" ] << + toHtml (show j) <+> parens (ppAnnot (nameOccName nm)) <-> + indexLinks nm entries + + ppAnnot n | not (isValOcc n) = toHtml "Type/Class" + | isDataOcc n = toHtml "Data Constructor" + | otherwise = toHtml "Function" + + indexLinks nm entries = + tda [ theclass "indexlinks" ] << + hsep (punctuate comma + [ if visible then + linkId mdl (Just nm) << toHtml (moduleString mdl) + else + toHtml (moduleString mdl) + | (mdl, visible) <- entries ]) + +-- --------------------------------------------------------------------------- +-- Generate the HTML page for a module + +ppHtmlModule + :: FilePath -> String + -> SourceURLs -> WikiURLs + -> Maybe String -> Maybe String -> Bool + -> Interface -> IO () +ppHtmlModule odir doctitle + maybe_source_url maybe_wiki_url + maybe_contents_url maybe_index_url unicode iface = do + let + mdl = ifaceMod iface + mdl_str = moduleString mdl + html = + header (documentCharacterEncoding +++ + thetitle (toHtml mdl_str) +++ + styleSheet +++ + (script ! [src jsFile, thetype "text/javascript"] $ noHtml) +++ + (script ! [thetype "text/javascript"] + -- XXX: quoting errors possible? + << ("window.onload = function () {setSynopsis(\"mini_" + ++ moduleHtmlFile mdl ++ "\")};")) + ) +++ + body << ( + pageHeader mdl_str iface doctitle + maybe_source_url maybe_wiki_url + maybe_contents_url maybe_index_url +++ + ifaceToHtml maybe_source_url maybe_wiki_url iface unicode +++ + footer) + + createDirectoryIfMissing True odir + writeFile (pathJoin [odir, moduleHtmlFile mdl]) (renderToString html) + ppHtmlModuleMiniSynopsis odir doctitle iface unicode + +ppHtmlModuleMiniSynopsis :: FilePath -> String -> Interface -> Bool -> IO () +ppHtmlModuleMiniSynopsis odir _doctitle iface unicode = do + let mdl = ifaceMod iface + html = + header + (documentCharacterEncoding +++ + thetitle (toHtml $ moduleString mdl) +++ + styleSheet +++ + (script ! [src jsFile, thetype "text/javascript"] $ noHtml)) +++ + body << thediv ! [ theclass "outer" ] << ( + (thediv ! [theclass "mini-topbar"] + << toHtml (moduleString mdl)) +++ + miniSynopsis mdl iface unicode) + createDirectoryIfMissing True odir + writeFile (pathJoin [odir, "mini_" ++ moduleHtmlFile mdl]) (renderToString html) + +ifaceToHtml :: SourceURLs -> WikiURLs -> Interface -> Bool -> Html +ifaceToHtml maybe_source_url maybe_wiki_url iface unicode + = ppModuleContents exports +++ + description +++ + synopsis +++ + maybe_doc_hdr +++ + bdy + where + exports = numberSectionHeadings (ifaceRnExportItems iface) + + -- todo: if something has only sub-docs, or fn-args-docs, should + -- it be measured here and thus prevent omitting the synopsis? + has_doc (ExportDecl _ doc _ _) = isJust (fst doc) + has_doc (ExportNoDecl _ _) = False + has_doc (ExportModule _) = False + has_doc _ = True + + no_doc_at_all = not (any has_doc exports) + + description + = case ifaceRnDoc iface of + Nothing -> noHtml + Just doc -> h1 << toHtml "Description" +++ docToHtml doc + + -- omit the synopsis if there are no documentation annotations at all + synopsis + | no_doc_at_all = noHtml + | otherwise + = h1 << "Synopsis" +++ + unordList ( + rights $ + map (processExport True linksInfo unicode) exports + ) ! [theclass "synopsis"] + + -- if the documentation doesn't begin with a section header, then + -- add one ("Documentation"). + maybe_doc_hdr + = case exports of + [] -> noHtml + ExportGroup _ _ _ : _ -> noHtml + _ -> h1 << "Documentation" + + bdy = + foldr (+++) noHtml $ + map (either id (paragraph ! [theclass "decl"] <<)) $ + map (processExport False linksInfo unicode) exports + + linksInfo = (maybe_source_url, maybe_wiki_url) + +miniSynopsis :: Module -> Interface -> Bool -> Html +miniSynopsis mdl iface unicode = + thediv ! [ theclass "mini-synopsis" ] + << hsep (map (processForMiniSynopsis mdl unicode) $ exports) + where + exports = numberSectionHeadings (ifaceRnExportItems iface) + +processForMiniSynopsis :: Module -> Bool -> ExportItem DocName -> Html +processForMiniSynopsis mdl unicode (ExportDecl (L _loc decl0) _doc _ _insts) = + thediv ! [theclass "decl" ] << + case decl0 of + TyClD d@(TyFamily{}) -> ppTyFamHeader True False d unicode + TyClD d@(TyData{tcdTyPats = ps}) + | Nothing <- ps -> keyword "data" <++> ppTyClBinderWithVarsMini mdl d + | Just _ <- ps -> keyword "data" <++> keyword "instance" + <++> ppTyClBinderWithVarsMini mdl d + TyClD d@(TySynonym{tcdTyPats = ps}) + | Nothing <- ps -> keyword "type" <++> ppTyClBinderWithVarsMini mdl d + | Just _ <- ps -> keyword "type" <++> keyword "instance" + <++> ppTyClBinderWithVarsMini mdl d + TyClD d@(ClassDecl {}) -> + keyword "class" <++> ppTyClBinderWithVarsMini mdl d + SigD (TypeSig (L _ n) (L _ _)) -> + let nm = docNameOcc n + in ppNameMini mdl nm + _ -> noHtml +processForMiniSynopsis _ _ (ExportGroup lvl _id txt) = + let heading + | lvl == 1 = h1 + | lvl == 2 = h2 + | lvl >= 3 = h3 + | otherwise = error "bad group level" + in heading << docToHtml txt +processForMiniSynopsis _ _ _ = noHtml + +ppNameMini :: Module -> OccName -> Html +ppNameMini mdl nm = + anchor ! [ href ( moduleHtmlFile mdl ++ "#" + ++ (escapeStr (anchorNameStr nm))) + , target mainFrameName ] + << ppBinder' nm + +ppTyClBinderWithVarsMini :: Module -> TyClDecl DocName -> Html +ppTyClBinderWithVarsMini mdl decl = + let n = unLoc $ tcdLName decl + ns = tyvarNames $ tcdTyVars decl + in ppTypeApp n ns (ppNameMini mdl . docNameOcc) ppTyName + +ppModuleContents :: [ExportItem DocName] -> Html +ppModuleContents exports + | null sections = noHtml + | otherwise = contentsDiv + where + contentsDiv = thediv ! [theclass "table-of-contents"] << ( + paragraph ! [theclass "caption"] << "Contents" +++ + unordList sections) + + (sections, _leftovers{-should be []-}) = process 0 exports + + process :: Int -> [ExportItem DocName] -> ([Html],[ExportItem DocName]) + process _ [] = ([], []) + process n items@(ExportGroup lev id0 doc : rest) + | lev <= n = ( [], items ) + | otherwise = ( html:secs, rest2 ) + where + html = linkedAnchor id0 << docToHtml doc +++ mk_subsections ssecs + (ssecs, rest1) = process lev rest + (secs, rest2) = process n rest1 + process n (_ : rest) = process n rest + + mk_subsections [] = noHtml + mk_subsections ss = unordList ss + +-- we need to assign a unique id to each section heading so we can hyperlink +-- them from the contents: +numberSectionHeadings :: [ExportItem DocName] -> [ExportItem DocName] +numberSectionHeadings exports = go 1 exports + where go :: Int -> [ExportItem DocName] -> [ExportItem DocName] + go _ [] = [] + go n (ExportGroup lev _ doc : es) + = ExportGroup lev (show n) doc : go (n+1) es + go n (other:es) + = other : go n es + +processExport :: Bool -> LinksInfo -> Bool -> (ExportItem DocName) + -> Either Html Html -- Right is a decl, Left is a "extra" (doc or group) +processExport _ _ _ (ExportGroup lev id0 doc) + = Left $ groupTag lev << namedAnchor id0 << docToHtml doc +processExport summary links unicode (ExportDecl decl doc subdocs insts) + = Right $ ppDecl' summary links decl doc insts subdocs unicode +processExport _ _ _ (ExportNoDecl y []) + = Right $ ppDocName y +processExport _ _ _ (ExportNoDecl y subs) + = Right $ ppDocName y +++ parenList (map ppDocName subs) +processExport _ _ _ (ExportDoc doc) + = Left $ docToHtml doc +processExport _ _ _ (ExportModule mdl) + = Right $ toHtml "module" +++ ppModule mdl "" + +groupTag :: Int -> Html -> Html +groupTag lev + | lev == 1 = h1 + | lev == 2 = h2 + | lev == 3 = h3 + | otherwise = h4 + + + + addfile ./src/Haddock/Backends/Xhtml/Decl.hs hunk ./src/Haddock/Backends/Xhtml/Decl.hs 1 +----------------------------------------------------------------------------- +-- | +-- Module : Haddock.Backends.Html.Decl +-- Copyright : (c) Simon Marlow 2003-2006, +-- David Waern 2006-2009, +-- Mark Lentczner 2010 +-- License : BSD-like +-- +-- Maintainer : haddock@projects.haskell.org +-- Stability : experimental +-- Portability : portable +----------------------------------------------------------------------------- + +module Haddock.Backends.Xhtml.Decl where + +import Haddock.Backends.Xhtml.DocMarkup +import Haddock.Backends.Xhtml.Layout +import Haddock.Backends.Xhtml.Names +import Haddock.Backends.Xhtml.Types +import Haddock.Backends.Xhtml.Util +import Haddock.GhcUtils +import Haddock.Types + +import Control.Monad ( join ) +import qualified Data.Map as Map +import Data.Maybe +import Text.XHtml hiding ( name, title, p, quote ) + +import BasicTypes ( IPName(..), Boxity(..) ) +import GHC +import Name +import Outputable ( ppr, showSDoc, Outputable ) + + +-- TODO: use DeclInfo DocName or something +ppDecl' :: Bool -> LinksInfo -> LHsDecl DocName -> + DocForDecl DocName -> [DocInstance DocName] -> [(DocName, DocForDecl DocName)] -> Bool -> Html +ppDecl' s k l m i d u = vanillaTable << ppDecl s k l m i d u + +ppDecl :: Bool -> LinksInfo -> LHsDecl DocName -> + DocForDecl DocName -> [DocInstance DocName] -> [(DocName, DocForDecl DocName)] -> Bool -> HtmlTable +ppDecl summ links (L loc decl) (mbDoc, fnArgsDoc) instances subdocs unicode = case decl of + TyClD d@(TyFamily {}) -> ppTyFam summ False links loc mbDoc d unicode + TyClD d@(TyData {}) + | Nothing <- tcdTyPats d -> ppDataDecl summ links instances subdocs loc mbDoc d unicode + | Just _ <- tcdTyPats d -> ppDataInst summ links loc mbDoc d + TyClD d@(TySynonym {}) + | Nothing <- tcdTyPats d -> ppTySyn summ links loc (mbDoc, fnArgsDoc) d unicode + | Just _ <- tcdTyPats d -> ppTyInst summ False links loc mbDoc d unicode + TyClD d@(ClassDecl {}) -> ppClassDecl summ links instances loc mbDoc subdocs d unicode + SigD (TypeSig (L _ n) (L _ t)) -> ppFunSig summ links loc (mbDoc, fnArgsDoc) n t unicode + ForD d -> ppFor summ links loc (mbDoc, fnArgsDoc) d unicode + InstD _ -> emptyTable + _ -> error "declaration not supported by ppDecl" + +ppFunSig :: Bool -> LinksInfo -> SrcSpan -> DocForDecl DocName -> + DocName -> HsType DocName -> Bool -> HtmlTable +ppFunSig summary links loc doc docname typ unicode = + ppTypeOrFunSig summary links loc docname typ doc + (ppTypeSig summary occname typ unicode, ppBinder False occname, dcolon unicode) unicode + where + occname = docNameOcc docname + +ppTypeOrFunSig :: Bool -> LinksInfo -> SrcSpan -> DocName -> HsType DocName -> + DocForDecl DocName -> (Html, Html, Html) -> Bool -> HtmlTable +ppTypeOrFunSig summary links loc docname typ (doc, argDocs) (pref1, pref2, sep) unicode + | summary || Map.null argDocs = declWithDoc summary links loc docname doc pref1 + | otherwise = topDeclBox links loc docname pref2 + (tda [theclass "body"] << vanillaTable << ( + do_args 0 sep typ + (case doc of + Just d -> ndocBox (docToHtml d) + Nothing -> emptyTable) + )) + where + argDocHtml n = case Map.lookup n argDocs of + Just adoc -> docToHtml adoc + Nothing -> noHtml + + do_largs n leader (L _ t) = do_args n leader t + do_args :: Int -> Html -> (HsType DocName) -> HtmlTable + do_args n leader (HsForAllTy Explicit tvs lctxt ltype) + = (argBox ( + leader <+> + hsep (forallSymbol unicode : ppTyVars tvs ++ [dot]) <+> + ppLContextNoArrow lctxt unicode) + <-> rdocBox noHtml) + do_largs n (darrow unicode) ltype + do_args n leader (HsForAllTy Implicit _ lctxt ltype) + | not (null (unLoc lctxt)) + = (argBox (leader <+> ppLContextNoArrow lctxt unicode) + <-> rdocBox noHtml) + do_largs n (darrow unicode) ltype + -- if we're not showing any 'forall' or class constraints or + -- anything, skip having an empty line for the context. + | otherwise + = do_largs n leader ltype + do_args n leader (HsFunTy lt r) + = (argBox (leader <+> ppLFunLhType unicode lt) <-> rdocBox (argDocHtml n)) + do_largs (n+1) (arrow unicode) r + do_args n leader t + = argBox (leader <+> ppType unicode t) <-> rdocBox (argDocHtml n) + + +ppTyVars :: [LHsTyVarBndr DocName] -> [Html] +ppTyVars tvs = map ppTyName (tyvarNames tvs) + + +tyvarNames :: [LHsTyVarBndr DocName] -> [Name] +tyvarNames = map (getName . hsTyVarName . unLoc) + + +ppFor :: Bool -> LinksInfo -> SrcSpan -> DocForDecl DocName -> ForeignDecl DocName -> Bool -> HtmlTable +ppFor summary links loc doc (ForeignImport (L _ name) (L _ typ) _) unicode + = ppFunSig summary links loc doc name typ unicode +ppFor _ _ _ _ _ _ = error "ppFor" + + +-- we skip type patterns for now +ppTySyn :: Bool -> LinksInfo -> SrcSpan -> DocForDecl DocName -> TyClDecl DocName -> Bool -> HtmlTable +ppTySyn summary links loc doc (TySynonym (L _ name) ltyvars _ ltype) unicode + = ppTypeOrFunSig summary links loc name (unLoc ltype) doc + (full, hdr, spaceHtml +++ equals) unicode + where + hdr = hsep ([keyword "type", ppBinder summary occ] ++ ppTyVars ltyvars) + full = hdr <+> equals <+> ppLType unicode ltype + occ = docNameOcc name +ppTySyn _ _ _ _ _ _ = error "declaration not supported by ppTySyn" + + +ppTypeSig :: Bool -> OccName -> HsType DocName -> Bool -> Html +ppTypeSig summary nm ty unicode = ppBinder summary nm <+> dcolon unicode <+> ppType unicode ty + + +ppTyName :: Name -> Html +ppTyName name + | isNameSym name = parens (ppName name) + | otherwise = ppName name + + +-------------------------------------------------------------------------------- +-- Type families +-------------------------------------------------------------------------------- + + +ppTyFamHeader :: Bool -> Bool -> TyClDecl DocName -> Bool -> Html +ppTyFamHeader summary associated decl unicode = + + (case tcdFlavour decl of + TypeFamily + | associated -> keyword "type" + | otherwise -> keyword "type family" + DataFamily + | associated -> keyword "data" + | otherwise -> keyword "data family" + ) <+> + + ppTyClBinderWithVars summary decl <+> + + case tcdKind decl of + Just kind -> dcolon unicode <+> ppKind kind + Nothing -> empty + + +ppTyFam :: Bool -> Bool -> LinksInfo -> SrcSpan -> Maybe (Doc DocName) -> + TyClDecl DocName -> Bool -> HtmlTable +ppTyFam summary associated links loc mbDoc decl unicode + + | summary = declWithDoc summary links loc docname mbDoc + (ppTyFamHeader True associated decl unicode) + + | associated, isJust mbDoc = header_ bodyBox << doc + | associated = header_ + | null instances, isJust mbDoc = header_ bodyBox << doc + | null instances = header_ + | isJust mbDoc = header_ bodyBox << (doc instancesBit) + | otherwise = header_ bodyBox << instancesBit + + where + docname = tcdName decl + + header_ = topDeclBox links loc docname (ppTyFamHeader summary associated decl unicode) + + doc = ndocBox . docToHtml . fromJust $ mbDoc + + instId = collapseId (getName docname) + + instancesBit = instHdr instId + tda [theclass "body"] << + collapsed thediv instId ( + spacedTable1 << ( + aboves (map (ppDocInstance unicode) instances) + ) + ) + + -- TODO: get the instances + instances = [] + + +-------------------------------------------------------------------------------- +-- Indexed data types +-------------------------------------------------------------------------------- + + +ppDataInst :: a +ppDataInst = undefined + + +-------------------------------------------------------------------------------- +-- Indexed newtypes +-------------------------------------------------------------------------------- + +-- TODO +-- ppNewTyInst = undefined + + +-------------------------------------------------------------------------------- +-- Indexed types +-------------------------------------------------------------------------------- + + +ppTyInst :: Bool -> Bool -> LinksInfo -> SrcSpan -> Maybe (Doc DocName) -> + TyClDecl DocName -> Bool -> HtmlTable +ppTyInst summary associated links loc mbDoc decl unicode + + | summary = declWithDoc summary links loc docname mbDoc + (ppTyInstHeader True associated decl unicode) + + | isJust mbDoc = header_ bodyBox << doc + | otherwise = header_ + + where + docname = tcdName decl + + header_ = topDeclBox links loc docname (ppTyInstHeader summary associated decl unicode) + + doc = case mbDoc of + Just d -> ndocBox (docToHtml d) + Nothing -> emptyTable + + +ppTyInstHeader :: Bool -> Bool -> TyClDecl DocName -> Bool -> Html +ppTyInstHeader _ _ decl unicode = + keyword "type instance" <+> + ppAppNameTypes (tcdName decl) typeArgs unicode + where + typeArgs = map unLoc . fromJust . tcdTyPats $ decl + + +-------------------------------------------------------------------------------- +-- Associated Types +-------------------------------------------------------------------------------- + + +ppAssocType :: Bool -> LinksInfo -> DocForDecl DocName -> LTyClDecl DocName -> Bool -> HtmlTable +ppAssocType summ links doc (L loc decl) unicode = + case decl of + TyFamily {} -> ppTyFam summ True links loc (fst doc) decl unicode + TySynonym {} -> ppTySyn summ links loc doc decl unicode + _ -> error "declaration type not supported by ppAssocType" + + +-------------------------------------------------------------------------------- +-- TyClDecl helpers +-------------------------------------------------------------------------------- + + +-- | Print a type family / newtype / data / class binder and its variables +ppTyClBinderWithVars :: Bool -> TyClDecl DocName -> Html +ppTyClBinderWithVars summ decl = + ppAppDocNameNames summ (unLoc $ tcdLName decl) (tyvarNames $ tcdTyVars decl) + + +-------------------------------------------------------------------------------- +-- Type applications +-------------------------------------------------------------------------------- + + +-- | Print an application of a DocName and a list of HsTypes +ppAppNameTypes :: DocName -> [HsType DocName] -> Bool -> Html +ppAppNameTypes n ts unicode = ppTypeApp n ts ppDocName (ppParendType unicode) + + +-- | Print an application of a DocName and a list of Names +ppAppDocNameNames :: Bool -> DocName -> [Name] -> Html +ppAppDocNameNames summ n ns = + ppTypeApp n ns (ppBinder summ . docNameOcc) ppTyName + + +-- | General printing of type applications +ppTypeApp :: DocName -> [a] -> (DocName -> Html) -> (a -> Html) -> Html +ppTypeApp n (t1:t2:rest) ppDN ppT + | operator, not . null $ rest = parens opApp <+> hsep (map ppT rest) + | operator = opApp + where + operator = isNameSym . getName $ n + opApp = ppT t1 <+> ppDN n <+> ppT t2 + +ppTypeApp n ts ppDN ppT = ppDN n <+> hsep (map ppT ts) + + +------------------------------------------------------------------------------- +-- Contexts +------------------------------------------------------------------------------- + + +ppLContext, ppLContextNoArrow :: Located (HsContext DocName) -> Bool -> Html +ppLContext = ppContext . unLoc +ppLContextNoArrow = ppContextNoArrow . unLoc + + +ppContextNoArrow :: HsContext DocName -> Bool -> Html +ppContextNoArrow [] _ = empty +ppContextNoArrow cxt unicode = pp_hs_context (map unLoc cxt) unicode + + +ppContextNoLocs :: [HsPred DocName] -> Bool -> Html +ppContextNoLocs [] _ = empty +ppContextNoLocs cxt unicode = pp_hs_context cxt unicode <+> darrow unicode + + +ppContext :: HsContext DocName -> Bool -> Html +ppContext cxt unicode = ppContextNoLocs (map unLoc cxt) unicode + + +pp_hs_context :: [HsPred DocName] -> Bool -> Html +pp_hs_context [] _ = empty +pp_hs_context [p] unicode = ppPred unicode p +pp_hs_context cxt unicode = parenList (map (ppPred unicode) cxt) + + +ppPred :: Bool -> HsPred DocName -> Html +ppPred unicode (HsClassP n ts) = ppAppNameTypes n (map unLoc ts) unicode +ppPred unicode (HsEqualP t1 t2) = ppLType unicode t1 <+> toHtml "~" <+> ppLType unicode t2 +ppPred unicode (HsIParam (IPName n) t) + = toHtml "?" +++ ppDocName n <+> dcolon unicode <+> ppLType unicode t + + +------------------------------------------------------------------------------- +-- Class declarations +------------------------------------------------------------------------------- + + +ppClassHdr :: Bool -> Located [LHsPred DocName] -> DocName + -> [Located (HsTyVarBndr DocName)] -> [Located ([DocName], [DocName])] + -> Bool -> Html +ppClassHdr summ lctxt n tvs fds unicode = + keyword "class" + <+> (if not . null . unLoc $ lctxt then ppLContext lctxt unicode else empty) + <+> ppAppDocNameNames summ n (tyvarNames $ tvs) + <+> ppFds fds unicode + + +ppFds :: [Located ([DocName], [DocName])] -> Bool -> Html +ppFds fds unicode = + if null fds then noHtml else + char '|' <+> hsep (punctuate comma (map (fundep . unLoc) fds)) + where + fundep (vars1,vars2) = hsep (map ppDocName vars1) <+> arrow unicode <+> + hsep (map ppDocName vars2) + +ppShortClassDecl :: Bool -> LinksInfo -> TyClDecl DocName -> SrcSpan -> [(DocName, DocForDecl DocName)] -> Bool -> HtmlTable +ppShortClassDecl summary links (ClassDecl lctxt lname tvs fds sigs _ ats _) loc subdocs unicode = + if null sigs && null ats + then (if summary then declBox else topDeclBox links loc nm) hdr + else (if summary then declBox else topDeclBox links loc nm) (hdr <+> keyword "where") + + ( + bodyBox << + aboves + ( + [ ppAssocType summary links doc at unicode | at <- ats + , let doc = lookupAnySubdoc (tcdName $ unL at) subdocs ] ++ + + [ ppFunSig summary links loc doc n typ unicode + | L _ (TypeSig (L _ n) (L _ typ)) <- sigs + , let doc = lookupAnySubdoc n subdocs ] + ) + ) + where + hdr = ppClassHdr summary lctxt (unLoc lname) tvs fds unicode + nm = unLoc lname +ppShortClassDecl _ _ _ _ _ _ = error "declaration type not supported by ppShortClassDecl" + + + +ppClassDecl :: Bool -> LinksInfo -> [DocInstance DocName] -> SrcSpan + -> Maybe (Doc DocName) -> [(DocName, DocForDecl DocName)] + -> TyClDecl DocName -> Bool -> HtmlTable +ppClassDecl summary links instances loc mbDoc subdocs + decl@(ClassDecl lctxt lname ltyvars lfds lsigs _ ats _) unicode + | summary = ppShortClassDecl summary links decl loc subdocs unicode + | otherwise = classheader bodyBox << (classdoc body_ instancesBit) + where + classheader + | null lsigs = topDeclBox links loc nm (hdr unicode) + | otherwise = topDeclBox links loc nm (hdr unicode <+> keyword "where") + + nm = unLoc $ tcdLName decl + + hdr = ppClassHdr summary lctxt (unLoc lname) ltyvars lfds + + classdoc = case mbDoc of + Nothing -> emptyTable + Just d -> ndocBox (docToHtml d) + + body_ + | null lsigs, null ats = emptyTable + | null ats = s8 methHdr bodyBox << methodTable + | otherwise = s8 atHdr bodyBox << atTable + s8 methHdr bodyBox << methodTable + + methodTable = + abovesSep s8 [ ppFunSig summary links loc doc n typ unicode + | L _ (TypeSig (L _ n) (L _ typ)) <- lsigs + , let doc = lookupAnySubdoc n subdocs ] + + atTable = abovesSep s8 $ [ ppAssocType summary links doc at unicode | at <- ats + , let doc = lookupAnySubdoc (tcdName $ unL at) subdocs ] + + instId = collapseId (getName nm) + instancesBit + | null instances = emptyTable + | otherwise + = s8 instHdr instId + tda [theclass "body"] << + collapsed thediv instId ( + spacedTable1 << aboves (map (ppDocInstance unicode) instances) + ) +ppClassDecl _ _ _ _ _ _ _ _ = error "declaration type not supported by ppShortClassDecl" + + +-- | Print a possibly commented instance. The instance header is printed inside +-- an 'argBox'. The comment is printed to the right of the box in normal comment +-- style. +ppDocInstance :: Bool -> DocInstance DocName -> HtmlTable +ppDocInstance unicode (instHead, maybeDoc) = + argBox (ppInstHead unicode instHead) <-> maybeRDocBox maybeDoc + + +ppInstHead :: Bool -> InstHead DocName -> Html +ppInstHead unicode ([], n, ts) = ppAppNameTypes n ts unicode +ppInstHead unicode (ctxt, n, ts) = ppContextNoLocs ctxt unicode <+> ppAppNameTypes n ts unicode + + +lookupAnySubdoc :: (Eq name1) => + name1 -> [(name1, DocForDecl name2)] -> DocForDecl name2 +lookupAnySubdoc n subdocs = case lookup n subdocs of + Nothing -> noDocForDecl + Just docs -> docs + + + +-- ----------------------------------------------------------------------------- +-- Data & newtype declarations + + +-- TODO: print contexts +ppShortDataDecl :: Bool -> LinksInfo -> SrcSpan -> TyClDecl DocName -> Bool -> Html +ppShortDataDecl summary links loc dataDecl unicode + + | [lcon] <- cons, ResTyH98 <- resTy = + ppDataHeader summary dataDecl unicode + <+> equals <+> ppShortConstr summary (unLoc lcon) unicode + + | [] <- cons = ppDataHeader summary dataDecl unicode + + | otherwise = vanillaTable << ( + case resTy of + ResTyH98 -> dataHeader + tda [theclass "body"] << vanillaTable << ( + aboves (zipWith doConstr ('=':repeat '|') cons) + ) + ResTyGADT _ -> dataHeader + tda [theclass "body"] << vanillaTable << ( + aboves (map doGADTConstr cons) + ) + ) + + where + dataHeader = + (if summary then declBox else topDeclBox links loc docname) + ((ppDataHeader summary dataDecl unicode) <+> + case resTy of ResTyGADT _ -> keyword "where"; _ -> empty) + + doConstr c con = declBox (toHtml [c] <+> ppShortConstr summary (unLoc con) unicode) + doGADTConstr con = declBox (ppShortConstr summary (unLoc con) unicode) + + docname = unLoc . tcdLName $ dataDecl + cons = tcdCons dataDecl + resTy = (con_res . unLoc . head) cons + +ppDataDecl :: Bool -> LinksInfo -> [DocInstance DocName] -> + [(DocName, DocForDecl DocName)] -> + SrcSpan -> Maybe (Doc DocName) -> TyClDecl DocName -> Bool -> HtmlTable +ppDataDecl summary links instances subdocs loc mbDoc dataDecl unicode + + | summary = declWithDoc summary links loc docname mbDoc + (ppShortDataDecl summary links loc dataDecl unicode) + + | otherwise + = (if validTable then () else const) header_ $ + tda [theclass "body"] << vanillaTable << ( + datadoc + constrBit + instancesBit + ) + + + where + docname = unLoc . tcdLName $ dataDecl + cons = tcdCons dataDecl + resTy = (con_res . unLoc . head) cons + + header_ = topDeclBox links loc docname (ppDataHeader summary dataDecl unicode + <+> whereBit) + + whereBit + | null cons = empty + | otherwise = case resTy of + ResTyGADT _ -> keyword "where" + _ -> empty + + constrTable + | any isRecCon cons = spacedTable5 + | otherwise = spacedTable1 + + datadoc = case mbDoc of + Just doc -> ndocBox (docToHtml doc) + Nothing -> emptyTable + + constrBit + | null cons = emptyTable + | otherwise = constrHdr ( + tda [theclass "body"] << constrTable << + aboves (map (ppSideBySideConstr subdocs unicode) cons) + ) + + instId = collapseId (getName docname) + + instancesBit + | null instances = emptyTable + | otherwise + = instHdr instId + tda [theclass "body"] << + collapsed thediv instId ( + spacedTable1 << aboves (map (ppDocInstance unicode) instances + ) + ) + + validTable = isJust mbDoc || not (null cons) || not (null instances) + + +isRecCon :: Located (ConDecl a) -> Bool +isRecCon lcon = case con_details (unLoc lcon) of + RecCon _ -> True + _ -> False + + +ppShortConstr :: Bool -> ConDecl DocName -> Bool -> Html +ppShortConstr summary con unicode = case con_res con of + ResTyH98 -> case con_details con of + PrefixCon args -> header_ unicode +++ hsep (ppBinder summary occ : map (ppLParendType unicode) args) + RecCon fields -> header_ unicode +++ ppBinder summary occ <+> + doRecordFields fields + InfixCon arg1 arg2 -> header_ unicode +++ + hsep [ppLParendType unicode arg1, ppBinder summary occ, ppLParendType unicode arg2] + + ResTyGADT resTy -> case con_details con of + -- prefix & infix could use hsConDeclArgTys if it seemed to + -- simplify the code. + PrefixCon args -> doGADTCon args resTy + -- display GADT records with the new syntax, + -- Constr :: (Context) => { field :: a, field2 :: b } -> Ty (a, b) + -- (except each field gets its own line in docs, to match + -- non-GADT records) + RecCon fields -> ppBinder summary occ <+> dcolon unicode <+> hsep [ + ppForAll forall ltvs lcontext unicode, + doRecordFields fields, + arrow unicode <+> ppLType unicode resTy ] + InfixCon arg1 arg2 -> doGADTCon [arg1, arg2] resTy + + where + doRecordFields fields = braces (vanillaTable << + aboves (map (ppShortField summary unicode) fields)) + doGADTCon args resTy = ppBinder summary occ <+> dcolon unicode <+> hsep [ + ppForAll forall ltvs lcontext unicode, + ppLType unicode (foldr mkFunTy resTy args) ] + + header_ = ppConstrHdr forall tyVars context + occ = docNameOcc . unLoc . con_name $ con + ltvs = con_qvars con + tyVars = tyvarNames ltvs + lcontext = con_cxt con + context = unLoc (con_cxt con) + forall = con_explicit con + mkFunTy a b = noLoc (HsFunTy a b) + +-- ppConstrHdr is for (non-GADT) existentials constructors' syntax +ppConstrHdr :: HsExplicitForAll -> [Name] -> HsContext DocName -> Bool -> Html +ppConstrHdr forall tvs ctxt unicode + = (if null tvs then noHtml else ppForall) + +++ + (if null ctxt then noHtml else ppContextNoArrow ctxt unicode <+> darrow unicode +++ toHtml " ") + where + ppForall = case forall of + Explicit -> forallSymbol unicode <+> hsep (map ppName tvs) <+> toHtml ". " + Implicit -> empty + +ppSideBySideConstr :: [(DocName, DocForDecl DocName)] -> Bool -> LConDecl DocName -> HtmlTable +ppSideBySideConstr subdocs unicode (L _ con) = case con_res con of + + ResTyH98 -> case con_details con of + + PrefixCon args -> + argBox (hsep ((header_ unicode +++ ppBinder False occ) : map (ppLParendType unicode) args)) + <-> maybeRDocBox mbDoc + + RecCon fields -> + argBox (header_ unicode +++ ppBinder False occ) <-> + maybeRDocBox mbDoc + + doRecordFields fields + + InfixCon arg1 arg2 -> + argBox (hsep [header_ unicode+++ppLParendType unicode arg1, ppBinder False occ, ppLParendType unicode arg2]) + <-> maybeRDocBox mbDoc + + ResTyGADT resTy -> case con_details con of + -- prefix & infix could also use hsConDeclArgTys if it seemed to + -- simplify the code. + PrefixCon args -> doGADTCon args resTy + cd@(RecCon fields) -> doGADTCon (hsConDeclArgTys cd) resTy + doRecordFields fields + InfixCon arg1 arg2 -> doGADTCon [arg1, arg2] resTy + + where + doRecordFields fields = + (tda [theclass "body"] << spacedTable1 << + aboves (map (ppSideBySideField subdocs unicode) fields)) + doGADTCon args resTy = argBox (ppBinder False occ <+> dcolon unicode <+> hsep [ + ppForAll forall ltvs (con_cxt con) unicode, + ppLType unicode (foldr mkFunTy resTy args) ] + ) <-> maybeRDocBox mbDoc + + + header_ = ppConstrHdr forall tyVars context + occ = docNameOcc . unLoc . con_name $ con + ltvs = con_qvars con + tyVars = tyvarNames (con_qvars con) + context = unLoc (con_cxt con) + forall = con_explicit con + -- don't use "con_doc con", in case it's reconstructed from a .hi file, + -- or also because we want Haddock to do the doc-parsing, not GHC. + -- 'join' is in Maybe. + mbDoc = join $ fmap fst $ lookup (unLoc $ con_name con) subdocs + mkFunTy a b = noLoc (HsFunTy a b) + +ppSideBySideField :: [(DocName, DocForDecl DocName)] -> Bool -> ConDeclField DocName -> HtmlTable +ppSideBySideField subdocs unicode (ConDeclField (L _ name) ltype _) = + argBox (ppBinder False (docNameOcc name) + <+> dcolon unicode <+> ppLType unicode ltype) <-> maybeRDocBox mbDoc + where + -- don't use cd_fld_doc for same reason we don't use con_doc above + mbDoc = join $ fmap fst $ lookup name subdocs + +{- +ppHsFullConstr :: HsConDecl -> Html +ppHsFullConstr (HsConDecl _ nm tvs ctxt typeList doc) = + declWithDoc False doc ( + hsep ((ppHsConstrHdr tvs ctxt +++ + ppHsBinder False nm) : map ppHsBangType typeList) + ) +ppHsFullConstr (HsRecDecl _ nm tvs ctxt fields doc) = + td << vanillaTable << ( + case doc of + Nothing -> aboves [hdr, fields_html] + Just _ -> aboves [hdr, constr_doc, fields_html] + ) + + where hdr = declBox (ppHsConstrHdr tvs ctxt +++ ppHsBinder False nm) + + constr_doc + | isJust doc = docBox (docToHtml (fromJust doc)) + | otherwise = emptyTable + + fields_html = + td << + table ! [width "100%", cellpadding 0, cellspacing 8] << ( + aboves (map ppFullField (concat (map expandField fields))) + ) +-} + +ppShortField :: Bool -> Bool -> ConDeclField DocName -> HtmlTable +ppShortField summary unicode (ConDeclField (L _ name) ltype _) + = tda [theclass "recfield"] << ( + ppBinder summary (docNameOcc name) + <+> dcolon unicode <+> ppLType unicode ltype + ) + +{- +ppFullField :: HsFieldDecl -> Html +ppFullField (HsFieldDecl [n] ty doc) + = declWithDoc False doc ( + ppHsBinder False n <+> dcolon <+> ppHsBangType ty + ) +ppFullField _ = error "ppFullField" + +expandField :: HsFieldDecl -> [HsFieldDecl] +expandField (HsFieldDecl ns ty doc) = [ HsFieldDecl [n] ty doc | n <- ns ] +-} + +-- | Print the LHS of a data\/newtype declaration. +-- Currently doesn't handle 'data instance' decls or kind signatures +ppDataHeader :: Bool -> TyClDecl DocName -> Bool -> Html +ppDataHeader summary decl unicode + | not (isDataDecl decl) = error "ppDataHeader: illegal argument" + | otherwise = + -- newtype or data + (if tcdND decl == NewType then keyword "newtype" else keyword "data") <+> + -- context + ppLContext (tcdCtxt decl) unicode <+> + -- T a b c ..., or a :+: b + ppTyClBinderWithVars summary decl + + +-- ---------------------------------------------------------------------------- +-- Types and contexts + + +ppKind :: Outputable a => a -> Html +ppKind k = toHtml $ showSDoc (ppr k) + + +{- +ppForAll Implicit _ lctxt = ppCtxtPart lctxt +ppForAll Explicit ltvs lctxt = + hsep (keyword "forall" : ppTyVars ltvs ++ [dot]) <+> ppCtxtPart lctxt +-} + + +ppBang :: HsBang -> Html +ppBang HsNoBang = empty +ppBang HsStrict = toHtml "!" +ppBang HsUnbox = toHtml "!" -- unboxed args is an implementation detail, + -- so we just show the strictness annotation + + +tupleParens :: Boxity -> [Html] -> Html +tupleParens Boxed = parenList +tupleParens Unboxed = ubxParenList +{- +ppType :: HsType DocName -> Html +ppType t = case t of + t@(HsForAllTy expl ltvs lcontext ltype) -> ppForAllTy t <+> ppLType ltype + HsTyVar n -> ppDocName n + HsBangTy HsStrict lt -> toHtml "!" <+> ppLType lt + HsBangTy HsUnbox lt -> toHtml "!!" <+> ppLType lt + HsAppTy a b -> ppLType a <+> ppLType b + HsFunTy a b -> hsep [ppLType a, toHtml "->", ppLType b] + HsListTy t -> brackets $ ppLType t + HsPArrTy t -> toHtml "[:" +++ ppLType t +++ toHtml ":]" + HsTupleTy Boxed ts -> parenList $ map ppLType ts + HsTupleTy Unboxed ts -> ubxParenList $ map ppLType ts + HsOpTy a n b -> ppLType a <+> ppLDocName n <+> ppLType b + HsParTy t -> parens $ ppLType t + HsNumTy n -> toHtml (show n) + HsPredTy p -> ppPred p + HsKindSig t k -> hsep [ppLType t, dcolon, ppKind k] + HsSpliceTy _ -> error "ppType" + HsDocTy t _ -> ppLType t +-} + + +-------------------------------------------------------------------------------- +-- Rendering of HsType +-------------------------------------------------------------------------------- + + +pREC_TOP, pREC_FUN, pREC_OP, pREC_CON :: Int + +pREC_TOP = (0 :: Int) -- type in ParseIface.y in GHC +pREC_FUN = (1 :: Int) -- btype in ParseIface.y in GHC + -- Used for LH arg of (->) +pREC_OP = (2 :: Int) -- Used for arg of any infix operator + -- (we don't keep their fixities around) +pREC_CON = (3 :: Int) -- Used for arg of type applicn: + -- always parenthesise unless atomic + +maybeParen :: Int -- Precedence of context + -> Int -- Precedence of top-level operator + -> Html -> Html -- Wrap in parens if (ctxt >= op) +maybeParen ctxt_prec op_prec p | ctxt_prec >= op_prec = parens p + | otherwise = p + + +ppLType, ppLParendType, ppLFunLhType :: Bool -> Located (HsType DocName) -> Html +ppLType unicode y = ppType unicode (unLoc y) +ppLParendType unicode y = ppParendType unicode (unLoc y) +ppLFunLhType unicode y = ppFunLhType unicode (unLoc y) + + +ppType, ppParendType, ppFunLhType :: Bool -> HsType DocName -> Html +ppType unicode ty = ppr_mono_ty pREC_TOP ty unicode +ppParendType unicode ty = ppr_mono_ty pREC_CON ty unicode +ppFunLhType unicode ty = ppr_mono_ty pREC_FUN ty unicode + + +-- Drop top-level for-all type variables in user style +-- since they are implicit in Haskell + +ppForAll :: HsExplicitForAll -> [Located (HsTyVarBndr DocName)] + -> Located (HsContext DocName) -> Bool -> Html +ppForAll expl tvs cxt unicode + | show_forall = forall_part <+> ppLContext cxt unicode + | otherwise = ppLContext cxt unicode + where + show_forall = not (null tvs) && is_explicit + is_explicit = case expl of {Explicit -> True; Implicit -> False} + forall_part = hsep (forallSymbol unicode : ppTyVars tvs) +++ dot + + +ppr_mono_lty :: Int -> LHsType DocName -> Bool -> Html +ppr_mono_lty ctxt_prec ty unicode = ppr_mono_ty ctxt_prec (unLoc ty) unicode + + +ppr_mono_ty :: Int -> HsType DocName -> Bool -> Html +ppr_mono_ty ctxt_prec (HsForAllTy expl tvs ctxt ty) unicode + = maybeParen ctxt_prec pREC_FUN $ + hsep [ppForAll expl tvs ctxt unicode, ppr_mono_lty pREC_TOP ty unicode] + +-- gaw 2004 +ppr_mono_ty _ (HsBangTy b ty) u = ppBang b +++ ppLParendType u ty +ppr_mono_ty _ (HsTyVar name) _ = ppDocName name +ppr_mono_ty ctxt_prec (HsFunTy ty1 ty2) u = ppr_fun_ty ctxt_prec ty1 ty2 u +ppr_mono_ty _ (HsTupleTy con tys) u = tupleParens con (map (ppLType u) tys) +ppr_mono_ty _ (HsKindSig ty kind) u = parens (ppr_mono_lty pREC_TOP ty u <+> dcolon u <+> ppKind kind) +ppr_mono_ty _ (HsListTy ty) u = brackets (ppr_mono_lty pREC_TOP ty u) +ppr_mono_ty _ (HsPArrTy ty) u = pabrackets (ppr_mono_lty pREC_TOP ty u) +ppr_mono_ty _ (HsPredTy p) u = parens (ppPred u p) +ppr_mono_ty _ (HsNumTy n) _ = toHtml (show n) -- generics only +ppr_mono_ty _ (HsSpliceTy _) _ = error "ppr_mono_ty HsSpliceTy" +ppr_mono_ty _ (HsSpliceTyOut _) _ = error "ppr_mono_ty HsSpliceTyOut" +ppr_mono_ty _ (HsRecTy _) _ = error "ppr_mono_ty HsRecTy" + + +ppr_mono_ty ctxt_prec (HsAppTy fun_ty arg_ty) unicode + = maybeParen ctxt_prec pREC_CON $ + hsep [ppr_mono_lty pREC_FUN fun_ty unicode, ppr_mono_lty pREC_CON arg_ty unicode] + +ppr_mono_ty ctxt_prec (HsOpTy ty1 op ty2) unicode + = maybeParen ctxt_prec pREC_FUN $ + ppr_mono_lty pREC_OP ty1 unicode <+> ppr_op <+> ppr_mono_lty pREC_OP ty2 unicode + where + ppr_op = if not (isSymOcc occName) then quote (ppLDocName op) else ppLDocName op + occName = docNameOcc . unLoc $ op + +ppr_mono_ty ctxt_prec (HsParTy ty) unicode +-- = parens (ppr_mono_lty pREC_TOP ty) + = ppr_mono_lty ctxt_prec ty unicode + +ppr_mono_ty ctxt_prec (HsDocTy ty _) unicode + = ppr_mono_lty ctxt_prec ty unicode + + +ppr_fun_ty :: Int -> LHsType DocName -> LHsType DocName -> Bool -> Html +ppr_fun_ty ctxt_prec ty1 ty2 unicode + = let p1 = ppr_mono_lty pREC_FUN ty1 unicode + p2 = ppr_mono_lty pREC_TOP ty2 unicode + in + maybeParen ctxt_prec pREC_FUN $ + hsep [p1, arrow unicode <+> p2] + + addfile ./src/Haddock/Backends/Xhtml/DocMarkup.hs hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 1 +----------------------------------------------------------------------------- +-- | +-- Module : Haddock.Backends.Html.DocMarkup +-- Copyright : (c) Simon Marlow 2003-2006, +-- David Waern 2006-2009, +-- Mark Lentczner 2010 +-- License : BSD-like +-- +-- Maintainer : haddock@projects.haskell.org +-- Stability : experimental +-- Portability : portable +----------------------------------------------------------------------------- + +module Haddock.Backends.Xhtml.DocMarkup where + +import Haddock.Backends.Xhtml.Names +import Haddock.Backends.Xhtml.Util +import Haddock.GhcUtils +import Haddock.Types +import Haddock.Utils + +import Text.XHtml hiding ( name, title, p, quote ) + +import GHC +import Name +import RdrName + + +parHtmlMarkup :: (a -> Html) -> (a -> Bool) -> DocMarkup a Html +parHtmlMarkup ppId isTyCon = Markup { + markupParagraph = paragraph, + markupEmpty = toHtml "", + markupString = toHtml, + markupAppend = (+++), + markupIdentifier = tt . ppId . choose, + markupModule = \m -> let (mdl,ref) = break (=='#') m in ppModule (mkModuleNoPackage mdl) ref, + markupEmphasis = emphasize . toHtml, + markupMonospaced = tt . toHtml, + markupUnorderedList = ulist . concatHtml . map (li <<), + markupPic = \path -> image ! [src path], + markupOrderedList = olist . concatHtml . map (li <<), + markupDefList = dlist . concatHtml . map markupDef, + markupCodeBlock = pre, + markupURL = \url -> anchor ! [href url] << toHtml url, + markupAName = \aname -> namedAnchor aname << toHtml "" + } + where + -- If an id can refer to multiple things, we give precedence to type + -- constructors. This should ideally be done during renaming from RdrName + -- to Name, but since we will move this process from GHC into Haddock in + -- the future, we fix it here in the meantime. + -- TODO: mention this rule in the documentation. + choose [] = error "empty identifier list in HsDoc" + choose [x] = x + choose (x:y:_) + | isTyCon x = x + | otherwise = y + + +markupDef :: (HTML a, HTML b) => (a, b) -> Html +markupDef (a,b) = dterm << a +++ ddef << b + + +htmlMarkup :: DocMarkup DocName Html +htmlMarkup = parHtmlMarkup ppDocName (isTyConName . getName) + +htmlOrigMarkup :: DocMarkup Name Html +htmlOrigMarkup = parHtmlMarkup ppName isTyConName + +htmlRdrMarkup :: DocMarkup RdrName Html +htmlRdrMarkup = parHtmlMarkup ppRdrName isRdrTc + +-- If the doc is a single paragraph, don't surround it with

(this causes +-- ugly extra whitespace with some browsers). +docToHtml :: Doc DocName -> Html +docToHtml doc = markup htmlMarkup (markup htmlCleanup doc) + +origDocToHtml :: Doc Name -> Html +origDocToHtml doc = markup htmlOrigMarkup (markup htmlCleanup doc) + +rdrDocToHtml :: Doc RdrName -> Html +rdrDocToHtml doc = markup htmlRdrMarkup (markup htmlCleanup doc) + +-- If there is a single paragraph, then surrounding it with

..

+-- can add too much whitespace in some browsers (eg. IE). However if +-- we have multiple paragraphs, then we want the extra whitespace to +-- separate them. So we catch the single paragraph case and transform it +-- here. +unParagraph :: Doc a -> Doc a +unParagraph (DocParagraph d) = d +--NO: This eliminates line breaks in the code block: (SDM, 6/5/2003) +--unParagraph (DocCodeBlock d) = (DocMonospaced d) +unParagraph doc = doc + +htmlCleanup :: DocMarkup a (Doc a) +htmlCleanup = idMarkup { + markupUnorderedList = DocUnorderedList . map unParagraph, + markupOrderedList = DocOrderedList . map unParagraph + } addfile ./src/Haddock/Backends/Xhtml/Layout.hs hunk ./src/Haddock/Backends/Xhtml/Layout.hs 1 +----------------------------------------------------------------------------- +-- | +-- Module : Haddock.Backends.Html.Layout +-- Copyright : (c) Simon Marlow 2003-2006, +-- David Waern 2006-2009, +-- Mark Lentczner 2010 +-- License : BSD-like +-- +-- Maintainer : haddock@projects.haskell.org +-- Stability : experimental +-- Portability : portable +----------------------------------------------------------------------------- + +module Haddock.Backends.Xhtml.Layout where + +import Haddock.Backends.Xhtml.DocMarkup +import Haddock.Backends.Xhtml.Types +import Haddock.Backends.Xhtml.Util +import Haddock.Types + +import Text.XHtml hiding ( name, title, p, quote ) + +import FastString ( unpackFS ) +import GHC + + +declWithDoc :: Bool -> LinksInfo -> SrcSpan -> DocName -> Maybe (Doc DocName) -> Html -> HtmlTable +declWithDoc True _ _ _ _ html_decl = declBox html_decl +declWithDoc False links loc nm Nothing html_decl = topDeclBox links loc nm html_decl +declWithDoc False links loc nm (Just doc) html_decl = + topDeclBox links loc nm html_decl docBox (docToHtml doc) + + + +{- +text :: Html +text = strAttr "TEXT" +-} + +-- a box for displaying code +declBox :: Html -> HtmlTable +declBox html = tda [theclass "decl"] << html + +-- a box for top level documented names +-- it adds a source and wiki link at the right hand side of the box +topDeclBox :: LinksInfo -> SrcSpan -> DocName -> Html -> HtmlTable +topDeclBox ((_,_,Nothing), (_,_,Nothing)) _ _ html = declBox html +topDeclBox ((_,_,maybe_source_url), (_,_,maybe_wiki_url)) + loc name html = + tda [theclass "topdecl"] << + ( table ! [theclass "declbar"] << + ((tda [theclass "declname"] << html) + <-> srcLink + <-> wikiLink) + ) + where srcLink = + case maybe_source_url of + Nothing -> emptyTable + Just url -> tda [theclass "declbut"] << + let url' = spliceURL (Just fname) (Just origMod) + (Just n) (Just loc) url + in anchor ! [href url'] << toHtml "Source" + + wikiLink = + case maybe_wiki_url of + Nothing -> emptyTable + Just url -> tda [theclass "declbut"] << + let url' = spliceURL (Just fname) (Just mdl) + (Just n) (Just loc) url + in anchor ! [href url'] << toHtml "Comments" + + -- For source links, we want to point to the original module, + -- because only that will have the source. + -- TODO: do something about type instances. They will point to + -- the module defining the type family, which is wrong. + origMod = nameModule n + + -- Name must be documented, otherwise we wouldn't get here + Documented n mdl = name + + fname = unpackFS (srcSpanFile loc) + + +-- a box for displaying an 'argument' (some code which has text to the +-- right of it). Wrapping is not allowed in these boxes, whereas it is +-- in a declBox. +argBox :: Html -> HtmlTable +argBox html = tda [theclass "arg"] << html + +-- a box for displaying documentation, +-- indented and with a little padding at the top +docBox :: Html -> HtmlTable +docBox html = tda [theclass "doc"] << html + +-- a box for displaying documentation, not indented. +ndocBox :: Html -> HtmlTable +ndocBox html = tda [theclass "ndoc"] << html + +-- a box for displaying documentation, padded on the left a little +rdocBox :: Html -> HtmlTable +rdocBox html = tda [theclass "rdoc"] << html + +maybeRDocBox :: Maybe (Doc DocName) -> HtmlTable +maybeRDocBox Nothing = rdocBox (noHtml) +maybeRDocBox (Just doc) = rdocBox (docToHtml doc) + + +bodyBox :: Html -> HtmlTable +bodyBox html = tda [theclass "body"] << vanillaTable << html + +-- a vanilla table has width 100%, no border, no padding, no spacing +vanillaTable, vanillaTable2 :: Html -> Html +vanillaTable = table ! [theclass "vanilla", cellspacing 0, cellpadding 0] +vanillaTable2 = table ! [theclass "vanilla2", cellspacing 0, cellpadding 0] + +spacedTable1, spacedTable5 :: Html -> Html +spacedTable1 = table ! [theclass "vanilla", cellspacing 1, cellpadding 0] +spacedTable5 = table ! [theclass "vanilla", cellspacing 5, cellpadding 0] + +constrHdr, methHdr, atHdr :: HtmlTable +constrHdr = tda [ theclass "section4" ] << toHtml "Constructors" +methHdr = tda [ theclass "section4" ] << toHtml "Methods" +atHdr = tda [ theclass "section4" ] << toHtml "Associated Types" + +instHdr :: String -> HtmlTable +instHdr id_ = + tda [ theclass "section4" ] << (collapsebutton id_ +++ toHtml " Instances") addfile ./src/Haddock/Backends/Xhtml/Names.hs hunk ./src/Haddock/Backends/Xhtml/Names.hs 1 +----------------------------------------------------------------------------- +-- | +-- Module : Haddock.Backends.Html.Names +-- Copyright : (c) Simon Marlow 2003-2006, +-- David Waern 2006-2009, +-- Mark Lentczner 2010 +-- License : BSD-like +-- +-- Maintainer : haddock@projects.haskell.org +-- Stability : experimental +-- Portability : portable +----------------------------------------------------------------------------- + +module Haddock.Backends.Xhtml.Names where + +import Haddock.Backends.Xhtml.Util +import Haddock.GhcUtils +import Haddock.Types +import Haddock.Utils + +import Text.XHtml hiding ( name, title, p, quote ) + +import GHC +import Name +import RdrName + +ppOccName :: OccName -> Html +ppOccName = toHtml . occNameString + +ppRdrName :: RdrName -> Html +ppRdrName = ppOccName . rdrNameOcc + +ppLDocName :: Located DocName -> Html +ppLDocName (L _ d) = ppDocName d + +ppDocName :: DocName -> Html +ppDocName (Documented name mdl) = + linkIdOcc mdl (Just occName) << ppOccName occName + where occName = nameOccName name +ppDocName (Undocumented name) = toHtml (getOccString name) + +linkTarget :: OccName -> Html +linkTarget n = namedAnchor (anchorNameStr n) << toHtml "" + +ppName :: Name -> Html +ppName name = toHtml (getOccString name) + + +ppBinder :: Bool -> OccName -> Html +-- The Bool indicates whether we are generating the summary, in which case +-- the binder will be a link to the full definition. +ppBinder True n = linkedAnchor (anchorNameStr n) << ppBinder' n +ppBinder False n = linkTarget n +++ bold << ppBinder' n + + +ppBinder' :: OccName -> Html +ppBinder' n + | isVarSym n = parens $ ppOccName n + | otherwise = ppOccName n + + +linkId :: Module -> Maybe Name -> Html -> Html +linkId mdl mbName = linkIdOcc mdl (fmap nameOccName mbName) + + +linkIdOcc :: Module -> Maybe OccName -> Html -> Html +linkIdOcc mdl mbName = anchor ! [href uri] + where + uri = case mbName of + Nothing -> moduleHtmlFile mdl + Just name -> nameHtmlRef mdl name + +ppModule :: Module -> String -> Html +ppModule mdl ref = anchor ! [href ((moduleHtmlFile mdl) ++ ref)] + << toHtml (moduleString mdl) + addfile ./src/Haddock/Backends/Xhtml/Types.hs hunk ./src/Haddock/Backends/Xhtml/Types.hs 1 +----------------------------------------------------------------------------- +-- | +-- Module : Haddock.Backends.Html.Types +-- Copyright : (c) Simon Marlow 2003-2006, +-- David Waern 2006-2009, +-- Mark Lentczner 2010 +-- License : BSD-like +-- +-- Maintainer : haddock@projects.haskell.org +-- Stability : experimental +-- Portability : portable +----------------------------------------------------------------------------- + +module Haddock.Backends.Xhtml.Types where + + +-- the base, module and entity URLs for the source code and wiki links. +type SourceURLs = (Maybe String, Maybe String, Maybe String) +type WikiURLs = (Maybe String, Maybe String, Maybe String) + +-- The URL for source and wiki links, and the current module +type LinksInfo = (SourceURLs, WikiURLs) addfile ./src/Haddock/Backends/Xhtml/Util.hs hunk ./src/Haddock/Backends/Xhtml/Util.hs 1 +----------------------------------------------------------------------------- +-- | +-- Module : Haddock.Backends.Html.Util +-- Copyright : (c) Simon Marlow 2003-2006, +-- David Waern 2006-2009, +-- Mark Lentczner 2010 +-- License : BSD-like +-- +-- Maintainer : haddock@projects.haskell.org +-- Stability : experimental +-- Portability : portable +----------------------------------------------------------------------------- + +module Haddock.Backends.Xhtml.Util where + +import Haddock.GhcUtils +import Haddock.Utils + +import Data.Maybe + +import Text.XHtml hiding ( name, title, p, quote ) +import qualified Text.XHtml as Html + +import GHC ( SrcSpan, srcSpanStartLine, Name ) +import Module ( Module ) +import Name ( getOccString, nameOccName, isValOcc ) + + +spliceURL :: Maybe FilePath -> Maybe Module -> Maybe GHC.Name -> + Maybe SrcSpan -> String -> String +spliceURL maybe_file maybe_mod maybe_name maybe_loc url = run url + where + file = fromMaybe "" maybe_file + mdl = case maybe_mod of + Nothing -> "" + Just m -> moduleString m + + (name, kind) = + case maybe_name of + Nothing -> ("","") + Just n | isValOcc (nameOccName n) -> (escapeStr (getOccString n), "v") + | otherwise -> (escapeStr (getOccString n), "t") + + line = case maybe_loc of + Nothing -> "" + Just span_ -> show $ srcSpanStartLine span_ + + run "" = "" + run ('%':'M':rest) = mdl ++ run rest + run ('%':'F':rest) = file ++ run rest + run ('%':'N':rest) = name ++ run rest + run ('%':'K':rest) = kind ++ run rest + run ('%':'L':rest) = line ++ run rest + run ('%':'%':rest) = "%" ++ run rest + + run ('%':'{':'M':'O':'D':'U':'L':'E':'}':rest) = mdl ++ run rest + run ('%':'{':'F':'I':'L':'E':'}':rest) = file ++ run rest + run ('%':'{':'N':'A':'M':'E':'}':rest) = name ++ run rest + run ('%':'{':'K':'I':'N':'D':'}':rest) = kind ++ run rest + + run ('%':'{':'M':'O':'D':'U':'L':'E':'/':'.':'/':c:'}':rest) = + map (\x -> if x == '.' then c else x) mdl ++ run rest + + run ('%':'{':'F':'I':'L':'E':'/':'/':'/':c:'}':rest) = + map (\x -> if x == '/' then c else x) file ++ run rest + + run ('%':'{':'L':'I':'N':'E':'}':rest) = line ++ run rest + + run (c:rest) = c : run rest + + +renderToString :: Html -> String +-- renderToString = showHtml -- for production +renderToString = prettyHtml -- for debugging + +hsep :: [Html] -> Html +hsep [] = noHtml +hsep htmls = foldr1 (\a b -> a+++" "+++b) htmls + +infixr 8 <+>, <++> +(<+>) :: Html -> Html -> Html +a <+> b = a +++ toHtml " " +++ b + +(<++>) :: Html -> Html -> Html +a <++> b = a +++ spaceHtml +++ b + +keyword :: String -> Html +keyword s = thespan ! [theclass "keyword"] << toHtml s + +equals, comma :: Html +equals = char '=' +comma = char ',' + +char :: Char -> Html +char c = toHtml [c] + +empty :: Html +empty = noHtml + + +quote :: Html -> Html +quote h = char '`' +++ h +++ '`' + + +parens, brackets, pabrackets, braces :: Html -> Html +parens h = char '(' +++ h +++ char ')' +brackets h = char '[' +++ h +++ char ']' +pabrackets h = toHtml "[:" +++ h +++ toHtml ":]" +braces h = char '{' +++ h +++ char '}' + +punctuate :: Html -> [Html] -> [Html] +punctuate _ [] = [] +punctuate h (d0:ds) = go d0 ds + where + go d [] = [d] + go d (e:es) = (d +++ h) : go e es + +abovesSep :: HtmlTable -> [HtmlTable] -> HtmlTable +abovesSep _ [] = emptyTable +abovesSep h (d0:ds) = go d0 ds + where + go d [] = d + go d (e:es) = d h go e es + +parenList :: [Html] -> Html +parenList = parens . hsep . punctuate comma + +ubxParenList :: [Html] -> Html +ubxParenList = ubxparens . hsep . punctuate comma + +ubxparens :: Html -> Html +ubxparens h = toHtml "(#" +++ h +++ toHtml "#)" + + +tda :: [HtmlAttr] -> Html -> HtmlTable +tda as = cell . (td ! as) + +emptyTable :: HtmlTable +emptyTable = cell noHtml + +onclick :: String -> HtmlAttr +onclick = strAttr "onclick" + + +dcolon, arrow, darrow, forallSymbol :: Bool -> Html +dcolon unicode = toHtml (if unicode then "∷" else "::") +arrow unicode = toHtml (if unicode then "→" else "->") +darrow unicode = toHtml (if unicode then "⇒" else "=>") +forallSymbol unicode = if unicode then toHtml "∀" else keyword "forall" + + +dot :: Html +dot = toHtml "." + + +s8 :: HtmlTable +s8 = tda [ theclass "s8" ] << noHtml + + +-- | Generate a named anchor +-- +-- This actually generates two anchor tags, one with the name unescaped, and one +-- with the name URI-escaped. This is needed because Opera 9.52 (and later +-- versions) needs the name to be unescaped, while IE 7 needs it to be escaped. +-- +namedAnchor :: String -> Html -> Html +namedAnchor n c = anchor ! [Html.name n] << noHtml +++ + anchor ! [Html.name (escapeStr n)] << c + + +-- +-- A section of HTML which is collapsible via a +/- button. +-- + +-- TODO: Currently the initial state is non-collapsed. Change the 'minusFile' +-- below to a 'plusFile' and the 'display:block;' to a 'display:none;' when we +-- use cookies from JavaScript to have a more persistent state. + +collapsebutton :: String -> Html +collapsebutton id_ = + image ! [ src minusFile, theclass "coll", onclick ("toggle(this,'" ++ id_ ++ "')"), alt "show/hide" ] + +collapsed :: (HTML a) => (Html -> Html) -> String -> a -> Html +collapsed fn id_ html = + fn ! [identifier id_, thestyle "display:block;"] << html + +-- A quote is a valid part of a Haskell identifier, but it would interfere with +-- the ECMA script string delimiter used in collapsebutton above. +collapseId :: Name -> String +collapseId nm = "i:" ++ escapeStr (getOccString nm) + +linkedAnchor :: String -> Html -> Html +linkedAnchor frag = anchor ! [href hr_] + where hr_ | null frag = "" + | otherwise = '#': escapeStr frag + +documentCharacterEncoding :: Html +documentCharacterEncoding = + meta ! [httpequiv "Content-Type", content "text/html; charset=UTF-8"] + +styleSheet :: Html +styleSheet = + (thelink ! [href cssFile, rel "stylesheet", thetype "text/css"]) noHtml hunk ./src/Haddock/Options.hs 80 + | Flag_Xhtml hunk ./src/Haddock/Options.hs 117 + Option [] ["xhtml"] (NoArg Flag_Xhtml) "use experimental XHTML rendering", hunk ./src/Main.hs 21 -import Haddock.Backends.Html +import qualified Haddock.Backends.Html as Html +import qualified Haddock.Backends.Xhtml as Xhtml hunk ./src/Main.hs 222 + -- which HTML redering to use + pick htmlF xhtmlF = if (Flag_Xhtml `elem` flags) then xhtmlF else htmlF + ppHtmlIndex = pick Html.ppHtmlIndex Xhtml.ppHtmlIndex + ppHtmlHelpFiles = pick Html.ppHtmlHelpFiles Xhtml.ppHtmlHelpFiles + ppHtmlContents = pick Html.ppHtmlContents Xhtml.ppHtmlContents + ppHtml = pick Html.ppHtml Xhtml.ppHtml + copyHtmlBits = pick Html.copyHtmlBits Xhtml.copyHtmlBits hunk ./tests/golden-tests/README 27 +You can pass extra options to haddock like so + runhaskell runtests.hs --xhtml all + hunk ./tests/golden-tests/runtests.hs 68 - + let (opts, spec) = span ("-" `isPrefixOf`) args hunk ./tests/golden-tests/runtests.hs 70 - case args of + case spec of hunk ./tests/golden-tests/runtests.hs 93 - handle <- runProcess "../dist/build/haddock/haddock" (["-w", "-o", outdir, "-h", "--optghc=-fglasgow-exts", "--optghc=-w", base, process] ++ mods') Nothing (Just [("haddock_datadir", "../.")]) Nothing Nothing Nothing + handle <- runProcess "../dist/build/haddock/haddock" (["-w", "-o", outdir, "-h", "--optghc=-fglasgow-exts", "--optghc=-w", base, process] ++ opts ++ mods') Nothing (Just [("haddock_datadir", "../.")]) Nothing Nothing Nothing hunk ./src/Haddock/Backends/Xhtml/Decl.hs 600 +#if __GLASGOW_HASKELL__ == 612 hunk ./src/Haddock/Backends/Xhtml/Decl.hs 602 +#else +ppConstrHdr :: HsExplicitFlag -> [Name] -> HsContext DocName -> Bool -> Html +#endif hunk ./src/Haddock/Backends/Xhtml/Decl.hs 816 +#if __GLASGOW_HASKELL__ == 612 hunk ./src/Haddock/Backends/Xhtml/Decl.hs 818 +#else +ppForAll :: HsExplicitFlag -> [Located (HsTyVarBndr DocName)] +#endif hunk ./src/Haddock/Backends/Xhtml/Decl.hs 840 --- gaw 2004 hunk ./src/Haddock/Backends/Xhtml/Decl.hs 849 -ppr_mono_ty _ (HsSpliceTy _) _ = error "ppr_mono_ty HsSpliceTy" -ppr_mono_ty _ (HsSpliceTyOut _) _ = error "ppr_mono_ty HsSpliceTyOut" -ppr_mono_ty _ (HsRecTy _) _ = error "ppr_mono_ty HsRecTy" - +ppr_mono_ty _ (HsSpliceTy {}) _ = error "ppr_mono_ty HsSpliceTy" +#if __GLASGOW_HASKELL__ == 612 +ppr_mono_ty _ (HsSpliceTyOut {}) _ = error "ppr_mono_ty HsQuasiQuoteTy" +#else +ppr_mono_ty _ (HsQuasiQuoteTy {}) _ = error "ppr_mono_ty HsQuasiQuoteTy" +#endif +ppr_mono_ty _ (HsRecTy {}) _ = error "ppr_mono_ty HsRecTy" hunk ./haddock.cabal 113 + Haddock.Backends.Xhtml + Haddock.Backends.Xhtml.Decl + Haddock.Backends.Xhtml.DocMarkup + Haddock.Backends.Xhtml.Layout + Haddock.Backends.Xhtml.Names + Haddock.Backends.Xhtml.Types + Haddock.Backends.Xhtml.Util hunk ./haddock.cabal 142 + xhtml >= 3000.2 && < 3000.3, hunk ./haddock.cabal 179 + Haddock.Backends.Xhtml + Haddock.Backends.Xhtml.Decl + Haddock.Backends.Xhtml.DocMarkup + Haddock.Backends.Xhtml.Layout + Haddock.Backends.Xhtml.Names + Haddock.Backends.Xhtml.Types + Haddock.Backends.Xhtml.Util hunk ./src/Haddock/Backends/Hoogle.hs 242 - markupAName = const $ str "" + markupAName = const $ str "", + markupExample = box TagPre . str . unlines . (map exampleToString) hunk ./src/Haddock/Backends/Html.hs 1725 - markupAName = \aname -> namedAnchor aname << toHtml "" + markupAName = \aname -> namedAnchor aname << toHtml "", + markupExample = examplesToHtml hunk ./src/Haddock/Backends/Html.hs 1740 + examplesToHtml l = (pre $ concatHtml $ map exampleToHtml l) ! [theclass "screen"] + + exampleToHtml (Example expression result) = htmlExample + where + htmlExample = htmlPrompt +++ htmlExpression +++ (toHtml $ unlines result) + htmlPrompt = (thecode . toHtml $ "ghci> ") ! [theclass "prompt"] + htmlExpression = (strong . thecode . toHtml $ expression ++ "\n") ! [theclass "userinput"] + hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 45 - markupAName = \aname -> namedAnchor aname << toHtml "" + markupAName = \aname -> namedAnchor aname << toHtml "", + markupExample = examplesToHtml hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 60 + examplesToHtml l = (pre $ concatHtml $ map exampleToHtml l) ! [theclass "screen"] + + exampleToHtml (Example expression result) = htmlExample + where + htmlExample = htmlPrompt +++ htmlExpression +++ (toHtml $ unlines result) + htmlPrompt = (thecode . toHtml $ "ghci> ") ! [theclass "prompt"] + htmlExpression = (strong . thecode . toHtml $ expression ++ "\n") ! [theclass "userinput"] + hunk ./src/Haddock/Interface/Rename.hs 204 + DocExamples e -> return (DocExamples e) hunk ./src/Haddock/Interface/Rn.hs 83 + DocExamples e -> return (DocExamples e) + hunk ./src/Haddock/InterfaceFile.hs 380 +instance Binary Example where + put_ bh (Example expression result) = do + put_ bh expression + put_ bh result + get bh = do + expression <- get bh + result <- get bh + return (Example expression result) + + hunk ./src/Haddock/InterfaceFile.hs 437 + put_ bh (DocExamples ao) = do + putByte bh 15 + put_ bh ao hunk ./src/Haddock/InterfaceFile.hs 488 + 15 -> do + ao <- get bh + return (DocExamples ao) hunk ./src/Haddock/Lex.x 48 + $ws* ghci \> { strtoken TokExamplePrompt `andBegin` exampleexpr } hunk ./src/Haddock/Lex.x 71 + { + $ws* \n { token TokPara `andBegin` para } + $ws* ghci \> { strtoken TokExamplePrompt `andBegin` exampleexpr } + () { begin exampleresult } +} + + .* \n { strtokenNL TokExampleExpression `andBegin` example } + + .* \n { strtokenNL TokExampleResult `andBegin` example } + hunk ./src/Haddock/Lex.x 123 + | TokExamplePrompt String + | TokExampleExpression String + | TokExampleResult String hunk ./src/Haddock/Parse.y 12 -import Haddock.Types (Doc(..)) +import Haddock.Types (Doc(..), Example(Example)) hunk ./src/Haddock/Parse.y 16 +import Data.Char (isSpace) +import Data.Maybe (fromMaybe) +import Data.List (stripPrefix) hunk ./src/Haddock/Parse.y 37 + PROMPT { TokExamplePrompt $$ } + RESULT { TokExampleResult $$ } + EXP { TokExampleExpression $$ } hunk ./src/Haddock/Parse.y 75 + | examples { DocExamples $1 } hunk ./src/Haddock/Parse.y 81 +examples :: { [Example] } + : example examples { $1 : $2 } + | example { [$1] } + +example :: { Example } + : PROMPT EXP result { makeExample $1 $2 (lines $3) } + | PROMPT EXP { makeExample $1 $2 [] } + +result :: { String } + : RESULT result { $1 ++ $2 } + | RESULT { $1 } + hunk ./src/Haddock/Parse.y 122 + +-- | Create an 'Example', stripping superfluous characters as appropriate +makeExample :: String -> String -> [String] -> Example +makeExample prompt expression result = + Example + (strip expression) -- we do not care about leading and trailing + -- whitespace in expressions, so drop them + result' + where + -- drop trailing whitespace from the prompt, remember the prefix + (prefix, _) = span isSpace prompt + -- drop, if possible, the exact same sequence of whitespace characters + -- from each result line + result' = map (tryStripPrefix prefix) result + where + tryStripPrefix xs ys = fromMaybe ys $ stripPrefix xs ys + +-- | Remove all leading and trailing whitespace +strip :: String -> String +strip = dropWhile isSpace . reverse . dropWhile isSpace . reverse hunk ./src/Haddock/Types.hs 282 + | DocExamples [Example] hunk ./src/Haddock/Types.hs 285 +data Example = Example { exampleExpression :: String + , exampleResult :: [String] + } + deriving (Eq, Show) + +exampleToString :: Example -> String +exampleToString (Example expression result) = + "ghci> " ++ expression ++ "\n" ++ unlines result hunk ./src/Haddock/Types.hs 334 - markupPic :: String -> a + markupPic :: String -> a, + markupExample :: [Example] -> a hunk ./src/Haddock/Utils.hs 362 +markup m (DocExamples e) = markupExample m e hunk ./src/Haddock/Utils.hs 386 - markupPic = DocPic + markupPic = DocPic, + markupExample = DocExamples hunk ./src/Haddock/Interface/LexParseRn.hs 45 - let toks = tokenise str + let toks = tokenise str (0,0) -- TODO: real position hunk ./src/Haddock/Interface/ParseModuleHeader.hs 47 - Just description -> case parseString . tokenise $ description of + -- TODO: pass real file position + Just description -> case parseString $ tokenise description (0,0) of hunk ./src/Haddock/Interface/ParseModuleHeader.hs 54 - Right docOpt -> case parseParas . tokenise $ str8 of + -- TODO: pass real file position + Right docOpt -> case parseParas $ tokenise str8 (0,0) of hunk ./src/Haddock/Lex.x 20 + LToken, hunk ./src/Haddock/Lex.x 36 +%wrapper "posn" + hunk ./src/Haddock/Lex.x 112 +-- | A located token +type LToken = (Token, AlexPosn) + hunk ./src/Haddock/Lex.x 134 +tokenPos :: LToken -> (Int, Int) +tokenPos t = let AlexPn _ line col = snd t in (line, col) + hunk ./src/Haddock/Lex.x 141 -type Action = String -> StartCode -> (StartCode -> [Token]) -> [Token] - -type AlexInput = (Char,String) - -alexGetChar (_, []) = Nothing -alexGetChar (_, c:cs) = Just (c, (c,cs)) +type Action = AlexPosn -> String -> StartCode -> (StartCode -> [LToken]) -> [LToken] hunk ./src/Haddock/Lex.x 143 -alexInputPrevChar (c,_) = c +tokenise :: String -> (Int, Int) -> [LToken] +tokenise str (line, col) = let toks = go (posn, '\n', eofHack str) para in {-trace (show toks)-} toks + where + posn = AlexPn 0 line col hunk ./src/Haddock/Lex.x 148 -tokenise :: String -> [Token] -tokenise str = let toks = go ('\n', eofHack str) para in {-trace (show toks)-} toks - where go inp@(_,str) sc = + go inp@(pos, _, str) sc = hunk ./src/Haddock/Lex.x 153 - AlexToken inp' len act -> act (take len str) sc (\sc -> go inp' sc) + AlexToken inp'@(pos',_,_) len act -> act pos (take len str) sc (\sc -> go inp' sc) hunk ./src/Haddock/Lex.x 160 -andBegin act new_sc = \str _ cont -> act str new_sc cont +andBegin act new_sc = \pos str _ cont -> act pos str new_sc cont hunk ./src/Haddock/Lex.x 163 -token t = \_ sc cont -> t : cont sc +token t = \pos _ sc cont -> (t, pos) : cont sc hunk ./src/Haddock/Lex.x 166 -strtoken t = \str sc cont -> t str : cont sc -strtokenNL t = \str sc cont -> t (filter (/= '\r') str) : cont sc +strtoken t = \pos str sc cont -> (t str, pos) : cont sc +strtokenNL t = \pos str sc cont -> (t (filter (/= '\r') str), pos) : cont sc hunk ./src/Haddock/Lex.x 172 -begin sc = \_ _ cont -> cont sc +begin sc = \_ _ _ cont -> cont sc hunk ./src/Haddock/Lex.x 178 -ident str sc cont = +ident pos str sc cont = hunk ./src/Haddock/Lex.x 180 - Just names -> TokIdent names : cont sc - Nothing -> TokString str : cont sc + Just names -> (TokIdent names, pos) : cont sc + Nothing -> (TokString str, pos) : cont sc hunk ./src/Haddock/Parse.y 23 -%tokentype { Token } +%tokentype { LToken } hunk ./src/Haddock/Parse.y 25 -%token '/' { TokSpecial '/' } - '@' { TokSpecial '@' } - '[' { TokDefStart } - ']' { TokDefEnd } - DQUO { TokSpecial '\"' } - URL { TokURL $$ } - PIC { TokPic $$ } - ANAME { TokAName $$ } - '/../' { TokEmphasis $$ } - '-' { TokBullet } - '(n)' { TokNumber } - '>..' { TokBirdTrack $$ } - PROMPT { TokExamplePrompt $$ } - RESULT { TokExampleResult $$ } - EXP { TokExampleExpression $$ } - IDENT { TokIdent $$ } - PARA { TokPara } - STRING { TokString $$ } +%token '/' { (TokSpecial '/',_) } + '@' { (TokSpecial '@',_) } + '[' { (TokDefStart,_) } + ']' { (TokDefEnd,_) } + DQUO { (TokSpecial '\"',_) } + URL { (TokURL $$,_) } + PIC { (TokPic $$,_) } + ANAME { (TokAName $$,_) } + '/../' { (TokEmphasis $$,_) } + '-' { (TokBullet,_) } + '(n)' { (TokNumber,_) } + '>..' { (TokBirdTrack $$,_) } + PROMPT { (TokExamplePrompt $$,_) } + RESULT { (TokExampleResult $$,_) } + EXP { (TokExampleExpression $$,_) } + IDENT { (TokIdent $$,_) } + PARA { (TokPara,_) } + STRING { (TokString $$,_) } hunk ./src/Haddock/Parse.y 120 -happyError :: [Token] -> Maybe a +happyError :: [LToken] -> Maybe a hunk ./src/Main.hs 408 - case parseParas (tokenise str) of + case parseParas (tokenise str (0,0) {- TODO: real position -}) of hunk ./tests/golden-tests/runtests.hs 17 +haddockPath = ".." "dist" "build" "haddock" "haddock" + + hunk ./tests/golden-tests/runtests.hs 25 -haddockEq file1 file2 = stripLinks file1 == stripLinks file2 +test = do + x <- doesFileExist haddockPath + when (not x) $ die "you need to run 'cabal build' successfully first" hunk ./tests/golden-tests/runtests.hs 29 -stripLinks f = subRegex (mkRegexWithOpts "]*>" False False) f "" + contents <- getDirectoryContents "tests" + args <- getArgs + let (opts, spec) = span ("-" `isPrefixOf`) args + let mods = + case spec of + x:_ | x /= "all" -> [x ++ ".hs"] + _ -> filter ((==) ".hs" . takeExtension) contents hunk ./tests/golden-tests/runtests.hs 37 -programOnPath p = do - result <- findProgramLocation silent p - return (isJust result) + let outdir = "output" + let mods' = map ("tests" ) mods + putStrLn "" + putStrLn "Haddock version: " + h1 <- runProcess haddockPath ["--version"] Nothing + (Just [("haddock_datadir", "../.")]) Nothing Nothing Nothing + waitForProcess h1 + putStrLn "" + putStrLn "GHC version: " + h2 <- runProcess haddockPath ["--ghc-version"] Nothing + (Just [("haddock_datadir", "../.")]) Nothing Nothing Nothing + waitForProcess h2 + putStrLn "" + + libdir <- rawSystemStdout normal haddockPath ["--print-ghc-libdir"] + let basepath = init libdir ++ "/../../share/doc/ghc/html/libraries/base-4.2.0.0/" + let base = "-i " ++ basepath ++ "," ++ basepath ++ "base.haddock" + let processpath = init libdir ++ "/../../share/doc/ghc/html/libraries/process-1.0.1.2/" + let process = "-i " ++ processpath ++ "," ++ processpath ++ "process.haddock" + + putStrLn "Running tests..." + handle <- runProcess haddockPath + (["-w", "-o", outdir, "-h", "--optghc=-fglasgow-exts" + , "--optghc=-w", base, process] ++ opts ++ mods') + Nothing (Just [("haddock_datadir", "../.")]) Nothing + Nothing Nothing + + code <- waitForProcess handle + when (code /= ExitSuccess) $ error "Haddock run failed! Exiting." + check mods (if not (null args) && args !! 0 == "all" then False else True) hunk ./tests/golden-tests/runtests.hs 99 -test = do +haddockEq file1 file2 = stripLinks file1 == stripLinks file2 hunk ./tests/golden-tests/runtests.hs 101 - x <- doesFileExist (".." "dist" "build" "haddock" "haddock") - when (not x) $ die "you need to run 'cabal build' successfully first" hunk ./tests/golden-tests/runtests.hs 102 - contents <- getDirectoryContents "tests" - args <- getArgs - let (opts, spec) = span ("-" `isPrefixOf`) args - let mods = - case spec of - x:_ | x /= "all" -> [x ++ ".hs"] - _ -> filter ((==) ".hs" . takeExtension) contents +stripLinks f = subRegex (mkRegexWithOpts "]*>" False False) f "" hunk ./tests/golden-tests/runtests.hs 104 - let outdir = "output" - let mods' = map ("tests" ) mods - putStrLn "" - putStrLn "Haddock version: " - h1 <- runProcess "../dist/build/haddock/haddock" ["--version"] Nothing (Just [("haddock_datadir", "../.")]) Nothing Nothing Nothing - waitForProcess h1 - putStrLn "" - putStrLn "GHC version: " - h2 <- runProcess "../dist/build/haddock/haddock" ["--ghc-version"] Nothing (Just [("haddock_datadir", "../.")]) Nothing Nothing Nothing - waitForProcess h2 - putStrLn "" hunk ./tests/golden-tests/runtests.hs 105 - libdir <- rawSystemStdout normal "../dist/build/haddock/haddock" ["--print-ghc-libdir"] - let basepath = init libdir ++ "/../../share/doc/ghc/html/libraries/base-4.2.0.0/" - let base = "-i " ++ basepath ++ "," ++ basepath ++ "base.haddock" - let processpath = init libdir ++ "/../../share/doc/ghc/html/libraries/process-1.0.1.2/" - let process = "-i " ++ processpath ++ "," ++ processpath ++ "process.haddock" +programOnPath p = do + result <- findProgramLocation silent p + return (isJust result) hunk ./tests/golden-tests/runtests.hs 109 - putStrLn "Running tests..." - handle <- runProcess "../dist/build/haddock/haddock" (["-w", "-o", outdir, "-h", "--optghc=-fglasgow-exts", "--optghc=-w", base, process] ++ opts ++ mods') Nothing (Just [("haddock_datadir", "../.")]) Nothing Nothing Nothing - code <- waitForProcess handle - when (code /= ExitSuccess) $ error "Haddock run failed! Exiting." - check mods (if not (null args) && args !! 0 == "all" then False else True) hunk ./tests/golden-tests/runtests.hs 51 + -- TODO: use Distribution.* to get the packages instead hunk ./tests/golden-tests/runtests.hs 53 - let basepath = init libdir ++ "/../../share/doc/ghc/html/libraries/base-4.2.0.0/" - let base = "-i " ++ basepath ++ "," ++ basepath ++ "base.haddock" - let processpath = init libdir ++ "/../../share/doc/ghc/html/libraries/process-1.0.1.2/" - let process = "-i " ++ processpath ++ "," ++ processpath ++ "process.haddock" + let librariesPath = "..""..""share""doc""ghc""html""libraries" + + let mkDep name version = + let path = init libdir librariesPath name ++ "-" ++ version + in "-i " ++ path ++ "," ++ path name ++ ".haddock" + + let base = mkDep "base" "4.2.0.0" + process = mkDep "process" "1.0.1.2" hunk ./tests/golden-tests/runtests.hs 61 + ghcprim = mkDep "ghc-prim" "0.2.0.0" hunk ./tests/golden-tests/runtests.hs 66 - , "--optghc=-w", base, process] ++ opts ++ mods') + , "--optghc=-w", base, process, ghcprim] ++ opts ++ mods') hunk ./tests/golden-tests/tests/FunArgs.html.ref 121 ->-> ()-> () () () () () () () () () () () -> T2 () () -> T2 () () -> IO () () () -> IO () () -> IO () -> IO () () () () () () () () () () () () () () () () [(Decl, MaybeDocStrings)] -> ErrMsgM [DeclInfo] -declInfos gre decls = +declInfos :: DynFlags -> GlobalRdrEnv -> [(Decl, MaybeDocStrings)] -> ErrMsgM [DeclInfo] +declInfos dflags gre decls = hunk ./src/Haddock/Interface/Create.hs 175 - mbDoc <- lexParseRnHaddockCommentList NormalHaddockComment + mbDoc <- lexParseRnHaddockCommentList dflags NormalHaddockComment hunk ./src/Haddock/Interface/Create.hs 179 - \doc -> lexParseRnHaddockComment NormalHaddockComment gre doc + \doc -> lexParseRnHaddockComment dflags NormalHaddockComment gre doc hunk ./src/Haddock/Interface/Create.hs 183 - mbSubDoc <- lexParseRnHaddockCommentList NormalHaddockComment + mbSubDoc <- lexParseRnHaddockCommentList dflags NormalHaddockComment hunk ./src/Haddock/Interface/Create.hs 187 - \doc -> lexParseRnHaddockComment NormalHaddockComment gre doc + \doc -> lexParseRnHaddockComment dflags NormalHaddockComment gre doc hunk ./src/Haddock/Interface/Create.hs 435 + -> DynFlags hunk ./src/Haddock/Interface/Create.hs 439 - opts maybe_exps ignore_all_exports _ instIfaceMap + opts maybe_exps ignore_all_exports _ instIfaceMap dflags hunk ./src/Haddock/Interface/Create.hs 447 - liftErrMsg $ fullContentsOfThisModule gre decls + liftErrMsg $ fullContentsOfThisModule dflags gre decls hunk ./src/Haddock/Interface/Create.hs 456 - ifDoc (lexParseRnHaddockComment DocSectionComment gre docStr) + ifDoc (lexParseRnHaddockComment dflags DocSectionComment gre docStr) hunk ./src/Haddock/Interface/Create.hs 459 - ifDoc (lexParseRnHaddockComment NormalHaddockComment gre docStr) + ifDoc (lexParseRnHaddockComment dflags NormalHaddockComment gre docStr) hunk ./src/Haddock/Interface/Create.hs 464 - ifDoc (lexParseRnHaddockComment NormalHaddockComment gre docStr) + ifDoc (lexParseRnHaddockComment dflags NormalHaddockComment gre docStr) hunk ./src/Haddock/Interface/Create.hs 623 - | m == this_mod = liftErrMsg $ fullContentsOfThisModule gre decls + | m == this_mod = liftErrMsg $ fullContentsOfThisModule dflags gre decls hunk ./src/Haddock/Interface/Create.hs 671 -fullContentsOfThisModule :: GlobalRdrEnv -> [DeclInfo] -> ErrMsgM [ExportItem Name] -fullContentsOfThisModule gre decls = liftM catMaybes $ mapM mkExportItem decls +fullContentsOfThisModule :: DynFlags -> GlobalRdrEnv -> [DeclInfo] -> ErrMsgM [ExportItem Name] +fullContentsOfThisModule dflags gre decls = liftM catMaybes $ mapM mkExportItem decls hunk ./src/Haddock/Interface/Create.hs 675 - mbDoc <- lexParseRnHaddockComment DocSectionComment gre docStr + mbDoc <- lexParseRnHaddockComment dflags DocSectionComment gre docStr hunk ./src/Haddock/Interface/Create.hs 678 - mbDoc <- lexParseRnHaddockComment NormalHaddockComment gre docStr + mbDoc <- lexParseRnHaddockComment dflags NormalHaddockComment gre docStr hunk ./src/Haddock/Interface/LexParseRn.hs 32 -lexParseRnHaddockCommentList :: HaddockCommentType -> GlobalRdrEnv -> [HsDocString] -> ErrMsgM (Maybe (Doc Name)) -lexParseRnHaddockCommentList hty gre docStrs = do - docMbs <- mapM (lexParseRnHaddockComment hty gre) docStrs +lexParseRnHaddockCommentList :: DynFlags -> HaddockCommentType -> GlobalRdrEnv -> [HsDocString] -> ErrMsgM (Maybe (Doc Name)) +lexParseRnHaddockCommentList dflags hty gre docStrs = do + docMbs <- mapM (lexParseRnHaddockComment dflags hty gre) docStrs hunk ./src/Haddock/Interface/LexParseRn.hs 41 -lexParseRnHaddockComment :: HaddockCommentType -> +lexParseRnHaddockComment :: DynFlags -> HaddockCommentType -> hunk ./src/Haddock/Interface/LexParseRn.hs 43 -lexParseRnHaddockComment hty gre (HsDocString fs) = do +lexParseRnHaddockComment dflags hty gre (HsDocString fs) = do hunk ./src/Haddock/Interface/LexParseRn.hs 45 - let toks = tokenise str (0,0) -- TODO: real position + let toks = tokenise dflags str (0,0) -- TODO: real position hunk ./src/Haddock/Interface/LexParseRn.hs 55 -lexParseRnMbHaddockComment :: HaddockCommentType -> GlobalRdrEnv -> Maybe HsDocString -> ErrMsgM (Maybe (Doc Name)) -lexParseRnMbHaddockComment _ _ Nothing = return Nothing -lexParseRnMbHaddockComment hty gre (Just d) = lexParseRnHaddockComment hty gre d +lexParseRnMbHaddockComment :: DynFlags -> HaddockCommentType -> GlobalRdrEnv -> Maybe HsDocString -> ErrMsgM (Maybe (Doc Name)) +lexParseRnMbHaddockComment _ _ _ Nothing = return Nothing +lexParseRnMbHaddockComment dflags hty gre (Just d) = lexParseRnHaddockComment dflags hty gre d hunk ./src/Haddock/Interface/LexParseRn.hs 60 -lexParseRnHaddockModHeader :: GlobalRdrEnv -> GhcDocHdr -> ErrMsgM (HaddockModInfo Name, Maybe (Doc Name)) -lexParseRnHaddockModHeader gre mbStr = do +lexParseRnHaddockModHeader :: DynFlags -> GlobalRdrEnv -> GhcDocHdr -> ErrMsgM (HaddockModInfo Name, Maybe (Doc Name)) +lexParseRnHaddockModHeader dflags gre mbStr = do hunk ./src/Haddock/Interface/LexParseRn.hs 67 - case parseModuleHeader str of + case parseModuleHeader dflags str of hunk ./src/Haddock/Interface/ParseModuleHeader.hs 18 +import DynFlags hunk ./src/Haddock/Interface/ParseModuleHeader.hs 28 -parseModuleHeader :: String -> Either String (HaddockModInfo RdrName, Doc RdrName) -parseModuleHeader str0 = +parseModuleHeader :: DynFlags -> String -> Either String (HaddockModInfo RdrName, Doc RdrName) +parseModuleHeader dflags str0 = hunk ./src/Haddock/Interface/ParseModuleHeader.hs 49 - Just description -> case parseString $ tokenise description (0,0) of + Just description -> case parseString $ tokenise dflags description (0,0) of hunk ./src/Haddock/Interface/ParseModuleHeader.hs 56 - Right docOpt -> case parseParas $ tokenise str8 (0,0) of + Right docOpt -> case parseParas $ tokenise dflags str8 (0,0) of hunk ./src/Haddock/Lex.x 141 -type Action = AlexPosn -> String -> StartCode -> (StartCode -> [LToken]) -> [LToken] +type Action = AlexPosn -> String -> StartCode -> (StartCode -> [LToken]) -> DynFlags -> [LToken] hunk ./src/Haddock/Lex.x 143 -tokenise :: String -> (Int, Int) -> [LToken] -tokenise str (line, col) = let toks = go (posn, '\n', eofHack str) para in {-trace (show toks)-} toks +tokenise :: DynFlags -> String -> (Int, Int) -> [LToken] +tokenise dflags str (line, col) = let toks = go (posn, '\n', eofHack str) para in {-trace (show toks)-} toks hunk ./src/Haddock/Lex.x 153 - AlexToken inp'@(pos',_,_) len act -> act pos (take len str) sc (\sc -> go inp' sc) + AlexToken inp'@(pos',_,_) len act -> act pos (take len str) sc (\sc -> go inp' sc) dflags hunk ./src/Haddock/Lex.x 160 -andBegin act new_sc = \pos str _ cont -> act pos str new_sc cont +andBegin act new_sc = \pos str _ cont dflags -> act pos str new_sc cont dflags hunk ./src/Haddock/Lex.x 163 -token t = \pos _ sc cont -> (t, pos) : cont sc +token t = \pos _ sc cont _ -> (t, pos) : cont sc hunk ./src/Haddock/Lex.x 166 -strtoken t = \pos str sc cont -> (t str, pos) : cont sc -strtokenNL t = \pos str sc cont -> (t (filter (/= '\r') str), pos) : cont sc +strtoken t = \pos str sc cont _ -> (t str, pos) : cont sc +strtokenNL t = \pos str sc cont _ -> (t (filter (/= '\r') str), pos) : cont sc hunk ./src/Haddock/Lex.x 172 -begin sc = \_ _ _ cont -> cont sc +begin sc = \_ _ _ cont _ -> cont sc hunk ./src/Haddock/Lex.x 178 -ident pos str sc cont = - case strToHsQNames id of +ident pos str sc cont dflags = + case strToHsQNames dflags id of hunk ./src/Haddock/Lex.x 184 -strToHsQNames :: String -> Maybe [RdrName] -strToHsQNames str0 = +strToHsQNames :: DynFlags -> String -> Maybe [RdrName] +strToHsQNames dflags str0 = hunk ./src/Haddock/Lex.x 187 - pstate = mkPState buffer noSrcLoc defaultDynFlags + pstate = mkPState buffer noSrcLoc dflags hunk ./src/Haddock/Types.hs 159 - ghcInstances :: [Instance] + ghcInstances :: [Instance], + ghcDynFlags :: DynFlags hunk ./src/Main.hs 408 - case parseParas (tokenise str (0,0) {- TODO: real position -}) of + case parseParas (tokenise defaultDynFlags str (0,0) {- TODO: real position -}) of addfile ./tests/golden-tests/tests/Ticket112.hs hunk ./tests/golden-tests/tests/Ticket112.hs 1 +{-# LANGUAGE MagicHash #-} + +module Ticket112 where + +import GHC.Prim + +-- | ...given a raw 'Addr#' to the string, and the length of the string. +f :: a +f = undefined addfile ./tests/golden-tests/tests/Ticket112.html.ref hunk ./tests/golden-tests/tests/Ticket112.html.ref 1 + + +Ticket112
 ContentsIndex
Ticket112
Synopsis
f :: a
Documentation
f :: a
...given a raw Addr# to the string, and the length of the string. +
Produced by Haddock version 2.7.2
hunk ./tests/golden-tests/runtests.hs 17 -haddockPath = ".." "dist" "build" "haddock" "haddock" +haddockBase = ".." ".." +haddockPath = haddockBase "dist" "build" "haddock" "haddock" hunk ./tests/golden-tests/runtests.hs 43 - (Just [("haddock_datadir", "../.")]) Nothing Nothing Nothing + (Just [("haddock_datadir", haddockBase)]) Nothing Nothing Nothing hunk ./tests/golden-tests/runtests.hs 48 - (Just [("haddock_datadir", "../.")]) Nothing Nothing Nothing + (Just [("haddock_datadir", haddockBase)]) Nothing Nothing Nothing hunk ./tests/golden-tests/runtests.hs 68 - Nothing (Just [("haddock_datadir", "../.")]) Nothing + Nothing (Just [("haddock_datadir", haddockBase)]) Nothing hunk ./tests/golden-tests/runtests.hs 60 - let base = mkDep "base" "4.2.0.0" + let base = mkDep "base" "4.2.0.1" hunk ./src/Haddock/Types.hs 17 - hunk ./src/Haddock/Types.hs 35 + hunk ./src/Haddock/Types.hs 49 + hunk ./src/Haddock/Types.hs 53 + hunk ./src/Haddock/Types.hs 141 - hunk ./src/Haddock/Types.hs 261 + hunk ./src/Haddock/Types.hs 264 + + hunk ./src/Haddock/Types.hs 290 -data Example = Example { exampleExpression :: String - , exampleResult :: [String] - } - deriving (Eq, Show) + +data Example = Example + { exampleExpression :: String + , exampleResult :: [String] + } deriving (Eq, Show) + hunk ./src/Haddock/Types.hs 301 + hunk ./src/Haddock/Types.hs 366 -type ErrMsg = String hunk ./src/Haddock/Types.hs 367 +type ErrMsg = String hunk ./src/Haddock/Types.hs 370 + hunk ./src/Haddock/Types.hs 374 + hunk ./src/Haddock/Types.hs 382 + hunk ./src/Haddock/Types.hs 389 + hunk ./src/Haddock/Types.hs 402 + hunk ./src/Haddock/Types.hs 419 + + hunk ./src/Haddock/Types.hs 423 + + hunk ./src/Haddock/Types.hs 36 --- convenient short-hands +-- | Convenient short-hand hunk ./src/Haddock/Backends/Html.hs 12 - hunk ./src/Haddock/Backends/Xhtml.hs 13 - hunk ./src/Haddock/Backends/Xhtml/Decl.hs 13 - hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 13 - hunk ./src/Haddock/Backends/Xhtml/Layout.hs 13 - hunk ./src/Haddock/Backends/Xhtml/Names.hs 13 - hunk ./src/Haddock/Backends/Xhtml/Types.hs 13 - hunk ./src/Haddock/Backends/Xhtml/Util.hs 13 - hunk ./src/Haddock/Types.hs 35 - --- | Convenient short-hand -type Decl = LHsDecl Name - - --- | An instance head that may have documentation. -type DocInstance name = (InstHead name, Maybe (Doc name)) - - --- | Arguments and result are indexed by Int, zero-based from the left, --- because that's the easiest to use when recursing over types. -type FnArgsDoc name = Map Int (Doc name) -type DocForDecl name = (Maybe (Doc name), FnArgsDoc name) - - -noDocForDecl :: DocForDecl name -noDocForDecl = (Nothing, Map.empty) - - --- | A declaration that may have documentation, including its subordinates, --- which may also have documentation -type DeclInfo = (Decl, DocForDecl Name, [(Name, DocForDecl Name)]) - - --- | An extension of 'Name' that may contain the preferred place to link to in --- the documentation. -data DocName = Documented Name Module | Undocumented Name deriving Eq --- TODO: simplify to data DocName = DocName Name (Maybe Module) - - --- | The 'OccName' of this name. -docNameOcc :: DocName -> OccName -docNameOcc = nameOccName . getName - - -instance NamedThing DocName where - getName (Documented name _) = name - getName (Undocumented name) = name - - -{-! for DocOption derive: Binary !-} --- | Source-level options for controlling the documentation. -data DocOption - = OptHide -- ^ This module should not appear in the docs - | OptPrune - | OptIgnoreExports -- ^ Pretend everything is exported - | OptNotHome -- ^ Not the best place to get docs for things - -- exported by this module. - deriving (Eq, Show) - - -data ExportItem name - - = ExportDecl { - - -- | A declaration - expItemDecl :: LHsDecl name, - - -- | Maybe a doc comment, and possibly docs for arguments (if this - -- decl is a function or type-synonym) - expItemMbDoc :: DocForDecl name, - - -- | Subordinate names, possibly with documentation - expItemSubDocs :: [(name, DocForDecl name)], - - -- | Instances relevant to this declaration, possibly with documentation - expItemInstances :: [DocInstance name] - - } -- ^ An exported declaration - - | ExportNoDecl { - expItemName :: name, - - -- | Subordinate names - expItemSubs :: [name] - - } -- ^ An exported entity for which we have no - -- documentation (perhaps because it resides in - -- another package) - - | ExportGroup { - - -- | Section level (1, 2, 3, ... ) - expItemSectionLevel :: Int, - - -- | Section id (for hyperlinks) - expItemSectionId :: String, - - -- | Section heading text - expItemSectionText :: Doc name - - } -- ^ A section heading - - | ExportDoc (Doc name) -- ^ Some documentation - - | ExportModule Module -- ^ A cross-reference to another module - - --- | The head of an instance. Consists of a context, a class name and a list of --- instance types. -type InstHead name = ([HsPred name], name, [HsType name]) +----------------------------------------------------------------------------- +-- * Convenient synonyms +----------------------------------------------------------------------------- hunk ./src/Haddock/Types.hs 43 --- | An environment used to create hyper-linked syntax. -type LinkEnv = Map Name Module - - -type GhcDocHdr = Maybe LHsDocString +type Decl = LHsDecl Name +type GhcDocHdr = Maybe LHsDocString hunk ./src/Haddock/Types.hs 47 --- | This structure holds the module information we get from GHC's --- type checking phase -data GhcModule = GhcModule { - ghcModule :: Module, - ghcFilename :: FilePath, - ghcMbDocOpts :: Maybe String, - ghcMbDocHdr :: GhcDocHdr, - ghcGroup :: HsGroup Name, - ghcMbExports :: Maybe [LIE Name], - ghcExportedNames :: [Name], - ghcDefinedNames :: [Name], - ghcNamesInScope :: [Name], - ghcInstances :: [Instance], - ghcDynFlags :: DynFlags -} +----------------------------------------------------------------------------- +-- * Interface +----------------------------------------------------------------------------- hunk ./src/Haddock/Types.hs 149 -unrenameDoc :: Doc DocName -> Doc Name -unrenameDoc = fmap getName +----------------------------------------------------------------------------- +-- * Export items & declarations +----------------------------------------------------------------------------- + + +data ExportItem name + + = ExportDecl { + + -- | A declaration + expItemDecl :: LHsDecl name, + + -- | Maybe a doc comment, and possibly docs for arguments (if this + -- decl is a function or type-synonym) + expItemMbDoc :: DocForDecl name, + + -- | Subordinate names, possibly with documentation + expItemSubDocs :: [(name, DocForDecl name)], + + -- | Instances relevant to this declaration, possibly with documentation + expItemInstances :: [DocInstance name] + + } -- ^ An exported declaration + + | ExportNoDecl { + expItemName :: name, + + -- | Subordinate names + expItemSubs :: [name] + + } -- ^ An exported entity for which we have no + -- documentation (perhaps because it resides in + -- another package) + + | ExportGroup { + + -- | Section level (1, 2, 3, ... ) + expItemSectionLevel :: Int, + + -- | Section id (for hyperlinks) + expItemSectionId :: String, + + -- | Section heading text + expItemSectionText :: Doc name + + } -- ^ A section heading + + | ExportDoc (Doc name) -- ^ Some documentation + + | ExportModule Module -- ^ A cross-reference to another module + + +-- | A declaration that may have documentation, including its subordinates, +-- which may also have documentation +type DeclInfo = (Decl, DocForDecl Name, [(Name, DocForDecl Name)]) + + +-- | Arguments and result are indexed by Int, zero-based from the left, +-- because that's the easiest to use when recursing over types. +type FnArgsDoc name = Map Int (Doc name) +type DocForDecl name = (Maybe (Doc name), FnArgsDoc name) + + +noDocForDecl :: DocForDecl name +noDocForDecl = (Nothing, Map.empty) hunk ./src/Haddock/Types.hs 221 +----------------------------------------------------------------------------- +-- * Hyperlinking +----------------------------------------------------------------------------- + + +-- | An environment used to create hyper-linked syntax. +type LinkEnv = Map Name Module + + +-- | An extension of 'Name' that may contain the preferred place to link to in +-- the documentation. +data DocName = Documented Name Module | Undocumented Name deriving Eq +-- TODO: simplify to data DocName = DocName Name (Maybe Module) + + +-- | The 'OccName' of this name. +docNameOcc :: DocName -> OccName +docNameOcc = nameOccName . getName + + +instance NamedThing DocName where + getName (Documented name _) = name + getName (Undocumented name) = name + + +----------------------------------------------------------------------------- +-- * Instances +----------------------------------------------------------------------------- + + +-- | An instance head that may have documentation. +type DocInstance name = (InstHead name, Maybe (Doc name)) + + +-- | The head of an instance. Consists of a context, a class name and a list of +-- instance types. +type InstHead name = ([HsPred name], name, [HsType name]) + + +----------------------------------------------------------------------------- +-- * Documentation comments +----------------------------------------------------------------------------- + + +type LDoc id = Located (Doc id) + + hunk ./src/Haddock/Types.hs 288 +unrenameDoc :: Doc DocName -> Doc Name +unrenameDoc = fmap getName + + hunk ./src/Haddock/Types.hs 365 +----------------------------------------------------------------------------- +-- * Options +----------------------------------------------------------------------------- + + +{-! for DocOption derive: Binary !-} +-- | Source-level options for controlling the documentation. +data DocOption + = OptHide -- ^ This module should not appear in the docs + | OptPrune + | OptIgnoreExports -- ^ Pretend everything is exported + | OptNotHome -- ^ Not the best place to get docs for things + -- exported by this module. + deriving (Eq, Show) + + +----------------------------------------------------------------------------- +-- * Misc. +----------------------------------------------------------------------------- + + +-- TODO: remove? +-- | This structure holds the module information we get from GHC's +-- type checking phase +data GhcModule = GhcModule { + ghcModule :: Module, + ghcFilename :: FilePath, + ghcMbDocOpts :: Maybe String, + ghcMbDocHdr :: GhcDocHdr, + ghcGroup :: HsGroup Name, + ghcMbExports :: Maybe [LIE Name], + ghcExportedNames :: [Name], + ghcDefinedNames :: [Name], + ghcNamesInScope :: [Name], + ghcInstances :: [Instance], + ghcDynFlags :: DynFlags +} + + +----------------------------------------------------------------------------- +-- * Error handling +----------------------------------------------------------------------------- + + hunk ./src/Haddock/Types.hs 31 -#ifdef TEST -import Test.QuickCheck -#endif hunk ./src/Haddock/Types.hs 300 -#ifdef TEST --- TODO: use derive -instance Arbitrary a => Arbitrary (Doc a) where - arbitrary = - oneof [ return DocEmpty - , do { a <- arbitrary; b <- arbitrary; return (DocAppend a b) } - , fmap DocString arbitrary - , fmap DocParagraph arbitrary - , fmap DocIdentifier arbitrary - , fmap DocModule arbitrary - , fmap DocEmphasis arbitrary - , fmap DocMonospaced arbitrary - , fmap DocUnorderedList arbitrary - , fmap DocOrderedList arbitrary - , fmap DocDefList arbitrary - , fmap DocCodeBlock arbitrary - , fmap DocURL arbitrary - , fmap DocPic arbitrary - , fmap DocAName arbitrary ] -#endif - - -type LDoc id = Located (Doc id) - - hunk ./src/Haddock/Backends/DevHelp.hs 23 +import System.FilePath hunk ./src/Haddock/Backends/DevHelp.hs 41 - writeFile (pathJoin [odir, devHelpFile]) (render doc) + writeFile (joinPath [odir, devHelpFile]) (render doc) hunk ./src/Haddock/Backends/HH.hs 42 - writeFile (pathJoin [odir, contentsHHFile]) (render html) + writeFile (joinPath [odir, contentsHHFile]) (render html) hunk ./src/Haddock/Backends/HH.hs 105 - writeFile (pathJoin [odir, indexHHFile]) (render html) + writeFile (joinPath [odir, indexHHFile]) (render html) hunk ./src/Haddock/Backends/HH.hs 151 - writeFile (pathJoin [odir, projectHHFile]) (render doc) + writeFile (joinPath [odir, projectHHFile]) (render doc) hunk ./src/Haddock/Backends/HH.hs 176 - | otherwise = pathJoin [path, fname] + | otherwise = joinPath [path, fname] hunk ./src/Haddock/Backends/HH2.hs 46 - writeFile (pathJoin [odir, contentsHH2File]) (render doc) + writeFile (joinPath [odir, contentsHH2File]) (render doc) hunk ./src/Haddock/Backends/HH2.hs 98 - writeFile (pathJoin [odir, indexKHH2File]) (render docK) - writeFile (pathJoin [odir, indexNHH2File]) (render docN) + writeFile (joinPath [odir, indexKHH2File]) (render docK) + writeFile (joinPath [odir, indexNHH2File]) (render docN) hunk ./src/Haddock/Backends/HH2.hs 135 - writeFile (pathJoin [odir, filesHH2File]) (render doc) + writeFile (joinPath [odir, filesHH2File]) (render doc) hunk ./src/Haddock/Backends/HH2.hs 160 - | otherwise = pathJoin [path, fname] + | otherwise = joinPath [path, fname] hunk ./src/Haddock/Backends/HH2.hs 195 - writeFile (pathJoin [odir, collectionHH2File]) (render doc) + writeFile (joinPath [odir, collectionHH2File]) (render doc) hunk ./src/Haddock/Backends/Html.hs 40 +import System.FilePath hiding ( () ) hunk ./src/Haddock/Backends/Html.hs 142 - libhtmldir = pathJoin [libdir, "html"] + libhtmldir = joinPath [libdir, "html"] hunk ./src/Haddock/Backends/Html.hs 144 - Nothing -> pathJoin [libhtmldir, cssFile] + Nothing -> joinPath [libhtmldir, cssFile] hunk ./src/Haddock/Backends/Html.hs 146 - css_destination = pathJoin [odir, cssFile] + css_destination = joinPath [odir, cssFile] hunk ./src/Haddock/Backends/Html.hs 148 - copyFile (pathJoin [libhtmldir, f]) (pathJoin [odir, f]) + copyFile (joinPath [libhtmldir, f]) (joinPath [odir, f]) hunk ./src/Haddock/Backends/Html.hs 331 - writeFile (pathJoin [odir, contentsHtmlFile]) (renderHtml html) + writeFile (joinPath [odir, contentsHtmlFile]) (renderHtml html) hunk ./src/Haddock/Backends/Html.hs 449 - writeFile (pathJoin [odir, frameIndexHtmlFile]) (renderHtml html) + writeFile (joinPath [odir, frameIndexHtmlFile]) (renderHtml html) hunk ./src/Haddock/Backends/Html.hs 481 - writeFile (pathJoin [odir, indexHtmlFile]) (renderHtml html) + writeFile (joinPath [odir, indexHtmlFile]) (renderHtml html) hunk ./src/Haddock/Backends/Html.hs 532 - writeFile (pathJoin [odir, subIndexHtmlFile c]) (renderHtml html) + writeFile (joinPath [odir, subIndexHtmlFile c]) (renderHtml html) hunk ./src/Haddock/Backends/Html.hs 629 - writeFile (pathJoin [odir, moduleHtmlFile mdl]) (renderHtml html) + writeFile (joinPath [odir, moduleHtmlFile mdl]) (renderHtml html) hunk ./src/Haddock/Backends/Html.hs 646 - writeFile (pathJoin [odir, "mini_" ++ moduleHtmlFile mdl]) (renderHtml html) + writeFile (joinPath [odir, "mini_" ++ moduleHtmlFile mdl]) (renderHtml html) hunk ./src/Haddock/Backends/Xhtml.hs 47 +import System.FilePath hiding ( () ) hunk ./src/Haddock/Backends/Xhtml.hs 144 - libhtmldir = pathJoin [libdir, "html"] + libhtmldir = joinPath [libdir, "html"] hunk ./src/Haddock/Backends/Xhtml.hs 146 - Nothing -> pathJoin [libhtmldir, 'x':cssFile] + Nothing -> joinPath [libhtmldir, 'x':cssFile] hunk ./src/Haddock/Backends/Xhtml.hs 148 - css_destination = pathJoin [odir, cssFile] + css_destination = joinPath [odir, cssFile] hunk ./src/Haddock/Backends/Xhtml.hs 150 - copyFile (pathJoin [libhtmldir, f]) (pathJoin [odir, f]) + copyFile (joinPath [libhtmldir, f]) (joinPath [odir, f]) hunk ./src/Haddock/Backends/Xhtml.hs 280 - writeFile (pathJoin [odir, contentsHtmlFile]) (renderToString html) + writeFile (joinPath [odir, contentsHtmlFile]) (renderToString html) hunk ./src/Haddock/Backends/Xhtml.hs 396 - writeFile (pathJoin [odir, frameIndexHtmlFile]) (renderToString html) + writeFile (joinPath [odir, frameIndexHtmlFile]) (renderToString html) hunk ./src/Haddock/Backends/Xhtml.hs 428 - writeFile (pathJoin [odir, indexHtmlFile]) (renderToString html) + writeFile (joinPath [odir, indexHtmlFile]) (renderToString html) hunk ./src/Haddock/Backends/Xhtml.hs 484 - writeFile (pathJoin [odir, subIndexHtmlFile c]) (renderToString html) + writeFile (joinPath [odir, subIndexHtmlFile c]) (renderToString html) hunk ./src/Haddock/Backends/Xhtml.hs 582 - writeFile (pathJoin [odir, moduleHtmlFile mdl]) (renderToString html) + writeFile (joinPath [odir, moduleHtmlFile mdl]) (renderToString html) hunk ./src/Haddock/Backends/Xhtml.hs 599 - writeFile (pathJoin [odir, "mini_" ++ moduleHtmlFile mdl]) (renderToString html) + writeFile (joinPath [odir, "mini_" ++ moduleHtmlFile mdl]) (renderToString html) hunk ./src/Haddock/Utils.hs 24 - subIndexHtmlFile, pathJoin, + subIndexHtmlFile, hunk ./src/Haddock/Utils.hs 175 - Just fp0 -> pathJoin [fp0, mdl' ++ ".html"] + Just fp0 -> joinPath [fp0, mdl' ++ ".html"] hunk ./src/Haddock/Utils.hs 214 -pathJoin :: [FilePath] -> FilePath -pathJoin = foldr join [] - where join :: FilePath -> FilePath -> FilePath - join path1 "" = path1 - join "" path2 = path2 - join path1 path2 - | isPathSeparator (last path1) = path1++path2 - | otherwise = path1++pathSeparator:path2 - - hunk ./src/Haddock/Options.hs 18 + optTitle, + outputDir, + optContentsUrl, + optIndexUrl, + optHtmlHelpFormat, + optCssFile, + optSourceUrls, + optWikiUrls, hunk ./src/Haddock/Options.hs 31 +import Data.Maybe hunk ./src/Haddock/Options.hs 55 +optTitle :: [Flag] -> Maybe String +optTitle flags = + case [str | Flag_Heading str <- flags] of + [] -> Nothing + (t:_) -> Just t + + +outputDir :: [Flag] -> FilePath +outputDir flags = + case [ path | Flag_OutputDir path <- flags ] of + [] -> "." + paths -> last paths + + +optContentsUrl :: [Flag] -> Maybe String +optContentsUrl flags = optLast [ url | Flag_UseContents url <- flags ] + + +optIndexUrl :: [Flag] -> Maybe String +optIndexUrl flags = optLast [ url | Flag_UseIndex url <- flags ] + + +optHtmlHelpFormat :: [Flag] -> Maybe String +optHtmlHelpFormat flags = optLast [ hhformat | Flag_HtmlHelp hhformat <- flags ] + + +optCssFile :: [Flag] -> Maybe FilePath +optCssFile flags = optLast [ str | Flag_CSS str <- flags ] + + +optSourceUrls :: [Flag] -> (Maybe String, Maybe String, Maybe String) +optSourceUrls flags = + (listToMaybe [str | Flag_SourceBaseURL str <- flags] + ,listToMaybe [str | Flag_SourceModuleURL str <- flags] + ,listToMaybe [str | Flag_SourceEntityURL str <- flags]) + + +optWikiUrls :: [Flag] -> (Maybe String, Maybe String, Maybe String) +optWikiUrls flags = + (listToMaybe [str | Flag_WikiBaseURL str <- flags] + ,listToMaybe [str | Flag_WikiModuleURL str <- flags] + ,listToMaybe [str | Flag_WikiEntityURL str <- flags]) + + hunk ./src/Haddock/Options.hs 225 + + +-- | Like 'listToMaybe' but returns the last element instead of the first. +optLast :: [a] -> Maybe a +optLast [] = Nothing +optLast xs = Just (last xs) + hunk ./src/Main.hs 7 --- David Waern 2006-2009 +-- David Waern 2006-2010 hunk ./src/Main.hs 170 - let - title = case [str | Flag_Heading str <- flags] of - [] -> "" - (t:_) -> t - - maybe_source_urls = (listToMaybe [str | Flag_SourceBaseURL str <- flags] - ,listToMaybe [str | Flag_SourceModuleURL str <- flags] - ,listToMaybe [str | Flag_SourceEntityURL str <- flags]) - - maybe_wiki_urls = (listToMaybe [str | Flag_WikiBaseURL str <- flags] - ,listToMaybe [str | Flag_WikiModuleURL str <- flags] - ,listToMaybe [str | Flag_WikiEntityURL str <- flags]) - - libDir <- getHaddockLibDir flags - let unicode = Flag_UseUnicode `elem` flags - let css_file = case [str | Flag_CSS str <- flags] of - [] -> Nothing - fs -> Just (last fs) - - odir <- case [str | Flag_OutputDir str <- flags] of - [] -> return "." - fs -> return (last fs) hunk ./src/Main.hs 172 - maybe_contents_url = - case [url | Flag_UseContents url <- flags] of - [] -> Nothing - us -> Just (last us) - - maybe_index_url = - case [url | Flag_UseIndex url <- flags] of - [] -> Nothing - us -> Just (last us) + title = case optTitle flags of Nothing -> ""; Just t -> t + unicode = Flag_UseUnicode `elem` flags + opt_source_urls = optSourceUrls flags + opt_wiki_urls = optWikiUrls flags + opt_contents_url = optContentsUrl flags + opt_index_url = optIndexUrl flags + opt_html_help_format = optHtmlHelpFormat flags + css_file = optCssFile flags + odir = outputDir flags hunk ./src/Main.hs 182 - maybe_html_help_format = - case [hhformat | Flag_HtmlHelp hhformat <- flags] of - [] -> Nothing - formats -> Just (last formats) - - prologue <- getPrologue flags - - let hunk ./src/Main.hs 199 + + libDir <- getHaddockLibDir flags + prologue <- getPrologue flags hunk ./src/Main.hs 204 - ppHtmlIndex odir title packageStr maybe_html_help_format - maybe_contents_url maybe_source_urls maybe_wiki_urls + ppHtmlIndex odir title packageStr opt_html_help_format + opt_contents_url opt_source_urls opt_wiki_urls hunk ./src/Main.hs 210 - ppHtmlHelpFiles title packageStr visibleIfaces odir maybe_html_help_format [] + ppHtmlHelpFiles title packageStr visibleIfaces odir opt_html_help_format [] hunk ./src/Main.hs 213 - ppHtmlContents odir title packageStr maybe_html_help_format - maybe_index_url maybe_source_urls maybe_wiki_urls + ppHtmlContents odir title packageStr opt_html_help_format + opt_index_url opt_source_urls opt_wiki_urls hunk ./src/Main.hs 220 - prologue maybe_html_help_format - maybe_source_urls maybe_wiki_urls - maybe_contents_url maybe_index_url unicode + prologue opt_html_help_format + opt_source_urls opt_wiki_urls + opt_contents_url opt_index_url unicode hunk ./src/Haddock/Options.hs 37 -getUsage :: IO String -getUsage = do - prog <- getProgramName - return $ usageInfo (usageHeader prog) (options False) - where - usageHeader :: String -> String - usageHeader prog = "Usage: " ++ prog ++ " [OPTION...] file...\n" - - -parseHaddockOpts :: [String] -> IO ([Flag], [String]) -parseHaddockOpts params = - case getOpt Permute (options True) params of - (flags, args, []) -> return (flags, args) - (_, _, errors) -> do - usage <- getUsage - throwE (concat errors ++ usage) - - -optTitle :: [Flag] -> Maybe String -optTitle flags = - case [str | Flag_Heading str <- flags] of - [] -> Nothing - (t:_) -> Just t - - -outputDir :: [Flag] -> FilePath -outputDir flags = - case [ path | Flag_OutputDir path <- flags ] of - [] -> "." - paths -> last paths - - -optContentsUrl :: [Flag] -> Maybe String -optContentsUrl flags = optLast [ url | Flag_UseContents url <- flags ] - - -optIndexUrl :: [Flag] -> Maybe String -optIndexUrl flags = optLast [ url | Flag_UseIndex url <- flags ] - - -optHtmlHelpFormat :: [Flag] -> Maybe String -optHtmlHelpFormat flags = optLast [ hhformat | Flag_HtmlHelp hhformat <- flags ] - - -optCssFile :: [Flag] -> Maybe FilePath -optCssFile flags = optLast [ str | Flag_CSS str <- flags ] - - -optSourceUrls :: [Flag] -> (Maybe String, Maybe String, Maybe String) -optSourceUrls flags = - (listToMaybe [str | Flag_SourceBaseURL str <- flags] - ,listToMaybe [str | Flag_SourceModuleURL str <- flags] - ,listToMaybe [str | Flag_SourceEntityURL str <- flags]) - - -optWikiUrls :: [Flag] -> (Maybe String, Maybe String, Maybe String) -optWikiUrls flags = - (listToMaybe [str | Flag_WikiBaseURL str <- flags] - ,listToMaybe [str | Flag_WikiModuleURL str <- flags] - ,listToMaybe [str | Flag_WikiEntityURL str <- flags]) - - -ghcFlags :: [Flag] -> [String] -ghcFlags flags = [ option | Flag_OptGhc option <- flags ] - - -ifacePairs :: [Flag] -> [(FilePath, FilePath)] -ifacePairs flags = [ parseIfaceOption s | Flag_ReadInterface s <- flags ] - - -parseIfaceOption :: String -> (FilePath, FilePath) -parseIfaceOption s = - case break (==',') s of - (fpath,',':file) -> (fpath, file) - (file, _) -> ("", file) - - hunk ./src/Haddock/Options.hs 150 +getUsage :: IO String +getUsage = do + prog <- getProgramName + return $ usageInfo (usageHeader prog) (options False) + where + usageHeader :: String -> String + usageHeader prog = "Usage: " ++ prog ++ " [OPTION...] file...\n" + + +parseHaddockOpts :: [String] -> IO ([Flag], [String]) +parseHaddockOpts params = + case getOpt Permute (options True) params of + (flags, args, []) -> return (flags, args) + (_, _, errors) -> do + usage <- getUsage + throwE (concat errors ++ usage) + + +optTitle :: [Flag] -> Maybe String +optTitle flags = + case [str | Flag_Heading str <- flags] of + [] -> Nothing + (t:_) -> Just t + + +outputDir :: [Flag] -> FilePath +outputDir flags = + case [ path | Flag_OutputDir path <- flags ] of + [] -> "." + paths -> last paths + + +optContentsUrl :: [Flag] -> Maybe String +optContentsUrl flags = optLast [ url | Flag_UseContents url <- flags ] + + +optIndexUrl :: [Flag] -> Maybe String +optIndexUrl flags = optLast [ url | Flag_UseIndex url <- flags ] + + +optHtmlHelpFormat :: [Flag] -> Maybe String +optHtmlHelpFormat flags = optLast [ hhformat | Flag_HtmlHelp hhformat <- flags ] + + +optCssFile :: [Flag] -> Maybe FilePath +optCssFile flags = optLast [ str | Flag_CSS str <- flags ] + + +optSourceUrls :: [Flag] -> (Maybe String, Maybe String, Maybe String) +optSourceUrls flags = + (listToMaybe [str | Flag_SourceBaseURL str <- flags] + ,listToMaybe [str | Flag_SourceModuleURL str <- flags] + ,listToMaybe [str | Flag_SourceEntityURL str <- flags]) + + +optWikiUrls :: [Flag] -> (Maybe String, Maybe String, Maybe String) +optWikiUrls flags = + (listToMaybe [str | Flag_WikiBaseURL str <- flags] + ,listToMaybe [str | Flag_WikiModuleURL str <- flags] + ,listToMaybe [str | Flag_WikiEntityURL str <- flags]) + + +ghcFlags :: [Flag] -> [String] +ghcFlags flags = [ option | Flag_OptGhc option <- flags ] + + +ifacePairs :: [Flag] -> [(FilePath, FilePath)] +ifacePairs flags = [ parseIfaceOption s | Flag_ReadInterface s <- flags ] + + +parseIfaceOption :: String -> (FilePath, FilePath) +parseIfaceOption s = + case break (==',') s of + (fpath,',':file) -> (fpath, file) + (file, _) -> ("", file) + + hunk ./src/Haddock/Options.hs 34 -import System.Console.GetOpt +import System.Console.GetOpt hunk ./src/Haddock/Options.hs 79 - Option ['B'] [] (ReqArg Flag_GhcLibDir "DIR") - "path to a GHC lib dir, to override the default path", - Option ['o'] ["odir"] (ReqArg Flag_OutputDir "DIR") - "directory in which to put the output files", - Option ['l'] ["lib"] (ReqArg Flag_Lib "DIR") - "location of Haddock's auxiliary files", - Option ['i'] ["read-interface"] (ReqArg Flag_ReadInterface "FILE") - "read an interface from FILE", - Option ['D'] ["dump-interface"] (ReqArg Flag_DumpInterface "FILE") - "interface file name", + Option ['B'] [] (ReqArg Flag_GhcLibDir "DIR") + "path to a GHC lib dir, to override the default path", + Option ['o'] ["odir"] (ReqArg Flag_OutputDir "DIR") + "directory in which to put the output files", + Option ['l'] ["lib"] (ReqArg Flag_Lib "DIR") + "location of Haddock's auxiliary files", + Option ['i'] ["read-interface"] (ReqArg Flag_ReadInterface "FILE") + "read an interface from FILE", + Option ['D'] ["dump-interface"] (ReqArg Flag_DumpInterface "FILE") + "interface file name", hunk ./src/Haddock/Options.hs 90 --- "output in DocBook XML", +-- "output in DocBook XML", hunk ./src/Haddock/Options.hs 92 - "output in HTML", - Option [] ["xhtml"] (NoArg Flag_Xhtml) "use experimental XHTML rendering", + "output in HTML", + Option [] ["xhtml"] (NoArg Flag_Xhtml) "use experimental XHTML rendering", hunk ./src/Haddock/Options.hs 96 - "output for Hoogle", + "output for Hoogle", hunk ./src/Haddock/Options.hs 98 - "produce index and table of contents in\nmshelp, mshelp2 or devhelp format (with -h)", - Option [] ["source-base"] (ReqArg Flag_SourceBaseURL "URL") - "URL for a source code link on the contents\nand index pages", + "produce index and table of contents in\nmshelp, mshelp2 or devhelp format (with -h)", + Option [] ["source-base"] (ReqArg Flag_SourceBaseURL "URL") + "URL for a source code link on the contents\nand index pages", hunk ./src/Haddock/Options.hs 102 - (ReqArg Flag_SourceModuleURL "URL") - "URL for a source code link for each module\n(using the %{FILE} or %{MODULE} vars)", - Option [] ["source-entity"] (ReqArg Flag_SourceEntityURL "URL") - "URL for a source code link for each entity\n(using the %{FILE}, %{MODULE}, %{NAME},\n%{KIND} or %{LINE} vars)", + (ReqArg Flag_SourceModuleURL "URL") + "URL for a source code link for each module\n(using the %{FILE} or %{MODULE} vars)", + Option [] ["source-entity"] (ReqArg Flag_SourceEntityURL "URL") + "URL for a source code link for each entity\n(using the %{FILE}, %{MODULE}, %{NAME},\n%{KIND} or %{LINE} vars)", hunk ./src/Haddock/Options.hs 107 - "URL for a comments link on the contents\nand index pages", - Option [] ["comments-module"] (ReqArg Flag_WikiModuleURL "URL") - "URL for a comments link for each module\n(using the %{MODULE} var)", - Option [] ["comments-entity"] (ReqArg Flag_WikiEntityURL "URL") - "URL for a comments link for each entity\n(using the %{FILE}, %{MODULE}, %{NAME},\n%{KIND} or %{LINE} vars)", - Option ['c'] ["css"] (ReqArg Flag_CSS "FILE") - "the CSS file to use for HTML output", + "URL for a comments link on the contents\nand index pages", + Option [] ["comments-module"] (ReqArg Flag_WikiModuleURL "URL") + "URL for a comments link for each module\n(using the %{MODULE} var)", + Option [] ["comments-entity"] (ReqArg Flag_WikiEntityURL "URL") + "URL for a comments link for each entity\n(using the %{FILE}, %{MODULE}, %{NAME},\n%{KIND} or %{LINE} vars)", + Option ['c'] ["css"] (ReqArg Flag_CSS "FILE") + "the CSS file to use for HTML output", hunk ./src/Haddock/Options.hs 115 - "file containing prologue text", + "file containing prologue text", hunk ./src/Haddock/Options.hs 117 - "page heading", + "page heading", hunk ./src/Haddock/Options.hs 119 - "extra debugging output", + "extra debugging output", hunk ./src/Haddock/Options.hs 121 - "display this help and exit", + "display this help and exit", hunk ./src/Haddock/Options.hs 123 - "output version information and exit", + "output version information and exit", hunk ./src/Haddock/Options.hs 125 - "set verbosity level", + "set verbosity level", hunk ./src/Haddock/Options.hs 127 - "use a separately-generated HTML contents page", + "use a separately-generated HTML contents page", hunk ./src/Haddock/Options.hs 129 - "generate an HTML contents from specified\ninterfaces", + "generate an HTML contents from specified\ninterfaces", hunk ./src/Haddock/Options.hs 131 - "use a separately-generated HTML index", + "use a separately-generated HTML index", hunk ./src/Haddock/Options.hs 133 - "generate an HTML index from specified\ninterfaces", + "generate an HTML index from specified\ninterfaces", hunk ./src/Haddock/Options.hs 135 - "behave as if all modules have the\nignore-exports atribute", + "behave as if all modules have the\nignore-exports atribute", hunk ./src/Haddock/Options.hs 137 - "behave as if MODULE has the hide attribute", + "behave as if MODULE has the hide attribute", hunk ./src/Haddock/Options.hs 139 - "option to be forwarded to GHC", + "option to be forwarded to GHC", hunk ./src/Haddock/Options.hs 141 - "output GHC version in numeric format", + "output GHC version in numeric format", hunk ./src/Haddock/Options.hs 143 - "output GHC lib dir", + "output GHC lib dir", hunk ./src/Haddock/Options.hs 146 - "don't re-direct compilation output to a temporary directory" - ] + "don't re-direct compilation output to a temporary directory" + ] hunk ./src/Haddock/Options.hs 163 - (_, _, errors) -> do + (_, _, errors) -> do hunk ./src/Haddock/Options.hs 168 -optTitle :: [Flag] -> Maybe String +optTitle :: [Flag] -> Maybe String hunk ./src/Haddock/Options.hs 176 -outputDir flags = +outputDir flags = hunk ./src/Haddock/Options.hs 221 -parseIfaceOption s = +parseIfaceOption s = hunk ./src/Haddock/Options.hs 223 - (fpath,',':file) -> (fpath, file) - (file, _) -> ("", file) + (fpath,',':file) -> (fpath, file) + (file, _) -> ("", file) hunk ./src/Main.hs 194 - ppHtmlIndex = pick Html.ppHtmlIndex Xhtml.ppHtmlIndex - ppHtmlHelpFiles = pick Html.ppHtmlHelpFiles Xhtml.ppHtmlHelpFiles - ppHtmlContents = pick Html.ppHtmlContents Xhtml.ppHtmlContents - ppHtml = pick Html.ppHtml Xhtml.ppHtml - copyHtmlBits = pick Html.copyHtmlBits Xhtml.copyHtmlBits - + ppHtmlIndex = pick Html.ppHtmlIndex Xhtml.ppHtmlIndex + ppHtmlHelpFiles = pick Html.ppHtmlHelpFiles Xhtml.ppHtmlHelpFiles + ppHtmlContents = pick Html.ppHtmlContents Xhtml.ppHtmlContents + ppHtml = pick Html.ppHtml Xhtml.ppHtml + copyHtmlBits = pick Html.copyHtmlBits Xhtml.copyHtmlBits + hunk ./src/Haddock/Interface.hs 39 -import Haddock.Options +import Haddock.Options hiding (verbosity) hunk ./src/Haddock/Options.hs 26 + optDumpInterfaceFile, + verbosity, hunk ./src/Haddock/Options.hs 34 +import Distribution.Verbosity hunk ./src/Haddock/Options.hs 215 +optDumpInterfaceFile :: [Flag] -> Maybe FilePath +optDumpInterfaceFile flags = optLast [ str | Flag_DumpInterface str <- flags ] + + +verbosity :: [Flag] -> Verbosity +verbosity flags = + case [ str | Flag_Verbosity str <- flags ] of + [] -> normal + x:_ -> case parseVerbosity x of + Left e -> throwE e + Right v -> v + + hunk ./src/Haddock/Options.hs 234 - - -parseIfaceOption :: String -> (FilePath, FilePath) -parseIfaceOption s = - case break (==',') s of - (fpath,',':file) -> (fpath, file) - (file, _) -> ("", file) + where + parseIfaceOption :: String -> (FilePath, FilePath) + parseIfaceOption str = + case break (==',') str of + (fpath, ',':file) -> (fpath, file) + (file, _) -> ("", file) hunk ./src/Main.hs 42 -import Distribution.Verbosity hunk ./src/Main.hs 124 - verbosity <- getVerbosity flags hunk ./src/Main.hs 148 - (interfaces, homeLinks) <- createInterfaces verbosity fileArgs flags - (map fst packages) + (ifaces, homeLinks) <- createInterfaces (verbosity flags) fileArgs flags + (map fst packages) hunk ./src/Main.hs 152 - renderStep packages interfaces + renderStep packages ifaces hunk ./src/Main.hs 154 - -- Last but not least, dump the interface file. - dumpInterfaceFile (map toInstalledIface interfaces) homeLinks flags + -- Dump an "interface file" (.haddock file), if requested. + case optDumpInterfaceFile flags of + Just f -> dumpInterfaceFile f (map toInstalledIface ifaces) homeLinks + Nothing -> return () hunk ./src/Main.hs 255 -dumpInterfaceFile :: [InstalledInterface] -> LinkEnv -> [Flag] -> IO () -dumpInterfaceFile ifaces homeLinks flags = - case [str | Flag_DumpInterface str <- flags] of - [] -> return () - fs -> let filename = last fs in writeInterfaceFile filename ifaceFile +dumpInterfaceFile :: FilePath -> [InstalledInterface] -> LinkEnv -> IO () +dumpInterfaceFile path ifaces homeLinks = writeInterfaceFile path ifaceFile hunk ./src/Main.hs 330 -getVerbosity :: Monad m => [Flag] -> m Verbosity -getVerbosity flags = - case [ str | Flag_Verbosity str <- flags ] of - [] -> return normal - x:_ -> case parseVerbosity x of - Left e -> throwE e - Right v -> return v - - hunk ./src/Main.hs 125 - let renderStep packages interfaces = do - updateHTMLXRefs packages - let ifaceFiles = map fst packages - installedIfaces = concatMap ifInstalledIfaces ifaceFiles - render flags interfaces installedIfaces - hunk ./src/Main.hs 127 - hunk ./src/Main.hs 145 - renderStep packages ifaces + renderStep flags packages ifaces hunk ./src/Main.hs 157 - renderStep packages [] + renderStep flags packages [] + + +renderStep :: [Flag] -> [(InterfaceFile, FilePath)] -> [Interface] -> IO () +renderStep flags packages interfaces = do + updateHTMLXRefs packages + let ifaceFiles = map fst packages + installedIfaces = concatMap ifInstalledIfaces ifaceFiles + render flags interfaces installedIfaces hunk ./src/Main.hs 193 - -- which HTML redering to use + -- which HTML rendering to use hunk ./src/Main.hs 185 - -- *all* visible interfaces including external package modules + -- *All* visible interfaces including external package modules. hunk ./src/Main.hs 193 - -- which HTML rendering to use + -- Which HTML rendering to use. hunk ./src/Haddock/Options.hs 91 - "interface file name", + "write the resulting interface to FILE", hunk ./src/Haddock/Options.hs 149 - "don't re-direct compilation output to a temporary directory" + "do not re-direct compilation output to a temporary directory" hunk ./src/Main.hs 173 - title = case optTitle flags of Nothing -> ""; Just t -> t + title = fromMaybe "" (optTitle flags) hunk ./src/Main.hs 194 - pick htmlF xhtmlF = if (Flag_Xhtml `elem` flags) then xhtmlF else htmlF + pick htmlF xhtmlF = if Flag_Xhtml `elem` flags then xhtmlF else htmlF hunk ./src/Main.hs 185 - -- *All* visible interfaces including external package modules. + -- /All/ visible interfaces including external package modules. hunk ./src/Haddock/Backends/Xhtml/Decl.hs 747 -ppBang HsStrict = toHtml "!" -ppBang HsUnbox = toHtml "!" -- unboxed args is an implementation detail, +ppBang _ = toHtml "!" -- Unpacked args is an implementation detail, hunk ./src/Main.hs 371 - Nothing -> throwE "parsing haddock prologue failed" + Nothing -> throwE $ "failed to parse haddock prologue from file: " ++ filename hunk ./src/Haddock/Utils.hs 77 -#else /* Must be Win32 */ -import Foreign -import Foreign.C.String hunk ./src/Haddock/Lex.x 187 - pstate = mkPState buffer noSrcLoc dflags + pstate = mkPState dflags buffer noSrcLoc hunk ./src/Main.hs 370 - case parseParas (tokenise defaultDynFlags str (0,0) {- TODO: real position -}) of + case parseParas (tokenise (flattenLanguageFlags defaultDynFlags) str (0,0) {- TODO: real position -}) of hunk ./src/Main.hs 370 - case parseParas (tokenise (flattenLanguageFlags defaultDynFlags) str (0,0) {- TODO: real position -}) of + case parseParas (tokenise (flattenExtensionFlags defaultDynFlags) str (0,0) {- TODO: real position -}) of hunk ./src/Haddock/Interface/Create.hs 563 - isLocalAndTypeInferenced <- liftGhcToErrMsgGhc $ - isLoaded (moduleName (nameModule t)) + isLocalAndTypeInferenced <- liftGhcToErrMsgGhc $ do + let mdl = nameModule t + if modulePackageId mdl == thisPackage dflags + then isLoaded (moduleName mdl) + else return False + hunk ./src/Haddock/Interface/Rn.hs 45 - [] -> return (DocString (ids2string ids)) + [] -> return (DocMonospaced (DocString (ids2string ids))) hunk ./doc/haddock.xml 13 -
simonmar@microsoft.com
+
marlowsd@gmail.com
+ + David + Waern + +
david.waern@gmail.com
hunk ./doc/haddock.xml 20 - 2004 - Simon Marlow + 2010 + Simon Marlow, David Waern hunk ./doc/haddock.xml 101 - and printed, for example. Haddock comes with HTML, DocBook + and printed, for example. Haddock comes with HTML, LaTeX, hunk ./doc/haddock.xml 653 - Specify a stylesheet to use instead of the default one + Specify a CSS stylesheet to use instead of the default one hunk ./doc/haddock.xml 659 + + + + + + + Generate documentation in LaTeX format. Several files + will be generated into the current directory (or the + specified directory if the option is + given), including the following: + + + + package.tex + + The top-level LaTeX source file; to format the + documentation into PDF you might run something like + this: + +$ pdflatex package.tex + + + + haddock.sty + + The default style. The file contains + definitions for various macros used in the LaTeX + sources generated by Haddock; to change the way the + formatted output looks, you might want to override + these by specifying your own style with + the option. + + + + module.tex + + The LaTeX documentation for + each module. + + + + + + + + + + + + + This option lets you override the default style used + by the LaTeX generated by the option. + Normally Haddock puts a + standard haddock.sty in the output + directory, and includes the + command \usepackage{haddock} in the + LaTeX source. If this option is given, + then haddock.sty is not generated, + and the command is + instead \usepackage{style}. + + + + hunk ./ghc.mk 12 -$(INPLACE_BIN)/$(utils/haddock_dist_PROG): $(INPLACE_LIB)/html +$(INPLACE_BIN)/$(utils/haddock_dist_PROG): $(INPLACE_LIB)/html $(INPLACE_LIB)/latex hunk ./ghc.mk 18 +$(INPLACE_LIB)/latex: + "$(RM)" $(RM_OPTS_REC) $@ + "$(CP)" -R utils/haddock/latex $@ + hunk ./haddock.cabal 60 + latex/haddock.sty hunk ./haddock.cabal 121 + Haddock.Backends.LaTeX adddir ./latex addfile ./latex/haddock.sty hunk ./latex/haddock.sty 1 +% Default Haddock style definitions. To use your own style, invoke +% Haddock with the option --latex-style=mystyle. + +\usepackage{tabulary} % see below + +% make hyperlinks in the PDF, and add an expandabale index +\usepackage[pdftex,bookmarks=true]{hyperref} + +\newenvironment{haddocktitle} + {\begin{center}\bgroup\large\bfseries} + {\egroup\end{center}} +\newenvironment{haddockprologue}{\vspace{1in}}{} + +\newcommand{\haddockmoduleheading}[1]{\chapter{\texttt{#1}}} + +\newcommand{\haddockbeginheader}{\hrulefill} +\newcommand{\haddockendheader}{\noindent\hrulefill} + +% a little gap before the ``Methods'' header +\newcommand{\haddockpremethods}{\vspace{2ex}} + +% inserted before \\begin{verbatim} +\newcommand{\haddockverb}{\small} + +% an identifier: add an index entry +\newcommand{\haddockid}[1]{\haddocktt{#1}\index{#1@\texttt{#1}}} + +% The tabulary environment lets us have a column that takes up ``the +% rest of the space''. Unfortunately it doesn't allow +% the \end{tabulary} to be in the expansion of a macro, it must appear +% literally in the document text, so Haddock inserts +% the \end{tabulary} itself. +\newcommand{\haddockbeginconstrs}{\begin{tabulary}{\linewidth}{@{}llJ@{}}} +\newcommand{\haddockbeginargs}{\begin{tabulary}{\linewidth}{@{}llJ@{}}} + +\newcommand{\haddocktt}[1]{{\small \texttt{#1}}} +\newcommand{\haddockdecltt}[1]{{\small\bfseries \texttt{#1}}} + +\makeatletter +\newenvironment{haddockdesc} + {\list{}{\labelwidth\z@ \itemindent-\leftmargin + \let\makelabel\haddocklabel}} + {\endlist} +\newcommand*\haddocklabel[1]{\hspace\labelsep\haddockdecltt{#1}} +\makeatother + +% after a declaration, start a new line for the documentation. +% Otherwise, the documentation starts right after the declaration, +% because we're using the list environment and the declaration is the +% ``label''. I tried making this newline part of the label, but +% couldn't get that to work reliably (the space seemed to stretch +% sometimes). +\newcommand{\haddockbegindoc}{\hfill\\[1ex]} + +% spacing between paragraphs and no \parindent looks better +\parskip=10pt plus2pt minus2pt +\setlength{\parindent}{0cm} addfile ./src/Haddock/Backends/LaTeX.hs hunk ./src/Haddock/Backends/LaTeX.hs 1 +{-# OPTIONS_GHC -fno-warn-name-shadowing #-} +----------------------------------------------------------------------------- +-- | +-- Module : Haddock.Backends.LaTeX +-- Copyright : (c) Simon Marlow 2010 +-- License : BSD-like +-- +-- Maintainer : haddock@projects.haskell.org +-- Stability : experimental +-- Portability : portable +----------------------------------------------------------------------------- + +module Haddock.Backends.LaTeX ( + ppLaTeX +) where + +import Haddock.Types +import Haddock.Utils +import Haddock.GhcUtils +import Pretty hiding (Doc) +import qualified Pretty + +import GHC +import OccName +import Name ( isTyConName, nameOccName ) +import RdrName ( rdrNameOcc, isRdrTc ) +import BasicTypes ( IPName(..), Boxity(..) ) +import Outputable ( Outputable, ppr, showSDoc ) +import FastString ( unpackFS, unpackLitString ) + +import qualified Data.Map as Map +import System.Directory +import System.FilePath +import Data.Char +import Control.Monad +import Data.Maybe +import Data.List +-- import Debug.Trace + +{- SAMPLE OUTPUT + +\haddockmoduleheading{\texttt{Data.List}} +\hrulefill +{\haddockverb\begin{verbatim} +module Data.List ( + (++), head, last, tail, init, null, length, map, reverse, + ) where\end{verbatim}} +\hrulefill + +\section{Basic functions} +\begin{haddockdesc} +\item[\begin{tabular}{@{}l} +head\ ::\ {\char 91}a{\char 93}\ ->\ a +\end{tabular}]\haddockbegindoc +Extract the first element of a list, which must be non-empty. +\par + +\end{haddockdesc} +\begin{haddockdesc} +\item[\begin{tabular}{@{}l} +last\ ::\ {\char 91}a{\char 93}\ ->\ a +\end{tabular}]\haddockbegindoc +Extract the last element of a list, which must be finite and non-empty. +\par + +\end{haddockdesc} +-} + + +{- TODO + * don't forget fixity!! +-} + +ppLaTeX :: String -- Title + -> Maybe String -- Package name + -> [Interface] + -> FilePath -- destination directory + -> Maybe (Doc GHC.RdrName) -- prologue text, maybe + -> Maybe String -- style file + -> FilePath + -> IO () + +ppLaTeX title packageStr visible_ifaces odir prologue maybe_style libdir + = do + createDirectoryIfMissing True odir + when (isNothing maybe_style) $ + copyFile (libdir "latex" haddockSty) (odir haddockSty) + ppLaTeXTop title packageStr odir prologue maybe_style visible_ifaces + mapM_ (ppLaTeXModule title odir) visible_ifaces + +haddockSty = "haddock.sty" + +type LaTeX = Pretty.Doc + +ppLaTeXTop + :: String + -> Maybe String + -> FilePath + -> Maybe (Doc GHC.RdrName) + -> Maybe String + -> [Interface] + -> IO () + +ppLaTeXTop doctitle packageStr odir prologue maybe_style ifaces = do + + let tex = vcat [ + text "\\documentclass{book}", + text "\\usepackage" <> braces (maybe (text "haddock") text maybe_style), + text "\\begin{document}", + text "\\begin{titlepage}", + text "\\begin{haddocktitle}", + text doctitle, + text "\\end{haddocktitle}", + case prologue of + Nothing -> empty + Just d -> vcat [text "\\begin{haddockprologue}", + rdrDocToLaTeX d, + text "\\end{haddockprologue}"], + text "\\end{titlepage}", + text "\\tableofcontents", + vcat [ text "\\input" <> braces (text mdl) | mdl <- mods ], + text "\\end{document}" + ] + + mods = sort (map (moduleBasename.ifaceMod) ifaces) + + filename = odir (fromMaybe "haddock" packageStr <.> "tex") + + writeFile filename (render tex) + +ppLaTeXModule :: String -> FilePath -> Interface -> IO () +ppLaTeXModule _title odir iface = do + createDirectoryIfMissing True odir + let + mdl = ifaceMod iface + mdl_str = moduleString mdl + + exports = ifaceRnExportItems iface + + tex = vcat [ + text "\\haddockmoduleheading" <> braces (text mdl_str), + text "\\label{module:" <> text mdl_str <> char '}', + text "\\haddockbeginheader", + verb $ vcat [ + text "module" <+> text mdl_str <+> lparen, + text " " <> fsep (punctuate (text ", ") $ + map exportListItem $ + filter forSummary exports), + text " ) where" + ], + text "\\haddockendheader" $$ text "", + description, + body + ] + + description + = case ifaceRnDoc iface of + Nothing -> empty + Just doc -> docToLaTeX doc + + body = processExports exports + -- + writeFile (odir moduleLaTeXFile mdl) (fullRender PageMode 80 1 string_txt "" tex) + + +string_txt :: TextDetails -> String -> String +string_txt (Chr c) s = c:s +string_txt (Str s1) s2 = s1 ++ s2 +string_txt (PStr s1) s2 = unpackFS s1 ++ s2 +string_txt (LStr s1 _) s2 = unpackLitString s1 ++ s2 + +exportListItem :: ExportItem DocName -> LaTeX +exportListItem (ExportDecl decl _doc subdocs _insts) + = ppDocBinder (declName decl) <> + case subdocs of + [] -> empty + xs -> parens (sep (punctuate comma (map (ppDocBinder . fst) subdocs))) +exportListItem (ExportNoDecl y []) + = ppDocBinder y +exportListItem (ExportNoDecl y subs) + = ppDocBinder y <> parens (sep (punctuate comma (map ppDocBinder subs))) +exportListItem (ExportModule mdl) + = text "module" <+> text (moduleString mdl) +exportListItem _ + = error "exportListItem" + +-- Deal with a group of undocumented exports together, to avoid lots +-- of blank vertical space between them. +processExports :: [ExportItem DocName] -> LaTeX +processExports [] = empty +processExports (decl : es) + | Just sig <- isSimpleSig decl + = multiDecl [ ppTypeSig (getName name) typ False + | (name,typ) <- sig:sigs ] $$ + processExports es' + where (sigs, es') = spanWith isSimpleSig es +processExports (ExportModule mdl : es) + = declWithDoc (vcat [ text "module" <+> text (moduleString m) | m <- mdl:mdls ]) Nothing $$ + processExports es' + where (mdls, es') = spanWith isExportModule es +processExports (e : es) = + processExport e $$ processExports es + +isSimpleSig :: ExportItem DocName -> Maybe (DocName, HsType DocName) +isSimpleSig (ExportDecl (L _ (SigD (TypeSig (L _ n) (L _ t)))) + (Nothing, argDocs) _ _) + | Map.null argDocs = Just (n, t) +isSimpleSig _ = Nothing + +isExportModule :: ExportItem DocName -> Maybe Module +isExportModule (ExportModule m) = Just m +isExportModule _ = Nothing + +processExport :: ExportItem DocName -> LaTeX +processExport (ExportGroup lev _id0 doc) + = ppDocGroup lev (docToLaTeX doc) +processExport (ExportDecl decl doc subdocs insts) + = ppDecl decl doc insts subdocs +processExport (ExportNoDecl y []) + = ppDocName y +processExport (ExportNoDecl y subs) + = ppDocName y <> parens (sep (punctuate comma (map ppDocName subs))) +processExport (ExportModule mdl) + = declWithDoc (text "module" <+> text (moduleString mdl)) Nothing +processExport (ExportDoc doc) + = docToLaTeX doc + +ppDocGroup :: Int -> LaTeX -> LaTeX +ppDocGroup lev doc = sec lev <> braces doc + where sec 1 = text "\\section" + sec 2 = text "\\subsection" + sec 3 = text "\\subsubsection" + sec _ = text "\\paragraph" + +declName :: LHsDecl DocName -> DocName +declName (L _ decl) = case decl of + TyClD d -> unLoc $ tcdLName d + SigD (TypeSig (L _ n) _) -> n + _ -> error "declaration not supported by declName" + +forSummary :: (ExportItem DocName) -> Bool +forSummary (ExportGroup _ _ _) = False +forSummary (ExportDoc _) = False +forSummary _ = True + +moduleLaTeXFile :: Module -> FilePath +moduleLaTeXFile mdl = moduleBasename mdl ++ ".tex" + +moduleBasename :: Module -> FilePath +moduleBasename mdl = map (\c -> if c == '.' then '-' else c) + (moduleNameString (moduleName mdl)) + +-- ----------------------------------------------------------------------------- +-- Decls + +ppDecl :: LHsDecl DocName + -> DocForDecl DocName + -> [DocInstance DocName] + -> [(DocName, DocForDecl DocName)] + -> LaTeX + +ppDecl (L loc decl) (mbDoc, fnArgsDoc) instances subdocs = case decl of + TyClD d@(TyFamily {}) -> ppTyFam False loc mbDoc d unicode + TyClD d@(TyData {}) + | Nothing <- tcdTyPats d -> ppDataDecl instances subdocs loc mbDoc d unicode + | Just _ <- tcdTyPats d -> ppDataInst loc mbDoc d + TyClD d@(TySynonym {}) + | Nothing <- tcdTyPats d -> ppTySyn loc (mbDoc, fnArgsDoc) d unicode + | Just _ <- tcdTyPats d -> ppTyInst False loc mbDoc d unicode + TyClD d@(ClassDecl {}) -> ppClassDecl instances loc mbDoc subdocs d unicode + SigD (TypeSig (L _ n) (L _ t)) -> ppFunSig loc (mbDoc, fnArgsDoc) n t unicode False + ForD d -> ppFor loc (mbDoc, fnArgsDoc) d unicode + InstD _ -> empty + _ -> error "declaration not supported by ppDecl" + where + unicode = False + +ppTyFam _ _ _ _ _ = + error "type family declarations are currently not supported by --latex" + +ppDataInst _ _ _ = + error "data instance declarations are currently not supported by --latex" + +ppTyInst _ _ _ _ _ = + error "type instance declarations are currently not supported by --latex" + +ppFor _ _ _ _ = + error "foreign declarations are currently not supported by --latex" + +-- ----------------------------------------------------------------------------- +-- Type Synonyms + +-- we skip type patterns for now +ppTySyn :: SrcSpan -> DocForDecl DocName -> TyClDecl DocName -> Bool -> LaTeX + +ppTySyn loc doc (TySynonym (L _ name) ltyvars _ ltype) unicode + = ppTypeOrFunSig loc name (unLoc ltype) doc + (full, hdr, char '=') unicode False + where + hdr = hsep (keyword "type" : ppDocBinder name : ppTyVars ltyvars) + full = hdr <+> char '=' <+> ppLType unicode ltype + +ppTySyn _ _ _ _ = error "declaration not supported by ppTySyn" + +-- ----------------------------------------------------------------------------- +-- Function signatures + +ppFunSig :: SrcSpan -> DocForDecl DocName -> DocName -> HsType DocName + -> Bool -> Bool + -> LaTeX +ppFunSig loc doc docname typ unicode methods = + ppTypeOrFunSig loc docname typ doc + (ppTypeSig name typ False, ppSymName name, dcolon unicode) + unicode methods + where + name = getName docname + +ppTypeOrFunSig :: SrcSpan -> DocName -> HsType DocName -> + DocForDecl DocName -> (LaTeX, LaTeX, LaTeX) + -> Bool -> Bool -> LaTeX +ppTypeOrFunSig _loc _docname typ (doc, argDocs) (pref1, pref2, sep0) + unicode methods + | Map.null argDocs = + declWithDoc pref1 (fmap docToLaTeX doc) + | otherwise = + declWithDoc pref2 $ Just $ + text "\\haddockbeginargs" $$ + do_args 0 sep0 typ $$ + text "\\end{tabulary}\\par" $$ + maybe empty docToLaTeX doc + where + do_largs n leader (L _ t) = do_args n leader t + + arg_doc n = rDoc (Map.lookup n argDocs) + + do_args :: Int -> LaTeX -> (HsType DocName) -> LaTeX + do_args n leader (HsForAllTy Explicit tvs lctxt ltype) + = decltt leader <-> + decltt (hsep (forallSymbol unicode : ppTyVars tvs ++ [dot]) <+> + ppLContextNoArrow lctxt unicode) <+> nl $$ + do_largs n (darrow unicode) ltype + + do_args n leader (HsForAllTy Implicit _ lctxt ltype) + | not (null (unLoc lctxt)) + = decltt leader <-> decltt (ppLContextNoArrow lctxt unicode) <+> nl $$ + do_largs n (darrow unicode) ltype + -- if we're not showing any 'forall' or class constraints or + -- anything, skip having an empty line for the context. + | otherwise + = do_largs n leader ltype + do_args n leader (HsFunTy lt r) + = decltt leader <-> decltt (ppLFunLhType unicode lt) <-> arg_doc n <+> nl $$ + do_largs (n+1) (arrow unicode) r + do_args n leader t + = decltt leader <-> decltt (ppType unicode t) <-> arg_doc n <+> nl + +ppTypeSig :: Name -> HsType DocName -> Bool -> LaTeX +ppTypeSig nm ty unicode = + ppSymName nm <+> dcolon unicode <+> ppType unicode ty + +ppTyVars :: [LHsTyVarBndr DocName] -> [LaTeX] +ppTyVars tvs = map ppSymName (tyvarNames tvs) + +tyvarNames :: [LHsTyVarBndr DocName] -> [Name] +tyvarNames = map (getName . hsTyVarName . unLoc) + +declWithDoc :: LaTeX -> Maybe LaTeX -> LaTeX +declWithDoc decl doc = + text "\\begin{haddockdesc}" $$ + text "\\item[\\begin{tabular}{@{}l}" $$ + text (latexMonoFilter (render decl)) $$ + text "\\end{tabular}]" <> + (if isNothing doc then empty else text "\\haddockbegindoc") $$ + maybe empty id doc $$ + text "\\end{haddockdesc}" + +-- in a group of decls, we don't put them all in the same tabular, +-- because that would prevent the group being broken over a page +-- boundary (breaks Foreign.C.Error for example). +multiDecl :: [LaTeX] -> LaTeX +multiDecl decls = + text "\\begin{haddockdesc}" $$ + vcat [ + text "\\item[" $$ + text (latexMonoFilter (render decl)) $$ + text "]" + | decl <- decls ] $$ + text "\\end{haddockdesc}" + +------------------------------------------------------------------------------- +-- Rendering Doc + +maybeDoc :: Maybe (Doc DocName) -> LaTeX +maybeDoc = maybe empty docToLaTeX + +-- for table cells, we strip paragraphs out to avoid extra vertical space +-- and don't add a quote environment. +rDoc :: Maybe (Doc DocName) -> LaTeX +rDoc = maybeDoc . fmap latexStripTrailingWhitespace + +------------------------------------------------------------------------------- +-- Class declarations +------------------------------------------------------------------------------- + +ppClassHdr :: Bool -> Located [LHsPred DocName] -> DocName + -> [Located (HsTyVarBndr DocName)] -> [Located ([DocName], [DocName])] + -> Bool -> LaTeX +ppClassHdr summ lctxt n tvs fds unicode = + keyword "class" + <+> (if not . null . unLoc $ lctxt then ppLContext lctxt unicode else empty) + <+> ppAppDocNameNames summ n (tyvarNames $ tvs) + <+> ppFds fds unicode + + +ppFds :: [Located ([DocName], [DocName])] -> Bool -> LaTeX +ppFds fds unicode = + if null fds then empty else + char '|' <+> hsep (punctuate comma (map (fundep . unLoc) fds)) + where + fundep (vars1,vars2) = hsep (map ppDocName vars1) <+> arrow unicode <+> + hsep (map ppDocName vars2) + + +ppClassDecl :: [DocInstance DocName] -> SrcSpan + -> Maybe (Doc DocName) -> [(DocName, DocForDecl DocName)] + -> TyClDecl DocName -> Bool -> LaTeX +ppClassDecl instances loc mbDoc subdocs + decl@(ClassDecl lctxt lname ltyvars lfds lsigs _ ats _) unicode + = declWithDoc classheader (if null body then Nothing else Just (vcat body)) $$ + instancesBit + where + classheader + | null lsigs = hdr unicode + | otherwise = hdr unicode <+> keyword "where" + + nm = unLoc $ tcdLName decl + + hdr = ppClassHdr False lctxt (unLoc lname) ltyvars lfds + + body = catMaybes [fmap docToLaTeX mbDoc, body_] + + body_ + | null lsigs, null ats = Nothing + | null ats = Just methodTable +-- | otherwise = atTable $$ methodTable + + methodTable = + text "\\haddockpremethods{}\\textbf{Methods}" $$ + vcat [ ppFunSig loc doc n typ unicode True + | L _ (TypeSig (L _ n) (L _ typ)) <- lsigs + , let doc = lookupAnySubdoc n subdocs ] + +-- atTable = abovesSep s8 $ [ ppAssocType summary links doc at unicode | at <- ats +-- , let doc = lookupAnySubdoc (tcdName $ unL at) subdocs ] + + instancesBit + | null instances = empty + | all (isNothing . snd) instances = + declWithDoc (vcat (map (ppInstDecl unicode) (map fst instances))) Nothing + | otherwise = vcat (map (ppDocInstance unicode) instances) + +ppClassDecl _ _ _ _ _ _ = error "declaration type not supported by ppShortClassDecl" + + +-- | Print a possibly commented instance. The instance header is printed inside +-- an 'argBox'. The comment is printed to the right of the box in normal comment +-- style. +ppDocInstance :: Bool -> DocInstance DocName -> LaTeX +ppDocInstance unicode (instHead, mbDoc) = + declWithDoc (ppInstDecl unicode instHead) (fmap docToLaTeX mbDoc) + +ppInstDecl :: Bool -> InstHead DocName -> LaTeX +ppInstDecl unicode instHead = keyword "instance" <+> ppInstHead unicode instHead + +ppInstHead :: Bool -> InstHead DocName -> LaTeX +ppInstHead unicode ([], n, ts) = ppAppNameTypes n ts unicode +ppInstHead unicode (ctxt, n, ts) = ppContextNoLocs ctxt unicode <+> ppAppNameTypes n ts unicode + +lookupAnySubdoc :: (Eq name1) => + name1 -> [(name1, DocForDecl name2)] -> DocForDecl name2 +lookupAnySubdoc n subdocs = case lookup n subdocs of + Nothing -> noDocForDecl + Just docs -> docs + +-- ----------------------------------------------------------------------------- +-- Data & newtype declarations + + +ppDataDecl :: [DocInstance DocName] -> + [(DocName, DocForDecl DocName)] -> + SrcSpan -> Maybe (Doc DocName) -> TyClDecl DocName -> Bool -> + LaTeX +ppDataDecl instances subdocs loc mbDoc dataDecl unicode + + = declWithDoc (ppDataHeader dataDecl unicode <+> whereBit) + (if null body then Nothing else Just (vcat body)) + $$ instancesBit + + where + docname = unLoc . tcdLName $ dataDecl + cons = tcdCons dataDecl + resTy = (con_res . unLoc . head) cons + + body = catMaybes [constrBit, fmap docToLaTeX mbDoc] + + (whereBit, leaders) + | null cons = (empty,[]) + | otherwise = case resTy of + ResTyGADT _ -> (decltt (keyword "where"), repeat empty) + _ -> (empty, (decltt (text "=") : repeat (decltt (text "|")))) + + constrBit + | null cons = Nothing + | otherwise = Just $ + text "\\haddockbeginconstrs" $$ + vcat (zipWith (ppSideBySideConstr subdocs unicode) leaders cons) $$ + text "\\end{tabulary}\\par" + + instancesBit + | null instances = empty + | all (isNothing . snd) instances = + declWithDoc (vcat (map (ppInstDecl unicode) (map fst instances))) Nothing + | otherwise = vcat (map (ppDocInstance unicode) instances) + +isRecCon :: Located (ConDecl a) -> Bool +isRecCon lcon = case con_details (unLoc lcon) of + RecCon _ -> True + _ -> False + + +-- ppConstrHdr is for (non-GADT) existentials constructors' syntax +#if __GLASGOW_HASKELL__ == 612 +ppConstrHdr :: HsExplicitForAll -> [Name] -> HsContext DocName -> Bool -> LaTeX +#else +ppConstrHdr :: HsExplicitFlag -> [Name] -> HsContext DocName -> Bool -> LaTeX +#endif +ppConstrHdr forall tvs ctxt unicode + = (if null tvs then empty else ppForall) + <+> + (if null ctxt then empty else ppContextNoArrow ctxt unicode <+> darrow unicode <+> text " ") + where + ppForall = case forall of + Explicit -> forallSymbol unicode <+> hsep (map ppName tvs) <+> text ". " + Implicit -> empty + +ppSideBySideConstr :: [(DocName, DocForDecl DocName)] -> Bool -> LaTeX + -> LConDecl DocName -> LaTeX +ppSideBySideConstr subdocs unicode leader (L _ con) = + leader <-> + case con_res con of + ResTyH98 -> case con_details con of + + PrefixCon args -> + decltt (hsep ((header_ unicode <+> ppBinder occ) : + map (ppLParendType unicode) args)) + <-> rDoc mbDoc <+> nl + + RecCon fields -> + (decltt (header_ unicode <+> ppBinder occ) + <-> rDoc mbDoc <+> nl) + $$ + doRecordFields fields + + InfixCon arg1 arg2 -> + decltt (hsep [ header_ unicode <+> ppLParendType unicode arg1, + ppBinder occ, + ppLParendType unicode arg2 ]) + <-> rDoc mbDoc <+> nl + + ResTyGADT resTy -> case con_details con of + -- prefix & infix could also use hsConDeclArgTys if it seemed to + -- simplify the code. + PrefixCon args -> doGADTCon args resTy + cd@(RecCon fields) -> doGADTCon (hsConDeclArgTys cd) resTy <+> nl $$ + doRecordFields fields + InfixCon arg1 arg2 -> doGADTCon [arg1, arg2] resTy + + where + doRecordFields fields = + vcat (map (ppSideBySideField subdocs unicode) fields) + + doGADTCon args resTy = decltt (ppBinder occ <+> dcolon unicode <+> hsep [ + ppForAll forall ltvs (con_cxt con) unicode, + ppLType unicode (foldr mkFunTy resTy args) ] + ) <-> rDoc mbDoc + + + header_ = ppConstrHdr forall tyVars context + occ = docNameOcc . unLoc . con_name $ con + ltvs = con_qvars con + tyVars = tyvarNames (con_qvars con) + context = unLoc (con_cxt con) + forall = con_explicit con + -- don't use "con_doc con", in case it's reconstructed from a .hi file, + -- or also because we want Haddock to do the doc-parsing, not GHC. + -- 'join' is in Maybe. + mbDoc = join $ fmap fst $ lookup (unLoc $ con_name con) subdocs + mkFunTy a b = noLoc (HsFunTy a b) + +ppSideBySideField :: [(DocName, DocForDecl DocName)] -> Bool -> ConDeclField DocName -> LaTeX +ppSideBySideField subdocs unicode (ConDeclField (L _ name) ltype _) = + decltt (ppBinder (docNameOcc name) + <+> dcolon unicode <+> ppLType unicode ltype) <-> rDoc mbDoc + where + -- don't use cd_fld_doc for same reason we don't use con_doc above + mbDoc = join $ fmap fst $ lookup name subdocs + +-- {- +-- ppHsFullConstr :: HsConDecl -> LaTeX +-- ppHsFullConstr (HsConDecl _ nm tvs ctxt typeList doc) = +-- declWithDoc False doc ( +-- hsep ((ppHsConstrHdr tvs ctxt +++ +-- ppHsBinder False nm) : map ppHsBangType typeList) +-- ) +-- ppHsFullConstr (HsRecDecl _ nm tvs ctxt fields doc) = +-- td << vanillaTable << ( +-- case doc of +-- Nothing -> aboves [hdr, fields_html] +-- Just _ -> aboves [hdr, constr_doc, fields_html] +-- ) +-- +-- where hdr = declBox (ppHsConstrHdr tvs ctxt +++ ppHsBinder False nm) +-- +-- constr_doc +-- | isJust doc = docBox (docToLaTeX (fromJust doc)) +-- | otherwise = LaTeX.emptyTable +-- +-- fields_html = +-- td << +-- table ! [width "100%", cellpadding 0, cellspacing 8] << ( +-- aboves (map ppFullField (concat (map expandField fields))) +-- ) +-- -} +-- +-- ppShortField :: Bool -> Bool -> ConDeclField DocName -> LaTeX +-- ppShortField summary unicode (ConDeclField (L _ name) ltype _) +-- = tda [theclass "recfield"] << ( +-- ppBinder summary (docNameOcc name) +-- <+> dcolon unicode <+> ppLType unicode ltype +-- ) +-- +-- {- +-- ppFullField :: HsFieldDecl -> LaTeX +-- ppFullField (HsFieldDecl [n] ty doc) +-- = declWithDoc False doc ( +-- ppHsBinder False n <+> dcolon <+> ppHsBangType ty +-- ) +-- ppFullField _ = error "ppFullField" +-- +-- expandField :: HsFieldDecl -> [HsFieldDecl] +-- expandField (HsFieldDecl ns ty doc) = [ HsFieldDecl [n] ty doc | n <- ns ] +-- -} + +-- | Print the LHS of a data\/newtype declaration. +-- Currently doesn't handle 'data instance' decls or kind signatures +ppDataHeader :: TyClDecl DocName -> Bool -> LaTeX +ppDataHeader decl unicode + | not (isDataDecl decl) = error "ppDataHeader: illegal argument" + | otherwise = + -- newtype or data + (if tcdND decl == NewType then keyword "newtype" else keyword "data") <+> + -- context + ppLContext (tcdCtxt decl) unicode <+> + -- T a b c ..., or a :+: b + ppTyClBinderWithVars False decl + + +-------------------------------------------------------------------------------- +-- TyClDecl helpers +-------------------------------------------------------------------------------- + + +-- | Print a type family / newtype / data / class binder and its variables +ppTyClBinderWithVars :: Bool -> TyClDecl DocName -> LaTeX +ppTyClBinderWithVars summ decl = + ppAppDocNameNames summ (unLoc $ tcdLName decl) (tyvarNames $ tcdTyVars decl) + + +-------------------------------------------------------------------------------- +-- Type applications +-------------------------------------------------------------------------------- + + +-- | Print an application of a DocName and a list of HsTypes +ppAppNameTypes :: DocName -> [HsType DocName] -> Bool -> LaTeX +ppAppNameTypes n ts unicode = ppTypeApp n ts ppDocName (ppParendType unicode) + + +-- | Print an application of a DocName and a list of Names +ppAppDocNameNames :: Bool -> DocName -> [Name] -> LaTeX +ppAppDocNameNames _summ n ns = + ppTypeApp n ns (ppBinder . docNameOcc) ppSymName + + +-- | General printing of type applications +ppTypeApp :: DocName -> [a] -> (DocName -> LaTeX) -> (a -> LaTeX) -> LaTeX +ppTypeApp n (t1:t2:rest) ppDN ppT + | operator, not . null $ rest = parens opApp <+> hsep (map ppT rest) + | operator = opApp + where + operator = isNameSym . getName $ n + opApp = ppT t1 <+> ppDN n <+> ppT t2 + +ppTypeApp n ts ppDN ppT = ppDN n <+> hsep (map ppT ts) + + +------------------------------------------------------------------------------- +-- Contexts +------------------------------------------------------------------------------- + + +ppLContext, ppLContextNoArrow :: Located (HsContext DocName) -> Bool -> LaTeX +ppLContext = ppContext . unLoc +ppLContextNoArrow = ppContextNoArrow . unLoc + + +ppContextNoArrow :: HsContext DocName -> Bool -> LaTeX +ppContextNoArrow [] _ = empty +ppContextNoArrow cxt unicode = pp_hs_context (map unLoc cxt) unicode + + +ppContextNoLocs :: [HsPred DocName] -> Bool -> LaTeX +ppContextNoLocs [] _ = empty +ppContextNoLocs cxt unicode = pp_hs_context cxt unicode <+> darrow unicode + + +ppContext :: HsContext DocName -> Bool -> LaTeX +ppContext cxt unicode = ppContextNoLocs (map unLoc cxt) unicode + + +pp_hs_context :: [HsPred DocName] -> Bool -> LaTeX +pp_hs_context [] _ = empty +pp_hs_context [p] unicode = ppPred unicode p +pp_hs_context cxt unicode = parenList (map (ppPred unicode) cxt) + + +ppPred :: Bool -> HsPred DocName -> LaTeX +ppPred unicode (HsClassP n ts) = ppAppNameTypes n (map unLoc ts) unicode +ppPred unicode (HsEqualP t1 t2) = ppLType unicode t1 <> text "~" <> ppLType unicode t2 +ppPred unicode (HsIParam (IPName n) t) + = char '?' <> ppDocName n <> dcolon unicode <> ppLType unicode t + + +-- ---------------------------------------------------------------------------- +-- Types and contexts + +ppKind :: Outputable a => a -> LaTeX +ppKind k = text (showSDoc (ppr k)) + +ppBang :: HsBang -> LaTeX +ppBang HsNoBang = empty +ppBang _ = char '!' -- Unpacked args is an implementation detail, + +tupleParens :: Boxity -> [LaTeX] -> LaTeX +tupleParens Boxed = parenList +tupleParens Unboxed = ubxParenList + +-- ----------------------------------------------------------------------------- +-- Rendering of HsType +-- +-- Stolen from Html and tweaked for LaTeX generation + +pREC_TOP, pREC_FUN, pREC_OP, pREC_CON :: Int + +pREC_TOP = (0 :: Int) -- type in ParseIface.y in GHC +pREC_FUN = (1 :: Int) -- btype in ParseIface.y in GHC + -- Used for LH arg of (->) +pREC_OP = (2 :: Int) -- Used for arg of any infix operator + -- (we don't keep their fixities around) +pREC_CON = (3 :: Int) -- Used for arg of type applicn: + -- always parenthesise unless atomic + +maybeParen :: Int -- Precedence of context + -> Int -- Precedence of top-level operator + -> LaTeX -> LaTeX -- Wrap in parens if (ctxt >= op) +maybeParen ctxt_prec op_prec p | ctxt_prec >= op_prec = parens p + | otherwise = p + + +ppLType, ppLParendType, ppLFunLhType :: Bool -> Located (HsType DocName) -> LaTeX +ppLType unicode y = ppType unicode (unLoc y) +ppLParendType unicode y = ppParendType unicode (unLoc y) +ppLFunLhType unicode y = ppFunLhType unicode (unLoc y) + + +ppType, ppParendType, ppFunLhType :: Bool -> HsType DocName -> LaTeX +ppType unicode ty = ppr_mono_ty pREC_TOP ty unicode +ppParendType unicode ty = ppr_mono_ty pREC_CON ty unicode +ppFunLhType unicode ty = ppr_mono_ty pREC_FUN ty unicode + + +-- Drop top-level for-all type variables in user style +-- since they are implicit in Haskell + +#if __GLASGOW_HASKELL__ == 612 +ppForAll :: HsExplicitForAll -> [Located (HsTyVarBndr DocName)] +#else +ppForAll :: HsExplicitFlag -> [Located (HsTyVarBndr DocName)] +#endif + -> Located (HsContext DocName) -> Bool -> LaTeX +ppForAll expl tvs cxt unicode + | show_forall = forall_part <+> ppLContext cxt unicode + | otherwise = ppLContext cxt unicode + where + show_forall = not (null tvs) && is_explicit + is_explicit = case expl of {Explicit -> True; Implicit -> False} + forall_part = hsep (forallSymbol unicode : ppTyVars tvs) <> dot + + +ppr_mono_lty :: Int -> LHsType DocName -> Bool -> LaTeX +ppr_mono_lty ctxt_prec ty unicode = ppr_mono_ty ctxt_prec (unLoc ty) unicode + + +ppr_mono_ty :: Int -> HsType DocName -> Bool -> LaTeX +ppr_mono_ty ctxt_prec (HsForAllTy expl tvs ctxt ty) unicode + = maybeParen ctxt_prec pREC_FUN $ + hsep [ppForAll expl tvs ctxt unicode, ppr_mono_lty pREC_TOP ty unicode] + +ppr_mono_ty _ (HsBangTy b ty) u = ppBang b <> ppLParendType u ty +ppr_mono_ty _ (HsTyVar name) _ = ppDocName name +ppr_mono_ty ctxt_prec (HsFunTy ty1 ty2) u = ppr_fun_ty ctxt_prec ty1 ty2 u +ppr_mono_ty _ (HsTupleTy con tys) u = tupleParens con (map (ppLType u) tys) +ppr_mono_ty _ (HsKindSig ty kind) u = parens (ppr_mono_lty pREC_TOP ty u <+> dcolon u <+> ppKind kind) +ppr_mono_ty _ (HsListTy ty) u = brackets (ppr_mono_lty pREC_TOP ty u) +ppr_mono_ty _ (HsPArrTy ty) u = pabrackets (ppr_mono_lty pREC_TOP ty u) +ppr_mono_ty _ (HsPredTy p) u = parens (ppPred u p) +ppr_mono_ty _ (HsNumTy n) _ = text (show n) -- generics only +ppr_mono_ty _ (HsSpliceTy {}) _ = error "ppr_mono_ty HsSpliceTy" +#if __GLASGOW_HASKELL__ == 612 +ppr_mono_ty _ (HsSpliceTyOut {}) _ = error "ppr_mono_ty HsQuasiQuoteTy" +#else +ppr_mono_ty _ (HsQuasiQuoteTy {}) _ = error "ppr_mono_ty HsQuasiQuoteTy" +#endif +ppr_mono_ty _ (HsRecTy {}) _ = error "ppr_mono_ty HsRecTy" + +ppr_mono_ty ctxt_prec (HsAppTy fun_ty arg_ty) unicode + = maybeParen ctxt_prec pREC_CON $ + hsep [ppr_mono_lty pREC_FUN fun_ty unicode, ppr_mono_lty pREC_CON arg_ty unicode] + +ppr_mono_ty ctxt_prec (HsOpTy ty1 op ty2) unicode + = maybeParen ctxt_prec pREC_FUN $ + ppr_mono_lty pREC_OP ty1 unicode <+> ppr_op <+> ppr_mono_lty pREC_OP ty2 unicode + where + ppr_op = if not (isSymOcc occName) then char '`' <> ppLDocName op <> char '`' else ppLDocName op + occName = docNameOcc . unLoc $ op + +ppr_mono_ty ctxt_prec (HsParTy ty) unicode +-- = parens (ppr_mono_lty pREC_TOP ty) + = ppr_mono_lty ctxt_prec ty unicode + +ppr_mono_ty ctxt_prec (HsDocTy ty _) unicode + = ppr_mono_lty ctxt_prec ty unicode + + +ppr_fun_ty :: Int -> LHsType DocName -> LHsType DocName -> Bool -> LaTeX +ppr_fun_ty ctxt_prec ty1 ty2 unicode + = let p1 = ppr_mono_lty pREC_FUN ty1 unicode + p2 = ppr_mono_lty pREC_TOP ty2 unicode + in + maybeParen ctxt_prec pREC_FUN $ + sep [p1, arrow unicode <+> p2] + +-- ----------------------------------------------------------------------------- +-- Names + +ppBinder :: OccName -> LaTeX +ppBinder n + | isVarSym n = parens $ ppOccName n + | otherwise = ppOccName n + +ppVerbBinder :: OccName -> LaTeX +ppVerbBinder n + | isVarSym n = parens $ ppVerbOccName n + | otherwise = ppVerbOccName n + +ppSymName :: Name -> LaTeX +ppSymName name + | isNameSym name = parens $ ppName name + | otherwise = ppName name + +ppVerbOccName :: OccName -> LaTeX +ppVerbOccName = text . latexFilter . occNameString + +ppOccName :: OccName -> LaTeX +ppOccName = text . occNameString + +ppVerbDocName :: DocName -> LaTeX +ppVerbDocName = ppVerbOccName . docNameOcc + +ppVerbRdrName :: RdrName -> LaTeX +ppVerbRdrName = ppVerbOccName . rdrNameOcc + +ppDocName :: DocName -> LaTeX +ppDocName = ppOccName . docNameOcc + +ppLDocName :: Located DocName -> LaTeX +ppLDocName (L _ d) = ppDocName d + +ppDocBinder :: DocName -> LaTeX +ppDocBinder = ppBinder . docNameOcc + +ppVerbDocBinder :: DocName -> LaTeX +ppVerbDocBinder = ppVerbBinder . docNameOcc + +ppName :: Name -> LaTeX +ppName = ppOccName . nameOccName + +ppVerbName :: Name -> LaTeX +ppVerbName = ppVerbOccName . nameOccName + +latexFilter :: String -> String +latexFilter = foldr latexMunge "" + +latexMonoFilter :: String -> String +latexMonoFilter = foldr latexMonoMunge "" + +latexMunge '#' s = "{\\char '43}" ++ s +latexMunge '$' s = "{\\char '44}" ++ s +latexMunge '%' s = "{\\char '45}" ++ s +latexMunge '&' s = "{\\char '46}" ++ s +latexMunge '~' s = "{\\char '176}" ++ s +latexMunge '_' s = "{\\char '137}" ++ s +latexMunge '^' s = "{\\char '136}" ++ s +latexMunge '\\' s = "{\\char '134}" ++ s +latexMunge '{' s = "{\\char '173}" ++ s +latexMunge '}' s = "{\\char '175}" ++ s +latexMunge '[' s = "{\\char 91}" ++ s +latexMunge ']' s = "{\\char 93}" ++ s +latexMunge c s = c : s + +latexMonoMunge ' ' s = '\\' : ' ' : s +latexMonoMunge '\n' s = '\\' : '\\' : s +latexMonoMunge c s = latexMunge c s + +-- ----------------------------------------------------------------------------- +-- Doc Markup + +parLatexMarkup :: (a -> LaTeX) -> (a -> Bool) + -> DocMarkup a (StringContext -> LaTeX) +parLatexMarkup ppId isTyCon = Markup { + markupParagraph = \p v -> p v <> text "\\par" $$ text "", + markupEmpty = \_ -> empty, + markupString = \s v -> text (fixString v s), + markupAppend = \l r v -> l v <> r v, + markupIdentifier = markupId, + markupModule = \m v -> let (mdl,_ref) = break (=='#') m in tt (text mdl), + markupEmphasis = \p v -> emph (p v), + markupMonospaced = \p v -> tt (p Mono), + markupUnorderedList = \p v -> itemizedList (map ($v) p) $$ text "", + markupPic = \path v -> parens (text "image: " <> text path), + markupOrderedList = \p v -> enumeratedList (map ($v) p) $$ text "", + markupDefList = \l v -> descriptionList (map (\(a,b) -> (a v, b v)) l), + markupCodeBlock = \p _ -> quote (verb (p Verb)) $$ text "", + markupURL = \u _ -> text "\\url" <> braces (text u), + markupAName = \_ _ -> empty, + markupExample = \e _ -> quote $ verb $ text $ unlines $ map exampleToString e + } + where + fixString Plain s = latexFilter s + fixString Verb s = s + fixString Mono s = latexMonoFilter s + + markupId id v = + case v of + Verb -> theid + Mono -> theid + Plain -> text "\\haddockid" <> braces theid + where theid = ppId (choose id) + + -- If an id can refer to multiple things, we give precedence to type + -- constructors. This should ideally be done during renaming from RdrName + -- to Name, but since we will move this process from GHC into Haddock in + -- the future, we fix it here in the meantime. + -- TODO: mention this rule in the documentation. + choose [] = error "empty identifier list in HsDoc" + choose [x] = x + choose (x:y:_) + | isTyCon x = x + | otherwise = y + +latexMarkup :: DocMarkup DocName (StringContext -> LaTeX) +latexMarkup = parLatexMarkup ppVerbDocName (isTyConName . getName) + +rdrLatexMarkup :: DocMarkup RdrName (StringContext -> LaTeX) +rdrLatexMarkup = parLatexMarkup ppVerbRdrName isRdrTc + +docToLaTeX :: Doc DocName -> LaTeX +docToLaTeX doc = markup latexMarkup doc Plain + +rdrDocToLaTeX :: Doc RdrName -> LaTeX +rdrDocToLaTeX doc = markup rdrLatexMarkup doc Plain + +data StringContext = Plain | Verb | Mono + +latexStripTrailingWhitespace :: Doc a -> Doc a +latexStripTrailingWhitespace (DocString s) + | null s' = DocEmpty + | otherwise = DocString s + where s' = reverse (dropWhile isSpace (reverse s)) +latexStripTrailingWhitespace (DocAppend l r) + | DocEmpty <- r' = latexStripTrailingWhitespace l + | otherwise = DocAppend l r' + where + r' = latexStripTrailingWhitespace r +latexStripTrailingWhitespace (DocParagraph p) = + latexStripTrailingWhitespace p +latexStripTrailingWhitespace other = other + +latexStripLeadingPara :: Doc a -> Doc a +latexStripLeadingPara (DocParagraph p) = p +latexStripLeadingPara (DocAppend l r) = DocAppend (latexStripLeadingPara l) r +latexStripLeadingPara d = d + +-- ----------------------------------------------------------------------------- +-- LaTeX utils + +itemizedList :: [LaTeX] -> LaTeX +itemizedList items = + text "\\begin{itemize}" $$ + vcat (map (text "\\item" $$) items) $$ + text "\\end{itemize}" + +enumeratedList :: [LaTeX] -> LaTeX +enumeratedList items = + text "\\begin{enumerate}" $$ + vcat (map (text "\\item " $$) items) $$ + text "\\end{enumerate}" + +descriptionList :: [(LaTeX,LaTeX)] -> LaTeX +descriptionList items = + text "\\begin{description}" $$ + vcat (map (\(a,b) -> text "\\item" <> brackets a <+> b) items) $$ + text "\\end{description}" + +tt :: LaTeX -> LaTeX +tt ltx = text "\\haddocktt" <> braces ltx + +decltt :: LaTeX -> LaTeX +decltt ltx = text "\\haddockdecltt" <> braces ltx + +emph :: LaTeX -> LaTeX +emph ltx = text "\\emph" <> braces ltx + +verb :: LaTeX -> LaTeX +verb doc = text "{\\haddockverb\\begin{verbatim}" $$ doc <> text "\\end{verbatim}}" + -- NB. swallow a trailing \n in the verbatim text by appending the + -- \end{verbatim} directly, otherwise we get spurious blank lines at the + -- end of code blocks. + +quote :: LaTeX -> LaTeX +quote doc = text "\\begin{quote}" $$ doc $$ text "\\end{quote}" + +dcolon, arrow, darrow, forallSymbol :: Bool -> LaTeX +dcolon unicode = text (if unicode then "∷" else "::") +arrow unicode = text (if unicode then "→" else "->") +darrow unicode = text (if unicode then "⇒" else "=>") +forallSymbol unicode = text (if unicode then "∀" else "forall") + +dot :: LaTeX +dot = char '.' + +parenList :: [LaTeX] -> LaTeX +parenList = parens . hsep . punctuate comma + +ubxParenList :: [LaTeX] -> LaTeX +ubxParenList = ubxparens . hsep . punctuate comma + +ubxparens :: LaTeX -> LaTeX +ubxparens h = text "(#" <> h <> text "#)" + +pabrackets :: LaTeX -> LaTeX +pabrackets h = text "[:" <> h <> text ":]" + +nl :: LaTeX +nl = text "\\\\" + +keyword :: String -> LaTeX +keyword = text + +infixr 4 <-> -- combining table cells +(<->) :: LaTeX -> LaTeX -> LaTeX +a <-> b = a <+> char '&' <+> b hunk ./src/Haddock/Options.hs 27 + optLaTeXStyle, hunk ./src/Haddock/Options.hs 61 + | Flag_LaTeX + | Flag_LaTeXStyle String hunk ./src/Haddock/Options.hs 100 + Option [] ["latex"] (NoArg Flag_LaTeX) "use experimental LaTeX rendering", + Option [] ["latex-style"] (ReqArg Flag_LaTeXStyle "FILE") "provide your own LaTeX style in FILE", hunk ./src/Haddock/Options.hs 224 +optLaTeXStyle :: [Flag] -> Maybe String +optLaTeXStyle flags = optLast [ str | Flag_LaTeXStyle str <- flags ] + hunk ./src/Haddock/Utils.hs 40 + spanWith, hunk ./src/Haddock/Utils.hs 329 +spanWith :: (a -> Maybe b) -> [a] -> ([b],[a]) +spanWith p [] = ([],[]) +spanWith p xs@(a:as) + | Just b <- p a = let (bs,cs) = spanWith p as in (b:bs,cs) + | otherwise = ([],xs) hunk ./src/Main.hs 23 +import qualified Haddock.Backends.LaTeX as LaTeX hunk ./src/Main.hs 183 + opt_latex_style = optLaTeXStyle flags hunk ./src/Main.hs 232 + when (Flag_LaTeX `elem` flags) $ do + LaTeX.ppLaTeX title packageStr visibleIfaces odir prologue opt_latex_style + libDir hunk ./src/Haddock/Backends/LaTeX.hs 12 - -module Haddock.Backends.LaTeX ( +module Haddock.Backends.LaTeX ( hunk ./src/Haddock/Backends/LaTeX.hs 16 + hunk ./src/Haddock/Backends/LaTeX.hs 74 -ppLaTeX :: String -- Title +ppLaTeX :: String -- Title hunk ./src/Haddock/Backends/LaTeX.hs 76 - -> [Interface] - -> FilePath -- destination directory - -> Maybe (Doc GHC.RdrName) -- prologue text, maybe + -> [Interface] + -> FilePath -- destination directory + -> Maybe (Doc GHC.RdrName) -- prologue text, maybe hunk ./src/Haddock/Backends/LaTeX.hs 81 - -> IO () + -> IO () hunk ./src/Haddock/Backends/LaTeX.hs 86 - when (isNothing maybe_style) $ + when (isNothing maybe_style) $ hunk ./src/Haddock/Backends/LaTeX.hs 175 - case subdocs of + case subdocs of hunk ./src/Haddock/Backends/LaTeX.hs 193 - = multiDecl [ ppTypeSig (getName name) typ False + = multiDecl [ ppTypeSig (getName name) typ False hunk ./src/Haddock/Backends/LaTeX.hs 250 -moduleBasename mdl = map (\c -> if c == '.' then '-' else c) +moduleBasename mdl = map (\c -> if c == '.' then '-' else c) hunk ./src/Haddock/Backends/LaTeX.hs 266 - | Just _ <- tcdTyPats d -> ppDataInst loc mbDoc d + | Just _ <- tcdTyPats d -> ppDataInst loc mbDoc d hunk ./src/Haddock/Backends/LaTeX.hs 275 - where + where hunk ./src/Haddock/Backends/LaTeX.hs 278 -ppTyFam _ _ _ _ _ = +ppTyFam _ _ _ _ _ = hunk ./src/Haddock/Backends/LaTeX.hs 297 - = ppTypeOrFunSig loc name (unLoc ltype) doc + = ppTypeOrFunSig loc name (unLoc ltype) doc hunk ./src/Haddock/Backends/LaTeX.hs 321 -ppTypeOrFunSig _loc _docname typ (doc, argDocs) (pref1, pref2, sep0) +ppTypeOrFunSig _loc _docname typ (doc, argDocs) (pref1, pref2, sep0) hunk ./src/Haddock/Backends/LaTeX.hs 323 - | Map.null argDocs = + | Map.null argDocs = hunk ./src/Haddock/Backends/LaTeX.hs 325 - | otherwise = + | otherwise = hunk ./src/Haddock/Backends/LaTeX.hs 332 - do_largs n leader (L _ t) = do_args n leader t + do_largs n leader (L _ t) = do_args n leader t hunk ./src/Haddock/Backends/LaTeX.hs 342 - + hunk ./src/Haddock/Backends/LaTeX.hs 358 -ppTypeSig nm ty unicode = +ppTypeSig nm ty unicode = hunk ./src/Haddock/Backends/LaTeX.hs 372 - text "\\end{tabular}]" <> + text "\\end{tabular}]" <> hunk ./src/Haddock/Backends/LaTeX.hs 408 -ppClassHdr summ lctxt n tvs fds unicode = - keyword "class" +ppClassHdr summ lctxt n tvs fds unicode = + keyword "class" hunk ./src/Haddock/Backends/LaTeX.hs 412 - <+> ppFds fds unicode + <+> ppFds fds unicode hunk ./src/Haddock/Backends/LaTeX.hs 417 - if null fds then empty else - char '|' <+> hsep (punctuate comma (map (fundep . unLoc) fds)) + if null fds then empty else + char '|' <+> hsep (punctuate comma (map (fundep . unLoc) fds)) hunk ./src/Haddock/Backends/LaTeX.hs 420 - fundep (vars1,vars2) = hsep (map ppDocName vars1) <+> arrow unicode <+> - hsep (map ppDocName vars2) + fundep (vars1,vars2) = hsep (map ppDocName vars1) <+> arrow unicode <+> + hsep (map ppDocName vars2) hunk ./src/Haddock/Backends/LaTeX.hs 428 - decl@(ClassDecl lctxt lname ltyvars lfds lsigs _ ats _) unicode + decl@(ClassDecl lctxt lname ltyvars lfds lsigs _ ats _) unicode hunk ./src/Haddock/Backends/LaTeX.hs 431 - where + where hunk ./src/Haddock/Backends/LaTeX.hs 439 - + hunk ./src/Haddock/Backends/LaTeX.hs 494 - + hunk ./src/Haddock/Backends/LaTeX.hs 502 - resTy = (con_res . unLoc . head) cons - + resTy = (con_res . unLoc . head) cons + hunk ./src/Haddock/Backends/LaTeX.hs 508 - | otherwise = case resTy of + | otherwise = case resTy of hunk ./src/Haddock/Backends/LaTeX.hs 512 - constrBit + constrBit hunk ./src/Haddock/Backends/LaTeX.hs 516 - vcat (zipWith (ppSideBySideConstr subdocs unicode) leaders cons) $$ + vcat (zipWith (ppSideBySideConstr subdocs unicode) leaders cons) $$ hunk ./src/Haddock/Backends/LaTeX.hs 526 -isRecCon lcon = case con_details (unLoc lcon) of +isRecCon lcon = case con_details (unLoc lcon) of hunk ./src/Haddock/Backends/LaTeX.hs 542 - ppForall = case forall of + ppForall = case forall of hunk ./src/Haddock/Backends/LaTeX.hs 548 -ppSideBySideConstr subdocs unicode leader (L _ con) = +ppSideBySideConstr subdocs unicode leader (L _ con) = hunk ./src/Haddock/Backends/LaTeX.hs 550 - case con_res con of - ResTyH98 -> case con_details con of + case con_res con of + ResTyH98 -> case con_details con of hunk ./src/Haddock/Backends/LaTeX.hs 553 - PrefixCon args -> - decltt (hsep ((header_ unicode <+> ppBinder occ) : + PrefixCon args -> + decltt (hsep ((header_ unicode <+> ppBinder occ) : hunk ./src/Haddock/Backends/LaTeX.hs 558 - RecCon fields -> + RecCon fields -> hunk ./src/Haddock/Backends/LaTeX.hs 564 - InfixCon arg1 arg2 -> - decltt (hsep [ header_ unicode <+> ppLParendType unicode arg1, - ppBinder occ, + InfixCon arg1 arg2 -> + decltt (hsep [ header_ unicode <+> ppLParendType unicode arg1, + ppBinder occ, hunk ./src/Haddock/Backends/LaTeX.hs 569 - + hunk ./src/Haddock/Backends/LaTeX.hs 576 - InfixCon arg1 arg2 -> doGADTCon [arg1, arg2] resTy + InfixCon arg1 arg2 -> doGADTCon [arg1, arg2] resTy hunk ./src/Haddock/Backends/LaTeX.hs 578 - where + where hunk ./src/Haddock/Backends/LaTeX.hs 659 - | otherwise = + | otherwise = hunk ./src/Haddock/Backends/LaTeX.hs 661 - (if tcdND decl == NewType then keyword "newtype" else keyword "data") <+> + (if tcdND decl == NewType then keyword "newtype" else keyword "data") <+> hunk ./src/Haddock/Backends/LaTeX.hs 675 -ppTyClBinderWithVars summ decl = +ppTyClBinderWithVars summ decl = hunk ./src/Haddock/Backends/LaTeX.hs 691 -ppAppDocNameNames _summ n ns = +ppAppDocNameNames _summ n ns = hunk ./src/Haddock/Backends/LaTeX.hs 708 --- Contexts +-- Contexts hunk ./src/Haddock/Backends/LaTeX.hs 751 -ppBang HsNoBang = empty +ppBang HsNoBang = empty hunk ./src/Haddock/Backends/LaTeX.hs 756 -tupleParens Unboxed = ubxParenList +tupleParens Unboxed = ubxParenList hunk ./src/Haddock/Backends/LaTeX.hs 759 --- Rendering of HsType --- +-- Rendering of HsType +-- hunk ./src/Haddock/Backends/LaTeX.hs 782 -ppLParendType unicode y = ppParendType unicode (unLoc y) +ppLParendType unicode y = ppParendType unicode (unLoc y) hunk ./src/Haddock/Backends/LaTeX.hs 787 -ppType unicode ty = ppr_mono_ty pREC_TOP ty unicode -ppParendType unicode ty = ppr_mono_ty pREC_CON ty unicode +ppType unicode ty = ppr_mono_ty pREC_TOP ty unicode +ppParendType unicode ty = ppr_mono_ty pREC_CON ty unicode hunk ./src/Haddock/Backends/LaTeX.hs 807 - forall_part = hsep (forallSymbol unicode : ppTyVars tvs) <> dot + forall_part = hsep (forallSymbol unicode : ppTyVars tvs) <> dot hunk ./src/Haddock/Backends/LaTeX.hs 811 -ppr_mono_lty ctxt_prec ty unicode = ppr_mono_ty ctxt_prec (unLoc ty) unicode +ppr_mono_lty ctxt_prec ty unicode = ppr_mono_ty ctxt_prec (unLoc ty) unicode hunk ./src/Haddock/Backends/LaTeX.hs 815 -ppr_mono_ty ctxt_prec (HsForAllTy expl tvs ctxt ty) unicode +ppr_mono_ty ctxt_prec (HsForAllTy expl tvs ctxt ty) unicode hunk ./src/Haddock/Backends/LaTeX.hs 836 -ppr_mono_ty ctxt_prec (HsAppTy fun_ty arg_ty) unicode +ppr_mono_ty ctxt_prec (HsAppTy fun_ty arg_ty) unicode hunk ./src/Haddock/Backends/LaTeX.hs 840 -ppr_mono_ty ctxt_prec (HsOpTy ty1 op ty2) unicode +ppr_mono_ty ctxt_prec (HsOpTy ty1 op ty2) unicode hunk ./src/Haddock/Backends/LaTeX.hs 847 -ppr_mono_ty ctxt_prec (HsParTy ty) unicode +ppr_mono_ty ctxt_prec (HsParTy ty) unicode hunk ./src/Haddock/Backends/LaTeX.hs 851 -ppr_mono_ty ctxt_prec (HsDocTy ty _) unicode +ppr_mono_ty ctxt_prec (HsDocTy ty _) unicode hunk ./src/Haddock/Backends/LaTeX.hs 855 -ppr_fun_ty :: Int -> LHsType DocName -> LHsType DocName -> Bool -> LaTeX +ppr_fun_ty :: Int -> LHsType DocName -> LHsType DocName -> Bool -> LaTeX hunk ./src/Haddock/Backends/LaTeX.hs 942 - markupEmpty = \_ -> empty, + markupEmpty = \_ -> empty, hunk ./src/Haddock/Backends/LaTeX.hs 954 - markupURL = \u _ -> text "\\url" <> braces (text u), - markupAName = \_ _ -> empty, + markupURL = \u _ -> text "\\url" <> braces (text u), + markupAName = \_ _ -> empty, hunk ./src/Haddock/Backends/LaTeX.hs 963 - markupId id v = + markupId id v = hunk ./src/Haddock/Backends/LaTeX.hs 1005 -latexStripTrailingWhitespace (DocParagraph p) = +latexStripTrailingWhitespace (DocParagraph p) = hunk ./src/Haddock/Backends/LaTeX.hs 1018 -itemizedList items = +itemizedList items = hunk ./src/Haddock/Backends/LaTeX.hs 1024 -enumeratedList items = +enumeratedList items = hunk ./src/Haddock/Backends/LaTeX.hs 1030 -descriptionList items = +descriptionList items = hunk ./tests/golden-tests/runtests.hs 60 - let base = mkDep "base" "4.2.0.1" - process = mkDep "process" "1.0.1.2" + let base = mkDep "base" "4.2.0.2" + process = mkDep "process" "1.0.1.3" hunk ./tests/golden-tests/tests/NoLayout.html.ref 100 ->the class C +>the class C hunk ./src/Haddock/Utils.hs 330 -spanWith p [] = ([],[]) +spanWith _ [] = ([],[]) hunk ./src/Haddock/Interface/AttachInstances.hs 41 + -- TODO: take an IfaceMap as input + ifaceMap = Map.fromList [ (ifaceMod i, i) | i <- ifaces ] + hunk ./src/Haddock/Interface/AttachInstances.hs 45 - newItems <- mapM attachExport $ ifaceExportItems iface + newItems <- mapM (attachToExportItem iface ifaceMap instIfaceMap) + (ifaceExportItems iface) hunk ./src/Haddock/Interface/AttachInstances.hs 48 - where - attachExport export@ExportDecl{expItemDecl = L _ (TyClD d)} = do - mb_info <- getAllInfo (unLoc (tcdLName d)) - return $ export { expItemInstances = case mb_info of - Just (_, _, instances) -> - let insts = map (first synifyInstHead) $ sortImage (first instHead) - [ (instanceHead i, getName i) | i <- instances ] - in [ (inst, lookupInstDoc name iface instIfaceMap) - | (inst, name) <- insts ] - Nothing -> [] + + +attachToExportItem :: Interface -> IfaceMap -> InstIfaceMap -> ExportItem Name -> Ghc (ExportItem Name) +attachToExportItem iface ifaceMap instIfaceMap export = + case export of + ExportDecl { expItemDecl = L _ (TyClD d) } -> do + mb_info <- getAllInfo (unLoc (tcdLName d)) + let export' = + export { + expItemInstances = + case mb_info of + Just (_, _, instances) -> + let insts = map (first synifyInstHead) $ sortImage (first instHead) + [ (instanceHead i, getName i) | i <- instances ] + in [ (inst, lookupInstDoc name iface ifaceMap instIfaceMap) + | (inst, name) <- insts ] + Nothing -> [] hunk ./src/Haddock/Interface/AttachInstances.hs 66 - attachExport export = return export + return export' + _ -> return export hunk ./src/Haddock/Interface/AttachInstances.hs 70 -lookupInstDoc :: Name -> Interface -> InstIfaceMap -> Maybe (Doc Name) +lookupInstDoc :: Name -> Interface -> IfaceMap -> InstIfaceMap -> Maybe (Doc Name) hunk ./src/Haddock/Interface/AttachInstances.hs 73 -lookupInstDoc name iface ifaceMap = +lookupInstDoc name iface ifaceMap instIfaceMap = hunk ./src/Haddock/Interface/AttachInstances.hs 76 - Nothing -> do -- in Maybe - instIface <- Map.lookup modName ifaceMap - (Just doc, _) <- Map.lookup name (instDocMap instIface) - return doc + Nothing -> + case Map.lookup modName ifaceMap of + Just iface2 -> + case Map.lookup name (ifaceInstanceDocMap iface2) of + Just doc -> Just doc + Nothing -> Nothing + Nothing -> + case Map.lookup modName instIfaceMap of + Just instIface -> + case Map.lookup name (instDocMap instIface) of + Just (doc, _) -> doc + Nothing -> Nothing + Nothing -> Nothing hunk ./haddock.cabal 188 + Haddock.Backends.LaTeX hunk ./src/Haddock/Backends/Xhtml/Decl.hs 13 + hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 13 + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 13 + hunk ./src/Haddock/Backends/Xhtml/Names.hs 13 + hunk ./src/Haddock/Backends/Xhtml/Types.hs 13 + hunk ./src/Haddock/Backends/Xhtml/Util.hs 13 + hunk ./html/xhaddock.css 52 +ul, ol, dl { + padding-top: 2px; + padding-left: 3em; + margin-bottom: 1em; +} + hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 31 - markupParagraph = paragraph, - markupEmpty = toHtml "", + markupEmpty = noHtml, hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 33 + markupParagraph = paragraph, hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 36 - markupModule = \m -> let (mdl,ref) = break (=='#') m in ppModule (mkModuleNoPackage mdl) ref, - markupEmphasis = emphasize . toHtml, - markupMonospaced = tt . toHtml, - markupUnorderedList = ulist . concatHtml . map (li <<), - markupPic = \path -> image ! [src path], - markupOrderedList = olist . concatHtml . map (li <<), - markupDefList = dlist . concatHtml . map markupDef, + markupModule = \m -> let (mdl,ref) = break (=='#') m + in ppModule (mkModuleNoPackage mdl) ref, + markupEmphasis = emphasize, + markupMonospaced = tt, + markupUnorderedList = unordList, + markupOrderedList = ordList, + markupDefList = defList, hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 45 - markupAName = \aname -> namedAnchor aname << toHtml "", - markupExample = examplesToHtml + markupAName = \aname -> namedAnchor aname << toHtml "" hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 68 -markupDef :: (HTML a, HTML b) => (a, b) -> Html -markupDef (a,b) = dterm << a +++ ddef << b - - -htmlMarkup :: DocMarkup DocName Html -htmlMarkup = parHtmlMarkup ppDocName (isTyConName . getName) - -htmlOrigMarkup :: DocMarkup Name Html -htmlOrigMarkup = parHtmlMarkup ppName isTyConName - -htmlRdrMarkup :: DocMarkup RdrName Html -htmlRdrMarkup = parHtmlMarkup ppRdrName isRdrTc hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 70 --- ugly extra whitespace with some browsers). +-- ugly extra whitespace with some browsers). FIXME: Does this still apply? hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 72 -docToHtml doc = markup htmlMarkup (markup htmlCleanup doc) +docToHtml = markup fmt . cleanup + where fmt = parHtmlMarkup ppDocName (isTyConName . getName) hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 76 -origDocToHtml doc = markup htmlOrigMarkup (markup htmlCleanup doc) +origDocToHtml = markup fmt . cleanup + where fmt = parHtmlMarkup ppName isTyConName hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 80 -rdrDocToHtml doc = markup htmlRdrMarkup (markup htmlCleanup doc) +rdrDocToHtml = markup fmt . cleanup + where fmt = parHtmlMarkup ppRdrName isRdrTc + hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 84 --- If there is a single paragraph, then surrounding it with

..

--- can add too much whitespace in some browsers (eg. IE). However if --- we have multiple paragraphs, then we want the extra whitespace to --- separate them. So we catch the single paragraph case and transform it --- here. -unParagraph :: Doc a -> Doc a -unParagraph (DocParagraph d) = d ---NO: This eliminates line breaks in the code block: (SDM, 6/5/2003) ---unParagraph (DocCodeBlock d) = (DocMonospaced d) -unParagraph doc = doc hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 85 -htmlCleanup :: DocMarkup a (Doc a) -htmlCleanup = idMarkup { - markupUnorderedList = DocUnorderedList . map unParagraph, - markupOrderedList = DocOrderedList . map unParagraph - } +cleanup :: Doc a -> Doc a +cleanup = markup fmtUnParagraphLists + where + -- If there is a single paragraph, then surrounding it with

..

+ -- can add too much whitespace in some browsers (eg. IE). However if + -- we have multiple paragraphs, then we want the extra whitespace to + -- separate them. So we catch the single paragraph case and transform it + -- here. We don't do this in code blocks as it eliminates line breaks. + unParagraph :: Doc a -> Doc a + unParagraph (DocParagraph d) = d + unParagraph doc = doc + + fmtUnParagraphLists :: DocMarkup a (Doc a) + fmtUnParagraphLists = idMarkup { + markupUnorderedList = DocUnorderedList . map unParagraph, + markupOrderedList = DocOrderedList . map unParagraph + } hunk ./src/Haddock/Backends/Xhtml/Util.hs 73 --- renderToString = showHtml -- for production -renderToString = prettyHtml -- for debugging +renderToString = showHtml -- for production +--renderToString = prettyHtml -- for debugging hunk ./html/xhaddock.css 54 - padding-left: 3em; + padding-left: 10px; + margin-left: 2.5em; hunk ./html/xhaddock.css 150 + margin-left: 10px; hunk ./html/xhaddock.css 154 -div.table-of-contents ul ul { - margin-left: 2.5em; -} - hunk ./html/xhaddock.css 157 + margin-left: 10px; hunk ./html/xhaddock.css 166 - margin-left: 10px; hunk ./src/Haddock/Backends/Xhtml.hs 297 - docBox (rdrDocToHtml doc) + (tda [theclass "doc"] << (rdrDocToHtml doc)) hunk ./src/Haddock/Backends/Xhtml.hs 739 - = Right $ ppDecl' summary links decl doc insts subdocs unicode + = Right $ ppDecl summary links decl doc insts subdocs unicode hunk ./src/Haddock/Backends/Xhtml/Decl.hs 36 -ppDecl' :: Bool -> LinksInfo -> LHsDecl DocName -> - DocForDecl DocName -> [DocInstance DocName] -> [(DocName, DocForDecl DocName)] -> Bool -> Html -ppDecl' s k l m i d u = vanillaTable << ppDecl s k l m i d u - hunk ./src/Haddock/Backends/Xhtml/Decl.hs 37 - DocForDecl DocName -> [DocInstance DocName] -> [(DocName, DocForDecl DocName)] -> Bool -> HtmlTable + DocForDecl DocName -> [DocInstance DocName] -> [(DocName, DocForDecl DocName)] -> Bool -> Html hunk ./src/Haddock/Backends/Xhtml/Decl.hs 49 - InstD _ -> emptyTable + InstD _ -> noHtml hunk ./src/Haddock/Backends/Xhtml/Decl.hs 53 - DocName -> HsType DocName -> Bool -> HtmlTable + DocName -> HsType DocName -> Bool -> Html hunk ./src/Haddock/Backends/Xhtml/Decl.hs 61 - DocForDecl DocName -> (Html, Html, Html) -> Bool -> HtmlTable + DocForDecl DocName -> (Html, Html, Html) -> Bool -> Html hunk ./src/Haddock/Backends/Xhtml/Decl.hs 64 - | otherwise = topDeclBox links loc docname pref2 - (tda [theclass "body"] << vanillaTable << ( + | otherwise = topDeclElem links loc docname pref2 +++ + (vanillaTable << ( hunk ./src/Haddock/Backends/Xhtml/Decl.hs 109 -ppFor :: Bool -> LinksInfo -> SrcSpan -> DocForDecl DocName -> ForeignDecl DocName -> Bool -> HtmlTable +ppFor :: Bool -> LinksInfo -> SrcSpan -> DocForDecl DocName -> ForeignDecl DocName -> Bool -> Html hunk ./src/Haddock/Backends/Xhtml/Decl.hs 116 -ppTySyn :: Bool -> LinksInfo -> SrcSpan -> DocForDecl DocName -> TyClDecl DocName -> Bool -> HtmlTable +ppTySyn :: Bool -> LinksInfo -> SrcSpan -> DocForDecl DocName -> TyClDecl DocName -> Bool -> Html hunk ./src/Haddock/Backends/Xhtml/Decl.hs 162 - TyClDecl DocName -> Bool -> HtmlTable + TyClDecl DocName -> Bool -> Html hunk ./src/Haddock/Backends/Xhtml/Decl.hs 166 - (ppTyFamHeader True associated decl unicode) - - | associated, isJust mbDoc = header_ bodyBox << doc - | associated = header_ - | null instances, isJust mbDoc = header_ bodyBox << doc - | null instances = header_ - | isJust mbDoc = header_ bodyBox << (doc instancesBit) - | otherwise = header_ bodyBox << instancesBit + (ppTyFamHeader True associated decl unicode) + | otherwise = header_ +++ maybeDocToHtml mbDoc +++ instancesBit hunk ./src/Haddock/Backends/Xhtml/Decl.hs 172 - header_ = topDeclBox links loc docname (ppTyFamHeader summary associated decl unicode) - - doc = ndocBox . docToHtml . fromJust $ mbDoc + header_ = topDeclElem links loc docname (ppTyFamHeader summary associated decl unicode) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 176 - instancesBit = instHdr instId + instancesBit + | associated || null instances = noHtml + | otherwise = vanillaTable << ( + instHdr instId hunk ./src/Haddock/Backends/Xhtml/Decl.hs 186 + ) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 215 - TyClDecl DocName -> Bool -> HtmlTable + TyClDecl DocName -> Bool -> Html hunk ./src/Haddock/Backends/Xhtml/Decl.hs 220 - - | isJust mbDoc = header_ bodyBox << doc - | otherwise = header_ + | otherwise = header_ +++ maybeDocToHtml mbDoc hunk ./src/Haddock/Backends/Xhtml/Decl.hs 225 - header_ = topDeclBox links loc docname (ppTyInstHeader summary associated decl unicode) - - doc = case mbDoc of - Just d -> ndocBox (docToHtml d) - Nothing -> emptyTable + header_ = topDeclElem links loc docname (ppTyInstHeader summary associated decl unicode) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 241 -ppAssocType :: Bool -> LinksInfo -> DocForDecl DocName -> LTyClDecl DocName -> Bool -> HtmlTable +ppAssocType :: Bool -> LinksInfo -> DocForDecl DocName -> LTyClDecl DocName -> Bool -> Html hunk ./src/Haddock/Backends/Xhtml/Decl.hs 348 -ppShortClassDecl :: Bool -> LinksInfo -> TyClDecl DocName -> SrcSpan -> [(DocName, DocForDecl DocName)] -> Bool -> HtmlTable +ppShortClassDecl :: Bool -> LinksInfo -> TyClDecl DocName -> SrcSpan -> [(DocName, DocForDecl DocName)] -> Bool -> Html hunk ./src/Haddock/Backends/Xhtml/Decl.hs 351 - then (if summary then declBox else topDeclBox links loc nm) hdr - else (if summary then declBox else topDeclBox links loc nm) (hdr <+> keyword "where") - + then (if summary then declElem else topDeclElem links loc nm) hdr + else (if summary then declElem else topDeclElem links loc nm) (hdr <+> keyword "where") + +++ vanillaTable << hunk ./src/Haddock/Backends/Xhtml/Decl.hs 355 - bodyBox << - aboves - ( - [ ppAssocType summary links doc at unicode | at <- ats - , let doc = lookupAnySubdoc (tcdName $ unL at) subdocs ] ++ + bodyBox << aboves + ( + [ ppAssocType summary links doc at unicode | at <- ats + , let doc = lookupAnySubdoc (tcdName $ unL at) subdocs ] ++ hunk ./src/Haddock/Backends/Xhtml/Decl.hs 360 - [ ppFunSig summary links loc doc n typ unicode - | L _ (TypeSig (L _ n) (L _ typ)) <- sigs - , let doc = lookupAnySubdoc n subdocs ] - ) - ) + [ ppFunSig summary links loc doc n typ unicode + | L _ (TypeSig (L _ n) (L _ typ)) <- sigs + , let doc = lookupAnySubdoc n subdocs ] + ) + ) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 374 - -> TyClDecl DocName -> Bool -> HtmlTable + -> TyClDecl DocName -> Bool -> Html hunk ./src/Haddock/Backends/Xhtml/Decl.hs 376 - decl@(ClassDecl lctxt lname ltyvars lfds lsigs _ ats _) unicode + decl@(ClassDecl lctxt lname ltyvars lfds lsigs _ _ _) unicode hunk ./src/Haddock/Backends/Xhtml/Decl.hs 378 - | otherwise = classheader bodyBox << (classdoc body_ instancesBit) + | otherwise = classheader +++ maybeDocToHtml mbDoc +++ instancesBit hunk ./src/Haddock/Backends/Xhtml/Decl.hs 381 - | null lsigs = topDeclBox links loc nm (hdr unicode) - | otherwise = topDeclBox links loc nm (hdr unicode <+> keyword "where") + | null lsigs = topDeclElem links loc nm (hdr unicode) + | otherwise = topDeclElem links loc nm (hdr unicode <+> keyword "where") hunk ./src/Haddock/Backends/Xhtml/Decl.hs 387 - - classdoc = case mbDoc of - Nothing -> emptyTable - Just d -> ndocBox (docToHtml d) - - body_ - | null lsigs, null ats = emptyTable - | null ats = s8 methHdr bodyBox << methodTable - | otherwise = s8 atHdr bodyBox << atTable - s8 methHdr bodyBox << methodTable - - methodTable = - abovesSep s8 [ ppFunSig summary links loc doc n typ unicode - | L _ (TypeSig (L _ n) (L _ typ)) <- lsigs - , let doc = lookupAnySubdoc n subdocs ] - - atTable = abovesSep s8 $ [ ppAssocType summary links doc at unicode | at <- ats - , let doc = lookupAnySubdoc (tcdName $ unL at) subdocs ] - + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 390 - | null instances = emptyTable - | otherwise - = s8 instHdr instId + | null instances = noHtml + | otherwise = vanillaTable << ( + instHdr instId hunk ./src/Haddock/Backends/Xhtml/Decl.hs 397 + ) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 450 - (if summary then declBox else topDeclBox links loc docname) + (if summary then declElem else topDeclElem links loc docname) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 454 - doConstr c con = declBox (toHtml [c] <+> ppShortConstr summary (unLoc con) unicode) - doGADTConstr con = declBox (ppShortConstr summary (unLoc con) unicode) + doConstr c con = declElem (toHtml [c] <+> ppShortConstr summary (unLoc con) unicode) + doGADTConstr con = declElem (ppShortConstr summary (unLoc con) unicode) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 463 - SrcSpan -> Maybe (Doc DocName) -> TyClDecl DocName -> Bool -> HtmlTable + SrcSpan -> Maybe (Doc DocName) -> TyClDecl DocName -> Bool -> Html hunk ./src/Haddock/Backends/Xhtml/Decl.hs 470 - = (if validTable then () else const) header_ $ - tda [theclass "body"] << vanillaTable << ( - datadoc - constrBit - instancesBit - ) - + = header_ +++ datadoc +++ constrBit +++ instancesBit hunk ./src/Haddock/Backends/Xhtml/Decl.hs 477 - header_ = topDeclBox links loc docname (ppDataHeader summary dataDecl unicode + header_ = topDeclElem links loc docname (ppDataHeader summary dataDecl unicode hunk ./src/Haddock/Backends/Xhtml/Decl.hs 513 - validTable = isJust mbDoc || not (null cons) || not (null instances) - hunk ./src/Haddock/Backends/Xhtml/Decl.hs 645 - where hdr = declBox (ppHsConstrHdr tvs ctxt +++ ppHsBinder False nm) + where hdr = declElem (ppHsConstrHdr tvs ctxt +++ ppHsBinder False nm) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 648 - | isJust doc = docBox (docToHtml (fromJust doc)) + | isJust doc = docElem (docToHtml (fromJust doc)) hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 83 - +maybeDocToHtml :: Maybe (Doc DocName) -> Html +maybeDocToHtml = maybe noHtml docToHtml hunk ./src/Haddock/Backends/Xhtml/Layout.hs 27 -declWithDoc :: Bool -> LinksInfo -> SrcSpan -> DocName -> Maybe (Doc DocName) -> Html -> HtmlTable -declWithDoc True _ _ _ _ html_decl = declBox html_decl -declWithDoc False links loc nm Nothing html_decl = topDeclBox links loc nm html_decl -declWithDoc False links loc nm (Just doc) html_decl = - topDeclBox links loc nm html_decl docBox (docToHtml doc) - +declWithDoc :: Bool -> LinksInfo -> SrcSpan -> DocName -> Maybe (Doc DocName) -> Html -> Html +declWithDoc True _ _ _ _ html_decl = declElem html_decl +declWithDoc False links loc nm doc html_decl = + topDeclElem links loc nm html_decl +++ maybeDocToHtml doc hunk ./src/Haddock/Backends/Xhtml/Layout.hs 39 -declBox :: Html -> HtmlTable -declBox html = tda [theclass "decl"] << html +declElem :: Html -> Html +declElem = paragraph ! [theclass "decl"] hunk ./src/Haddock/Backends/Xhtml/Layout.hs 44 -topDeclBox :: LinksInfo -> SrcSpan -> DocName -> Html -> HtmlTable -topDeclBox ((_,_,Nothing), (_,_,Nothing)) _ _ html = declBox html -topDeclBox ((_,_,maybe_source_url), (_,_,maybe_wiki_url)) - loc name html = - tda [theclass "topdecl"] << - ( table ! [theclass "declbar"] << - ((tda [theclass "declname"] << html) - <-> srcLink - <-> wikiLink) - ) +topDeclElem :: LinksInfo -> SrcSpan -> DocName -> Html -> Html +topDeclElem ((_,_,maybe_source_url), (_,_,maybe_wiki_url)) loc name html = + declElem << (html +++ srcLink +++ wikiLink) hunk ./src/Haddock/Backends/Xhtml/Layout.hs 49 - Nothing -> emptyTable - Just url -> tda [theclass "declbut"] << - let url' = spliceURL (Just fname) (Just origMod) + Nothing -> noHtml + Just url -> let url' = spliceURL (Just fname) (Just origMod) hunk ./src/Haddock/Backends/Xhtml/Layout.hs 52 - in anchor ! [href url'] << toHtml "Source" + in anchor ! [href url', theclass "link"] << "Source" hunk ./src/Haddock/Backends/Xhtml/Layout.hs 56 - Nothing -> emptyTable - Just url -> tda [theclass "declbut"] << - let url' = spliceURL (Just fname) (Just mdl) + Nothing -> noHtml + Just url -> let url' = spliceURL (Just fname) (Just mdl) hunk ./src/Haddock/Backends/Xhtml/Layout.hs 59 - in anchor ! [href url'] << toHtml "Comments" + in anchor ! [href url', theclass "link"] << "Comments" hunk ./src/Haddock/Backends/Xhtml/Layout.hs 73 + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 80 --- a box for displaying documentation, --- indented and with a little padding at the top -docBox :: Html -> HtmlTable -docBox html = tda [theclass "doc"] << html hunk ./src/Haddock/Backends/Xhtml.hs 43 -import Data.Either hunk ./src/Haddock/Backends/Xhtml.hs 630 - rights $ - map (processExport True linksInfo unicode) exports + mapMaybe (processExport True linksInfo unicode) exports hunk ./src/Haddock/Backends/Xhtml.hs 643 - map (either id (paragraph ! [theclass "decl"] <<)) $ - map (processExport False linksInfo unicode) exports + map (thediv ! [theclass "decldoc"]) $ + mapMaybe (processExport False linksInfo unicode) exports hunk ./src/Haddock/Backends/Xhtml.hs 732 -processExport :: Bool -> LinksInfo -> Bool -> (ExportItem DocName) - -> Either Html Html -- Right is a decl, Left is a "extra" (doc or group) -processExport _ _ _ (ExportGroup lev id0 doc) - = Left $ groupTag lev << namedAnchor id0 << docToHtml doc +processExport :: Bool -> LinksInfo -> Bool -> (ExportItem DocName) -> Maybe Html +processExport summary _ _ (ExportGroup lev id0 doc) + = nothingIf summary $ groupTag lev << namedAnchor id0 << docToHtml doc hunk ./src/Haddock/Backends/Xhtml.hs 736 - = Right $ ppDecl summary links decl doc insts subdocs unicode + = Just $ ppDecl summary links decl doc insts subdocs unicode hunk ./src/Haddock/Backends/Xhtml.hs 738 - = Right $ ppDocName y + = Just $ ppDocName y hunk ./src/Haddock/Backends/Xhtml.hs 740 - = Right $ ppDocName y +++ parenList (map ppDocName subs) -processExport _ _ _ (ExportDoc doc) - = Left $ docToHtml doc + = Just $ ppDocName y +++ parenList (map ppDocName subs) +processExport summary _ _ (ExportDoc doc) + = nothingIf summary $ docToHtml doc hunk ./src/Haddock/Backends/Xhtml.hs 744 - = Right $ toHtml "module" +++ ppModule mdl "" + = Just $ toHtml "module" +++ ppModule mdl "" + +nothingIf :: Bool -> a -> Maybe a +nothingIf True _ = Nothing +nothingIf False a = Just a hunk ./src/Haddock/Backends/Xhtml/Decl.hs 436 - | otherwise = vanillaTable << ( + | otherwise = foldl (+++) dataHeader $ hunk ./src/Haddock/Backends/Xhtml/Decl.hs 438 - ResTyH98 -> dataHeader - tda [theclass "body"] << vanillaTable << ( - aboves (zipWith doConstr ('=':repeat '|') cons) - ) - ResTyGADT _ -> dataHeader - tda [theclass "body"] << vanillaTable << ( - aboves (map doGADTConstr cons) - ) - ) + ResTyH98 -> zipWith doConstr ('=':repeat '|') cons + ResTyGADT _ -> map doGADTConstr cons hunk ./src/Haddock/Backends/Xhtml/Decl.hs 624 -{- -ppHsFullConstr :: HsConDecl -> Html -ppHsFullConstr (HsConDecl _ nm tvs ctxt typeList doc) = - declWithDoc False doc ( - hsep ((ppHsConstrHdr tvs ctxt +++ - ppHsBinder False nm) : map ppHsBangType typeList) - ) -ppHsFullConstr (HsRecDecl _ nm tvs ctxt fields doc) = - td << vanillaTable << ( - case doc of - Nothing -> aboves [hdr, fields_html] - Just _ -> aboves [hdr, constr_doc, fields_html] - ) - - where hdr = declElem (ppHsConstrHdr tvs ctxt +++ ppHsBinder False nm) - - constr_doc - | isJust doc = docElem (docToHtml (fromJust doc)) - | otherwise = emptyTable - - fields_html = - td << - table ! [width "100%", cellpadding 0, cellspacing 8] << ( - aboves (map ppFullField (concat (map expandField fields))) - ) --} hunk ./src/Haddock/Backends/Xhtml/Decl.hs 632 -{- -ppFullField :: HsFieldDecl -> Html -ppFullField (HsFieldDecl [n] ty doc) - = declWithDoc False doc ( - ppHsBinder False n <+> dcolon <+> ppHsBangType ty - ) -ppFullField _ = error "ppFullField" - -expandField :: HsFieldDecl -> [HsFieldDecl] -expandField (HsFieldDecl ns ty doc) = [ HsFieldDecl [n] ty doc | n <- ns ] --} hunk ./src/Haddock/Backends/Xhtml/Decl.hs 655 -{- -ppForAll Implicit _ lctxt = ppCtxtPart lctxt -ppForAll Explicit ltvs lctxt = - hsep (keyword "forall" : ppTyVars ltvs ++ [dot]) <+> ppCtxtPart lctxt --} - - hunk ./src/Haddock/Backends/Xhtml/Decl.hs 664 -{- -ppType :: HsType DocName -> Html -ppType t = case t of - t@(HsForAllTy expl ltvs lcontext ltype) -> ppForAllTy t <+> ppLType ltype - HsTyVar n -> ppDocName n - HsBangTy HsStrict lt -> toHtml "!" <+> ppLType lt - HsBangTy HsUnbox lt -> toHtml "!!" <+> ppLType lt - HsAppTy a b -> ppLType a <+> ppLType b - HsFunTy a b -> hsep [ppLType a, toHtml "->", ppLType b] - HsListTy t -> brackets $ ppLType t - HsPArrTy t -> toHtml "[:" +++ ppLType t +++ toHtml ":]" - HsTupleTy Boxed ts -> parenList $ map ppLType ts - HsTupleTy Unboxed ts -> ubxParenList $ map ppLType ts - HsOpTy a n b -> ppLType a <+> ppLDocName n <+> ppLType b - HsParTy t -> parens $ ppLType t - HsNumTy n -> toHtml (show n) - HsPredTy p -> ppPred p - HsKindSig t k -> hsep [ppLType t, dcolon, ppKind k] - HsSpliceTy _ -> error "ppType" - HsDocTy t _ -> ppLType t --} hunk ./src/Haddock/Backends/Xhtml/Decl.hs 63 - | summary || Map.null argDocs = declWithDoc summary links loc docname doc pref1 + | summary = declElem pref1 + | Map.null argDocs = topDeclElem links loc docname pref1 +++ maybeDocToHtml doc hunk ./src/Haddock/Backends/Xhtml/Decl.hs 166 - | summary = declWithDoc summary links loc docname mbDoc - (ppTyFamHeader True associated decl unicode) + | summary = declElem (ppTyFamHeader True associated decl unicode) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 218 - | summary = declWithDoc summary links loc docname mbDoc - (ppTyInstHeader True associated decl unicode) + | summary = declElem(ppTyInstHeader True associated decl unicode) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 427 -ppShortDataDecl summary links loc dataDecl unicode +ppShortDataDecl summary _links _loc dataDecl unicode hunk ./src/Haddock/Backends/Xhtml/Decl.hs 429 - | [lcon] <- cons, ResTyH98 <- resTy = - ppDataHeader summary dataDecl unicode - <+> equals <+> ppShortConstr summary (unLoc lcon) unicode + | [] <- cons = declElem dataHeader hunk ./src/Haddock/Backends/Xhtml/Decl.hs 431 - | [] <- cons = ppDataHeader summary dataDecl unicode + | [lcon] <- cons, ResTyH98 <- resTy = declElem $ + dataHeader <+> equals <+> ppShortConstr summary (unLoc lcon) unicode hunk ./src/Haddock/Backends/Xhtml/Decl.hs 434 - | otherwise = foldl (+++) dataHeader $ - case resTy of - ResTyH98 -> zipWith doConstr ('=':repeat '|') cons - ResTyGADT _ -> map doGADTConstr cons - - where - dataHeader = - (if summary then declElem else topDeclElem links loc docname) - ((ppDataHeader summary dataDecl unicode) <+> - case resTy of ResTyGADT _ -> keyword "where"; _ -> empty) + | ResTyH98 <- resTy = declElem dataHeader + +++ unordList (zipWith doConstr ('=':repeat '|') cons) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 437 + | otherwise = declElem (dataHeader <+> keyword "where") + +++ unordList (map doGADTConstr cons) + + where + dataHeader = ppDataHeader summary dataDecl unicode hunk ./src/Haddock/Backends/Xhtml/Decl.hs 445 - docname = unLoc . tcdLName $ dataDecl hunk ./src/Haddock/Backends/Xhtml/Decl.hs 453 - | summary = declWithDoc summary links loc docname mbDoc - (ppShortDataDecl summary links loc dataDecl unicode) - - | otherwise - = header_ +++ datadoc +++ constrBit +++ instancesBit + | summary = ppShortDataDecl summary links loc dataDecl unicode + | otherwise = header_ +++ datadoc +++ constrBit +++ instancesBit hunk ./src/Haddock/Backends/Xhtml/Layout.hs 27 -declWithDoc :: Bool -> LinksInfo -> SrcSpan -> DocName -> Maybe (Doc DocName) -> Html -> Html -declWithDoc True _ _ _ _ html_decl = declElem html_decl -declWithDoc False links loc nm doc html_decl = - topDeclElem links loc nm html_decl +++ maybeDocToHtml doc - - -{- -text :: Html -text = strAttr "TEXT" --} - hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 44 - markupURL = \url -> anchor ! [href url] << toHtml url, - markupAName = \aname -> namedAnchor aname << toHtml "" + markupURL = \url -> anchor ! [href url] << url, + markupAName = \aname -> namedAnchor aname << "", + markupPic = \path -> image ! [src path], + markupExample = examplesToHtml hunk ./src/Haddock/Backends/Xhtml/Decl.hs 431 - | [lcon] <- cons, ResTyH98 <- resTy = declElem $ - dataHeader <+> equals <+> ppShortConstr summary (unLoc lcon) unicode + | [lcon] <- cons, ResTyH98 <- resTy = declElem (dataHeader <+> equals) + <+> ppShortConstr summary (unLoc lcon) unicode hunk ./src/Haddock/Backends/Xhtml/Decl.hs 442 - doConstr c con = declElem (toHtml [c] <+> ppShortConstr summary (unLoc con) unicode) - doGADTConstr con = declElem (ppShortConstr summary (unLoc con) unicode) + doConstr c con = toHtml [c] <+> ppShortConstr summary (unLoc con) unicode + doGADTConstr con = ppShortConstr summary (unLoc con) unicode hunk ./src/Haddock/Backends/Xhtml/Decl.hs 528 - doRecordFields fields = braces (vanillaTable << - aboves (map (ppShortField summary unicode) fields)) + doRecordFields fields = braces $ unordList (map (ppShortField summary unicode) fields) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 615 -ppShortField :: Bool -> Bool -> ConDeclField DocName -> HtmlTable +ppShortField :: Bool -> Bool -> ConDeclField DocName -> Html hunk ./src/Haddock/Backends/Xhtml/Decl.hs 617 - = tda [theclass "recfield"] << ( - ppBinder summary (docNameOcc name) - <+> dcolon unicode <+> ppLType unicode ltype - ) + = ppBinder summary (docNameOcc name) + <+> dcolon unicode <+> ppLType unicode ltype hunk ./src/Haddock/Backends/Xhtml/Decl.hs 178 - | otherwise = vanillaTable << ( - instHdr instId - tda [theclass "body"] << - collapsed thediv instId ( - spacedTable1 << ( - aboves (map (ppDocInstance unicode) instances) - ) + | otherwise = + instHdr instId +++ + collapsed thediv instId ( + spacedTable1 << ( + aboves (map (ppDocInstance unicode) instances) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 388 - | otherwise = vanillaTable << ( - instHdr instId - tda [theclass "body"] << - collapsed thediv instId ( - spacedTable1 << aboves (map (ppDocInstance unicode) instances) - ) - ) + | otherwise = + instHdr instId +++ + collapsed thediv instId ( + spacedTable1 << aboves (map (ppDocInstance unicode) instances) + ) + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 451 - | otherwise = header_ +++ datadoc +++ constrBit +++ instancesBit + | otherwise = header_ +++ maybeDocToHtml mbDoc +++ constrBit +++ instancesBit hunk ./src/Haddock/Backends/Xhtml/Decl.hs 471 - datadoc = case mbDoc of - Just doc -> ndocBox (docToHtml doc) - Nothing -> emptyTable - hunk ./src/Haddock/Backends/Xhtml/Decl.hs 472 - | null cons = emptyTable - | otherwise = constrHdr ( - tda [theclass "body"] << constrTable << + | null cons = noHtml + | otherwise = constrHdr +++ ( + constrTable << hunk ./src/Haddock/Backends/Xhtml/Decl.hs 481 - | null instances = emptyTable + | null instances = noHtml hunk ./src/Haddock/Backends/Xhtml/Decl.hs 483 - = instHdr instId - tda [theclass "body"] << + = instHdr instId +++ hunk ./src/Haddock/Backends/Xhtml/Layout.hs 95 -constrHdr, methHdr, atHdr :: HtmlTable -constrHdr = tda [ theclass "section4" ] << toHtml "Constructors" -methHdr = tda [ theclass "section4" ] << toHtml "Methods" -atHdr = tda [ theclass "section4" ] << toHtml "Associated Types" +constrHdr, methHdr, atHdr :: Html +constrHdr = h5 << "Constructors" +methHdr = h5 << "Methods" +atHdr = h5 << "Associated Types" hunk ./src/Haddock/Backends/Xhtml/Layout.hs 100 -instHdr :: String -> HtmlTable +instHdr :: String -> Html hunk ./src/Haddock/Backends/Xhtml/Layout.hs 102 - tda [ theclass "section4" ] << (collapsebutton id_ +++ toHtml " Instances") + h5 << (collapsebutton id_ +++ toHtml " Instances") hunk ./src/Haddock/Backends/Xhtml/Decl.hs 350 - +++ vanillaTable << - ( - bodyBox << aboves + +++ vanillaTable << aboves hunk ./src/Haddock/Backends/Xhtml/Decl.hs 352 - [ ppAssocType summary links doc at unicode | at <- ats + [ argBox $ ppAssocType summary links doc at unicode | at <- ats hunk ./src/Haddock/Backends/Xhtml/Decl.hs 355 - [ ppFunSig summary links loc doc n typ unicode + [ argBox $ ppFunSig summary links loc doc n typ unicode hunk ./src/Haddock/Backends/Xhtml/Decl.hs 359 - ) hunk ./src/Haddock/Backends/Xhtml/Layout.hs 83 -bodyBox :: Html -> HtmlTable -bodyBox html = tda [theclass "body"] << vanillaTable << html - hunk ./src/Haddock/Backends/Xhtml.hs 569 - -- XXX: quoting errors possible? - << ("window.onload = function () {setSynopsis(\"mini_" - ++ moduleHtmlFile mdl ++ "\")};")) + -- NB: Within XHTML, the content of script tags needs to be + -- a CDATA section. Will break if the generated name could + -- have "]]>" in it! + << primHtml ( + "//\n") + ) hunk ./html/xhaddock.css 41 -h4 { +h4, h5 { hunk ./html/xhaddock.css 65 -h1 + p, h2 + p, h3 + p, h4 + p { +h2 + p, h3 + p, h4 + p { hunk ./html/xhaddock.css 155 - margin-top: 1em; - margin-bottom: 1em; - margin-left: 10px; + margin-left: 0px; hunk ./html/xhaddock.css 167 +ul.synopsis li ul { + margin: 0; + padding-top: 0; +} + +ul.synopsis li ul li { + margin: 0; + padding: 0; +} + + +div.decldoc { + margin-top: 1em; +} + +div.decldoc h5 { + margin-left: 10px; +} + +div.decldoc table { + margin-left: 20px; +} hunk ./html/xhaddock.css 242 +td.arg { + padding: 3px; + background-color: #f0f0f0; + font-family: monospace; + margin-bottom: 0; +} + +td.rdoc p { + margin-bottom: 0; +} + hunk ./html/xhaddock.css 258 - padding: 5px + padding: 4px hunk ./html/xhaddock.css 260 + +div.bottom p { + margin-bottom: 0; +} + hunk ./html/xhaddock.css 186 -div.decldoc table { +div.decldoc table, div.subdecl { hunk ./src/Haddock/Backends/Xhtml/Decl.hs 370 - decl@(ClassDecl lctxt lname ltyvars lfds lsigs _ _ _) unicode + decl@(ClassDecl lctxt lname ltyvars lfds lsigs _ ats _) unicode hunk ./src/Haddock/Backends/Xhtml/Decl.hs 372 - | otherwise = classheader +++ maybeDocToHtml mbDoc +++ instancesBit + | otherwise = classheader +++ maybeDocToHtml mbDoc + +++ atBit +++ methodBit +++ instancesBit hunk ./src/Haddock/Backends/Xhtml/Decl.hs 382 - + + atBit + | null ats = noHtml + | otherwise = atHdr +++ ( + thediv ! [theclass "subdecl"] << + concatHtml [ ppAssocType summary links doc at unicode + | at <- ats + , let doc = lookupAnySubdoc (tcdName $ unL at) subdocs ] + ) + + methodBit + | null lsigs = noHtml + | otherwise = methHdr +++ ( + thediv ! [theclass "subdecl"] << + concatHtml [ ppFunSig summary links loc doc n typ unicode + | L _ (TypeSig (L _ n) (L _ typ)) <- lsigs + , let doc = lookupAnySubdoc n subdocs ] + ) + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 13 - -module Haddock.Backends.Xhtml.Decl where +module Haddock.Backends.Xhtml.Decl ( + ppDecl, + + ppTyName, ppTyFamHeader, ppTypeApp, + tyvarNames +) where hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 13 - -module Haddock.Backends.Xhtml.DocMarkup where +module Haddock.Backends.Xhtml.DocMarkup ( + docToHtml, maybeDocToHtml, + rdrDocToHtml, + origDocToHtml +) where hunk ./src/Haddock/Backends/Xhtml/Layout.hs 13 - -module Haddock.Backends.Xhtml.Layout where +module Haddock.Backends.Xhtml.Layout ( + topDeclElem, declElem, + + instHdr, atHdr, methHdr, constrHdr, + argBox, ndocBox, rdocBox, maybeRDocBox, + + vanillaTable, vanillaTable2, spacedTable1, spacedTable5 +) where hunk ./src/Haddock/Backends/Xhtml/Names.hs 13 - -module Haddock.Backends.Xhtml.Names where +module Haddock.Backends.Xhtml.Names ( + ppName, ppDocName, ppLDocName, ppRdrName, + ppBinder, ppBinder', + ppModule, + linkId +) where hunk ./src/Haddock/Backends/Xhtml/Types.hs 13 - -module Haddock.Backends.Xhtml.Types where +module Haddock.Backends.Xhtml.Types ( + SourceURLs, WikiURLs, + LinksInfo +) where hunk ./src/Haddock/Backends/Xhtml/Util.hs 13 - -module Haddock.Backends.Xhtml.Util where +module Haddock.Backends.Xhtml.Util ( + renderToString, + + namedAnchor, linkedAnchor, + spliceURL, + + (<+>), (<++>), char, empty, + keyword, punctuate, + + braces, brackets, pabrackets, parens, parenList, ubxParenList, + arrow, comma, dcolon, dot, darrow, equals, forallSymbol, quote, + + tda, emptyTable, s8, + abovesSep, hsep, + + collapsebutton, collapseId, collapsed, + documentCharacterEncoding, styleSheet +) where hunk ./html/xhaddock.css 157 + +ul.synopsis p.decl { + padding: 0; +} hunk ./html/xhaddock.css 165 - margin-top: 8px; - margin-bottom: 8px; - padding: 2px; + margin-top: 6px; + margin-bottom: 6px; + padding: 3px; hunk ./html/xhaddock.css 177 - margin: 0; + margin: 3px; hunk ./html/xhaddock.css 266 - margin-bottom: 0; + padding: 1px; + margin: 0; hunk ./src/Haddock/Backends/Xhtml.hs 748 - = Just $ toHtml "module" +++ ppModule mdl "" + = Just $ toHtml "module" <+> ppModule mdl "" hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 38 - markupIdentifier = tt . ppId . choose, + markupIdentifier = thecode . ppId . choose, hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 42 - markupMonospaced = tt, + markupMonospaced = thecode, hunk ./src/Haddock/Backends/Xhtml/Decl.hs 178 - instId = collapseId (getName docname) - - instancesBit - | associated || null instances = noHtml - | otherwise = - instHdr instId +++ - collapsed thediv instId ( - spacedTable1 << ( - aboves (map (ppDocInstance unicode) instances) - ) - ) + instancesBit = ppInstances instances docname unicode hunk ./src/Haddock/Backends/Xhtml/Decl.hs 395 - instId = collapseId (getName nm) - instancesBit - | null instances = noHtml - | otherwise = - instHdr instId +++ - collapsed thediv instId ( - spacedTable1 << aboves (map (ppDocInstance unicode) instances) - ) - + instancesBit = ppInstances instances nm unicode + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 400 + +ppInstances :: [DocInstance DocName] -> DocName -> Bool -> Html +ppInstances instances baseName unicode + | null instances = noHtml + | otherwise = + instHdr instId +++ + collapsed thediv instId ( + spacedTable1 << aboves (map (ppDocInstance unicode) instances) + ) + where + instId = collapseId (getName baseName) + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 493 - instId = collapseId (getName docname) - - instancesBit - | null instances = noHtml - | otherwise - = instHdr instId +++ - collapsed thediv instId ( - spacedTable1 << aboves (map (ppDocInstance unicode) instances - ) - ) + instancesBit = ppInstances instances docname unicode hunk ./src/Haddock/Backends/Xhtml/Decl.hs 443 - | [lcon] <- cons, ResTyH98 <- resTy = declElem (dataHeader <+> equals) - <+> ppShortConstr summary (unLoc lcon) unicode + | [lcon] <- cons, ResTyH98 <- resTy, + (cHead,cBody,cFoot) <- ppShortConstrParts summary (unLoc lcon) unicode + = declElem (dataHeader <+> equals <+> cHead) +++ cBody +++ cFoot hunk ./src/Haddock/Backends/Xhtml/Decl.hs 459 - resTy = (con_res . unLoc . head) cons + resTy = (con_res . unLoc . head) cons hunk ./src/Haddock/Backends/Xhtml/Decl.hs 503 + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 505 -ppShortConstr summary con unicode = case con_res con of +ppShortConstr summary con unicode = cHead <+> cBody <+> cFoot + where + (cHead,cBody,cFoot) = ppShortConstrParts summary con unicode + + +-- returns three pieces: header, body, footer so that header & footer can be +-- incorporated into the declaration +ppShortConstrParts :: Bool -> ConDecl DocName -> Bool -> (Html, Html, Html) +ppShortConstrParts summary con unicode = case con_res con of hunk ./src/Haddock/Backends/Xhtml/Decl.hs 515 - PrefixCon args -> header_ unicode +++ hsep (ppBinder summary occ : map (ppLParendType unicode) args) - RecCon fields -> header_ unicode +++ ppBinder summary occ <+> - doRecordFields fields - InfixCon arg1 arg2 -> header_ unicode +++ - hsep [ppLParendType unicode arg1, ppBinder summary occ, ppLParendType unicode arg2] + PrefixCon args -> + (header_ unicode +++ hsep (ppBinder summary occ : map (ppLParendType unicode) args), + noHtml, noHtml) + RecCon fields -> + (header_ unicode +++ ppBinder summary occ <+> char '{', + doRecordFields fields, + char '}') + InfixCon arg1 arg2 -> + (header_ unicode +++ hsep [ppLParendType unicode arg1, ppBinder summary occ, ppLParendType unicode arg2], + noHtml, noHtml) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 529 - PrefixCon args -> doGADTCon args resTy + PrefixCon args -> (doGADTCon args resTy, noHtml, noHtml) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 534 - RecCon fields -> ppBinder summary occ <+> dcolon unicode <+> hsep [ - ppForAll forall ltvs lcontext unicode, + RecCon fields -> (ppBinder summary occ <+> dcolon unicode <+> + ppForAll forall ltvs lcontext unicode <+> char '{', hunk ./src/Haddock/Backends/Xhtml/Decl.hs 537 - arrow unicode <+> ppLType unicode resTy ] - InfixCon arg1 arg2 -> doGADTCon [arg1, arg2] resTy + char '}' <+> arrow unicode <+> ppLType unicode resTy) + InfixCon arg1 arg2 -> (doGADTCon [arg1, arg2] resTy, noHtml, noHtml) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 541 - doRecordFields fields = braces $ unordList (map (ppShortField summary unicode) fields) + doRecordFields fields = unordList (map (ppShortField summary unicode) fields) hunk ./src/Haddock/Backends/Xhtml.hs 665 - | Nothing <- ps -> keyword "data" <++> ppTyClBinderWithVarsMini mdl d - | Just _ <- ps -> keyword "data" <++> keyword "instance" - <++> ppTyClBinderWithVarsMini mdl d + | Nothing <- ps -> keyword "data" <+> ppTyClBinderWithVarsMini mdl d + | Just _ <- ps -> keyword "data" <+> keyword "instance" + <+> ppTyClBinderWithVarsMini mdl d hunk ./src/Haddock/Backends/Xhtml.hs 669 - | Nothing <- ps -> keyword "type" <++> ppTyClBinderWithVarsMini mdl d - | Just _ <- ps -> keyword "type" <++> keyword "instance" - <++> ppTyClBinderWithVarsMini mdl d + | Nothing <- ps -> keyword "type" <+> ppTyClBinderWithVarsMini mdl d + | Just _ <- ps -> keyword "type" <+> keyword "instance" + <+> ppTyClBinderWithVarsMini mdl d hunk ./src/Haddock/Backends/Xhtml.hs 673 - keyword "class" <++> ppTyClBinderWithVarsMini mdl d + keyword "class" <+> ppTyClBinderWithVarsMini mdl d hunk ./src/Haddock/Backends/Xhtml/Util.hs 19 - (<+>), (<++>), char, empty, + (<+>), char, empty, hunk ./src/Haddock/Backends/Xhtml/Util.hs 96 -infixr 8 <+>, <++> +infixr 8 <+> hunk ./src/Haddock/Backends/Xhtml/Util.hs 100 -(<++>) :: Html -> Html -> Html -a <++> b = a +++ spaceHtml +++ b - hunk ./html/xhaddock.css 21 -span.keyword { text-decoration: underline; } +.keyword { text-decoration: underline; } +.caption { + font-weight: bold; + margin: 0; + padding: 0; +} hunk ./html/xhaddock.css 31 - font-size: 150% - } + font-size: 150%; +} hunk ./html/xhaddock.css 51 +h1, h2, h3, h4, h5 { + margin-top: 0.5em; + margin-bottom: 0.5em; +} + hunk ./html/xhaddock.css 79 -p.caption { - margin: 0; - padding: 0; -} hunk ./html/xhaddock.css 80 -div.package-header { +#package-header { hunk ./html/xhaddock.css 88 -div.package-header a:link { color: #ffffff } -div.package-header a:visited { color: #ffff00 } -div.package-header a:hover { background-color: #6060ff; } -div.package-header ul.links li:hover { background-color: #6060ff; } +#package-header a:link { color: #ffffff } +#package-header a:visited { color: #ffff00 } +#package-header a:hover { background-color: #6060ff; } +#package-header ul.links li:hover { background-color: #6060ff; } hunk ./html/xhaddock.css 111 -div.module-header { +#module-header { hunk ./html/xhaddock.css 115 - height: 3em; hunk ./html/xhaddock.css 117 -div.module-header p { +#module-header .caption { hunk ./html/xhaddock.css 121 + font-weight: normal; + font-style: normal; hunk ./html/xhaddock.css 145 -div.table-of-contents { +#table-of-contents { hunk ./html/xhaddock.css 147 - margin-bottom: 1em; + margin-bottom: 2em; hunk ./html/xhaddock.css 150 -div.table-of-contents p { - font-weight: bold; -} - -div.table-of-contents ul { +#table-of-contents ul { hunk ./html/xhaddock.css 153 - margin-left: 10px; + margin-left: 0; hunk ./html/xhaddock.css 155 + padding: 0; +} + +#table-of-contents ul ul { + margin-left: 2.5em; +} + +#description .caption, +#synopsis .caption { + padding-top: 15px; + font-weight: bold; + font-size: 150% hunk ./html/xhaddock.css 169 -ul.synopsis { - margin-left: 0px; +#synopsis { + margin-bottom: 2em; hunk ./html/xhaddock.css 173 -ul.synopsis p.decl { +#synopsis p.src { hunk ./html/xhaddock.css 176 -ul.synopsis li { +#synopsis li { hunk ./html/xhaddock.css 180 - margin-top: 6px; - margin-bottom: 6px; + margin-top: 8px; + margin-bottom: 8px; hunk ./html/xhaddock.css 186 -ul.synopsis li ul { +#synopsis ul { hunk ./html/xhaddock.css 191 -ul.synopsis li ul li { +#synopsis li ul li { hunk ./html/xhaddock.css 197 -div.decldoc { +div.top { hunk ./html/xhaddock.css 201 -div.decldoc h5 { +div.top h5 { hunk ./html/xhaddock.css 205 -div.decldoc table, div.subdecl { +div.top table, div.subdecl { hunk ./html/xhaddock.css 209 -p.decl { +.src { hunk ./html/xhaddock.css 217 -p.decl a.link { +.src a.link { hunk ./html/xhaddock.css 274 -div.bottom { +#footer { hunk ./html/xhaddock.css 280 -div.bottom p { +#footer p { hunk ./html/xhaddock.css 285 -div.bottom a:link { +#footer a:link { hunk ./html/xhaddock.css 289 -div.bottom a:visited { +#footer a:visited { hunk ./html/xhaddock.css 292 -div.bottom a:hover { +#footer a:hover { hunk ./src/Haddock/Backends/Xhtml.hs 155 - thediv ! [theclass "bottom"] << paragraph << ( + divFooter << paragraph << ( hunk ./src/Haddock/Backends/Xhtml.hs 197 - thediv ! [theclass "package-header"] << ( - paragraph ! [theclass "caption"] << doctitle +++ + divPackageHeader << ( + sectionName << nonEmpty doctitle +++ hunk ./src/Haddock/Backends/Xhtml.hs 213 - thediv ! [theclass "package-header"] << ( - paragraph ! [theclass "caption"] << (doctitle +++ spaceHtml) +++ + divPackageHeader << ( + sectionName << nonEmpty doctitle +++ hunk ./src/Haddock/Backends/Xhtml.hs 222 - thediv ! [theclass "module-header"] << ( - paragraph ! [theclass "caption"] << mdl +++ + divModuleHeader << ( + sectionName << mdl +++ hunk ./src/Haddock/Backends/Xhtml.hs 609 - maybe_doc_hdr +++ - bdy + divInterface (maybe_doc_hdr +++ bdy) hunk ./src/Haddock/Backends/Xhtml.hs 625 - Just doc -> h1 << toHtml "Description" +++ docToHtml doc + Just doc -> divDescription $ + sectionName << "Description" +++ docToHtml doc hunk ./src/Haddock/Backends/Xhtml.hs 632 - = h1 << "Synopsis" +++ - unordList ( - mapMaybe (processExport True linksInfo unicode) exports - ) ! [theclass "synopsis"] + = divSynposis $ + sectionName << "Synopsis" +++ + shortDeclList ( + mapMaybe (processExport True linksInfo unicode) exports + ) hunk ./src/Haddock/Backends/Xhtml.hs 648 - map (thediv ! [theclass "decldoc"]) $ - mapMaybe (processExport False linksInfo unicode) exports + mapMaybe (processExport False linksInfo unicode) exports hunk ./src/Haddock/Backends/Xhtml.hs 705 - contentsDiv = thediv ! [theclass "table-of-contents"] << ( - paragraph ! [theclass "caption"] << "Contents" +++ + contentsDiv = divTableOfContents << ( + sectionName << "Contents" +++ hunk ./src/Haddock/Backends/Xhtml.hs 740 - = Just $ ppDecl summary links decl doc insts subdocs unicode -processExport _ _ _ (ExportNoDecl y []) - = Just $ ppDocName y -processExport _ _ _ (ExportNoDecl y subs) - = Just $ ppDocName y +++ parenList (map ppDocName subs) + = processDecl summary $ ppDecl summary links decl doc insts subdocs unicode +processExport summary _ _ (ExportNoDecl y []) + = processDeclOneLiner summary $ ppDocName y +processExport summary _ _ (ExportNoDecl y subs) + = processDeclOneLiner summary $ ppDocName y +++ parenList (map ppDocName subs) hunk ./src/Haddock/Backends/Xhtml.hs 747 -processExport _ _ _ (ExportModule mdl) - = Just $ toHtml "module" <+> ppModule mdl "" +processExport summary _ _ (ExportModule mdl) + = processDeclOneLiner summary $ toHtml "module" <+> ppModule mdl "" hunk ./src/Haddock/Backends/Xhtml.hs 754 +processDecl :: Bool -> Html -> Maybe Html +processDecl True = Just +processDecl False = Just . divTopDecl + +processDeclOneLiner :: Bool -> Html -> Maybe Html +processDeclOneLiner True = Just +processDeclOneLiner False = Just . divTopDecl . declElem + hunk ./src/Haddock/Backends/Xhtml.hs 771 - hunk ./src/Haddock/Backends/Xhtml/Layout.hs 14 + divPackageHeader, divModuleHeader, divFooter, + divTableOfContents, divDescription, divSynposis, divInterface, + + sectionName, + + shortDeclList, + divTopDecl, + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 40 +-- Sections of the document + +divPackageHeader, divModuleHeader, divFooter :: Html -> Html +divPackageHeader = thediv ! [identifier "package-header"] +divModuleHeader = thediv ! [identifier "module-header"] +divFooter = thediv ! [identifier "footer"] + +divTableOfContents, divDescription, divSynposis, divInterface :: Html -> Html +divTableOfContents = thediv ! [identifier "table-of-contents"] +divDescription = thediv ! [identifier "description"] +divSynposis = thediv ! [identifier "synopsis"] +divInterface = thediv ! [identifier "interface"] + +-- | The name of a section, used directly after opening a section +sectionName :: Html -> Html +sectionName = paragraph ! [theclass "caption"] + + +-- | Declaration containers + +shortDeclList :: [Html] -> Html +shortDeclList items = ulist << map (li ! [theclass "src short"] <<) items + +divTopDecl :: Html -> Html +divTopDecl = thediv ! [theclass "top"] + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 69 -declElem = paragraph ! [theclass "decl"] +declElem = paragraph ! [theclass "src"] hunk ./src/Haddock/Backends/Xhtml/Util.hs 19 - (<+>), char, empty, + (<+>), char, empty, nonEmpty, hunk ./src/Haddock/Backends/Xhtml/Util.hs 113 +-- | ensure content contains at least something (a non-breaking space) +nonEmpty :: (HTML a) => a -> Html +nonEmpty a = if isNoHtml h then spaceHtml else h + where h = toHtml a + hunk ./html/xhaddock.css 3 - padding: 0; + padding: 0; hunk ./html/xhaddock.css 59 - margin-bottom: 1em; hunk ./html/xhaddock.css 65 - margin-bottom: 1em; hunk ./html/xhaddock.css 70 - margin-bottom: 1em; hunk ./html/xhaddock.css 72 -h2 + p, h3 + p, h4 + p { +* + p, * + pre { hunk ./html/xhaddock.css 75 +.caption + p, .src + p { + margin-top: 0; +} hunk ./html/xhaddock.css 199 + clear: left; + margin-bottom: 1em; hunk ./html/xhaddock.css 229 +div.subs { + margin-left: 10px; + clear: both; + margin-top: 2px; +} + +.subs dl { + margin-left: 0; +} + +.subs dl dl { + padding-left: 0; + padding-top: 4px; +} + +.subs dt { + float: left; + margin-right: 1em; + clear: left; +} + +.subs dd +{ + margin-bottom: 2px; + margin-top: 2px; +} + +.fields .caption { + display: none; +} + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 483 - constrTable - | any isRecCon cons = spacedTable5 - | otherwise = spacedTable1 - - constrBit - | null cons = noHtml - | otherwise = constrHdr +++ ( - constrTable << - aboves (map (ppSideBySideConstr subdocs unicode) cons) - ) + constrBit = subDecls "Constructors" + (map (ppSideBySideConstr subdocs unicode) cons) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 489 -isRecCon :: Located (ConDecl a) -> Bool -isRecCon lcon = case con_details (unLoc lcon) of - RecCon _ -> True - _ -> False - - hunk ./src/Haddock/Backends/Xhtml/Decl.hs 556 -ppSideBySideConstr :: [(DocName, DocForDecl DocName)] -> Bool -> LConDecl DocName -> HtmlTable +ppSideBySideConstr :: [(DocName, DocForDecl DocName)] -> Bool -> LConDecl DocName -> (Html, Maybe Html) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 562 - argBox (hsep ((header_ unicode +++ ppBinder False occ) : map (ppLParendType unicode) args)) - <-> maybeRDocBox mbDoc + (hsep ((header_ unicode +++ ppBinder False occ) + : map (ppLParendType unicode) args), + fmap docToHtml mbDoc) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 567 - argBox (header_ unicode +++ ppBinder False occ) <-> - maybeRDocBox mbDoc - - doRecordFields fields + (header_ unicode +++ ppBinder False occ, + fmap docToHtml mbDoc `with` (Just $ doRecordFields fields)) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 571 - argBox (hsep [header_ unicode+++ppLParendType unicode arg1, ppBinder False occ, ppLParendType unicode arg2]) - <-> maybeRDocBox mbDoc + (hsep [header_ unicode+++ppLParendType unicode arg1, + ppBinder False occ, + ppLParendType unicode arg2], + fmap docToHtml mbDoc) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 579 - PrefixCon args -> doGADTCon args resTy + PrefixCon args -> doGADTCon args resTy Nothing hunk ./src/Haddock/Backends/Xhtml/Decl.hs 581 - doRecordFields fields - InfixCon arg1 arg2 -> doGADTCon [arg1, arg2] resTy + (Just $ doRecordFields fields) + InfixCon arg1 arg2 -> doGADTCon [arg1, arg2] resTy Nothing hunk ./src/Haddock/Backends/Xhtml/Decl.hs 585 - doRecordFields fields = - (tda [theclass "body"] << spacedTable1 << - aboves (map (ppSideBySideField subdocs unicode) fields)) - doGADTCon args resTy = argBox (ppBinder False occ <+> dcolon unicode <+> hsep [ - ppForAll forall ltvs (con_cxt con) unicode, - ppLType unicode (foldr mkFunTy resTy args) ] - ) <-> maybeRDocBox mbDoc - + doRecordFields fields = subDecls "Fields" + (map (ppSideBySideField subdocs unicode) fields) + doGADTCon :: [LHsType DocName] -> Located (HsType DocName) -> Maybe Html -> (Html, Maybe Html) + doGADTCon args resTy fieldsHtml = + (ppBinder False occ <+> dcolon unicode + <+> hsep [ppForAll forall ltvs (con_cxt con) unicode, + ppLType unicode (foldr mkFunTy resTy args) ], + fmap docToHtml mbDoc `with` fieldsHtml) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 594 + with a = maybe a (\b -> Just $ a +++ b) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 607 -ppSideBySideField :: [(DocName, DocForDecl DocName)] -> Bool -> ConDeclField DocName -> HtmlTable +ppSideBySideField :: [(DocName, DocForDecl DocName)] -> Bool -> ConDeclField DocName -> (Html, Maybe Html) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 609 - argBox (ppBinder False (docNameOcc name) - <+> dcolon unicode <+> ppLType unicode ltype) <-> maybeRDocBox mbDoc + (ppBinder False (docNameOcc name) <+> dcolon unicode <+> ppLType unicode ltype, + fmap docToHtml mbDoc) hunk ./src/Haddock/Backends/Xhtml/Layout.hs 20 - divTopDecl, + divTopDecl, + subDecls, hunk ./src/Haddock/Backends/Xhtml/Layout.hs 25 - instHdr, atHdr, methHdr, constrHdr, + instHdr, atHdr, methHdr, hunk ./src/Haddock/Backends/Xhtml/Layout.hs 36 +import Data.Char (isLetter, toLower) hunk ./src/Haddock/Backends/Xhtml/Layout.hs 68 +subDecls :: String -> [(Html, Maybe Html)] -> Html +subDecls _ [] = noHtml +subDecls name decls = subSection << (subCaption +++ subList) + where + subSection = thediv ! [theclass $ unwords ["subs", subClass]] + subClass = map (\c -> if isLetter c then toLower c else '-') name + subCaption = paragraph ! [theclass "caption"] << name + subList = dlist << map subEntry decls + subEntry (dt,dd) = [dterm ! [theclass "src"] << dt, ddef << nonEmpty dd] hunk ./src/Haddock/Backends/Xhtml/Layout.hs 143 -constrHdr, methHdr, atHdr :: Html -constrHdr = h5 << "Constructors" +methHdr, atHdr :: Html hunk ./src/Haddock/Backends/Xhtml/Decl.hs 483 - constrBit = subDecls "Constructors" + constrBit = subConstructors hunk ./src/Haddock/Backends/Xhtml/Decl.hs 556 -ppSideBySideConstr :: [(DocName, DocForDecl DocName)] -> Bool -> LConDecl DocName -> (Html, Maybe Html) -ppSideBySideConstr subdocs unicode (L _ con) = case con_res con of - - ResTyH98 -> case con_details con of - - PrefixCon args -> - (hsep ((header_ unicode +++ ppBinder False occ) - : map (ppLParendType unicode) args), - fmap docToHtml mbDoc) - - RecCon fields -> - (header_ unicode +++ ppBinder False occ, - fmap docToHtml mbDoc `with` (Just $ doRecordFields fields)) +ppSideBySideConstr :: [(DocName, DocForDecl DocName)] -> Bool -> LConDecl DocName -> SubDecl +ppSideBySideConstr subdocs unicode (L _ con) = (decl, mbDoc, fieldPart) + where + decl = case con_res con of + ResTyH98 -> case con_details con of + PrefixCon args -> + hsep ((header_ unicode +++ ppBinder False occ) + : map (ppLParendType unicode) args) + + RecCon _ -> header_ unicode +++ ppBinder False occ + + InfixCon arg1 arg2 -> + hsep [header_ unicode+++ppLParendType unicode arg1, + ppBinder False occ, + ppLParendType unicode arg2] + + ResTyGADT resTy -> case con_details con of + -- prefix & infix could also use hsConDeclArgTys if it seemed to + -- simplify the code. + PrefixCon args -> doGADTCon args resTy + cd@(RecCon _) -> doGADTCon (hsConDeclArgTys cd) resTy + InfixCon arg1 arg2 -> doGADTCon [arg1, arg2] resTy hunk ./src/Haddock/Backends/Xhtml/Decl.hs 579 - InfixCon arg1 arg2 -> - (hsep [header_ unicode+++ppLParendType unicode arg1, - ppBinder False occ, - ppLParendType unicode arg2], - fmap docToHtml mbDoc) - - ResTyGADT resTy -> case con_details con of - -- prefix & infix could also use hsConDeclArgTys if it seemed to - -- simplify the code. - PrefixCon args -> doGADTCon args resTy Nothing - cd@(RecCon fields) -> doGADTCon (hsConDeclArgTys cd) resTy - (Just $ doRecordFields fields) - InfixCon arg1 arg2 -> doGADTCon [arg1, arg2] resTy Nothing + fieldPart = case con_details con of + RecCon fields -> [doRecordFields fields] + _ -> [] hunk ./src/Haddock/Backends/Xhtml/Decl.hs 583 - where - doRecordFields fields = subDecls "Fields" + doRecordFields fields = subFields hunk ./src/Haddock/Backends/Xhtml/Decl.hs 585 - doGADTCon :: [LHsType DocName] -> Located (HsType DocName) -> Maybe Html -> (Html, Maybe Html) - doGADTCon args resTy fieldsHtml = - (ppBinder False occ <+> dcolon unicode + doGADTCon :: [LHsType DocName] -> Located (HsType DocName) -> Html + doGADTCon args resTy = + ppBinder False occ <+> dcolon unicode hunk ./src/Haddock/Backends/Xhtml/Decl.hs 589 - ppLType unicode (foldr mkFunTy resTy args) ], - fmap docToHtml mbDoc `with` fieldsHtml) + ppLType unicode (foldr mkFunTy resTy args) ] hunk ./src/Haddock/Backends/Xhtml/Decl.hs 591 - with a = maybe a (\b -> Just $ a +++ b) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 603 -ppSideBySideField :: [(DocName, DocForDecl DocName)] -> Bool -> ConDeclField DocName -> (Html, Maybe Html) +ppSideBySideField :: [(DocName, DocForDecl DocName)] -> Bool -> ConDeclField DocName -> SubDecl hunk ./src/Haddock/Backends/Xhtml/Decl.hs 606 - fmap docToHtml mbDoc) + mbDoc, + []) hunk ./src/Haddock/Backends/Xhtml/Layout.hs 21 - subDecls, + + SubDecl, + subConstructors, subFields, hunk ./src/Haddock/Backends/Xhtml/Layout.hs 38 -import Data.Char (isLetter, toLower) hunk ./src/Haddock/Backends/Xhtml/Layout.hs 69 -subDecls :: String -> [(Html, Maybe Html)] -> Html -subDecls _ [] = noHtml -subDecls name decls = subSection << (subCaption +++ subList) + +type SubDecl = (Html, Maybe (Doc DocName), [Html]) + +divSubDecls :: String -> String -> Maybe Html -> Html +divSubDecls cssClass captionName = maybe noHtml wrap + where + wrap = (subSection <<) . (subCaption +++) + subSection = thediv ! [theclass $ unwords ["subs", cssClass]] + subCaption = paragraph ! [theclass "caption"] << captionName + +subDlist :: [SubDecl] -> Maybe Html +subDlist [] = Nothing +subDlist decls = Just $ dlist << map subEntry decls hunk ./src/Haddock/Backends/Xhtml/Layout.hs 83 - subSection = thediv ! [theclass $ unwords ["subs", subClass]] - subClass = map (\c -> if isLetter c then toLower c else '-') name - subCaption = paragraph ! [theclass "caption"] << name - subList = dlist << map subEntry decls - subEntry (dt,dd) = [dterm ! [theclass "src"] << dt, ddef << nonEmpty dd] + subEntry (decl, mdoc, subs) = Just $ + dterm ! [theclass "src"] << decl + +++ ddef << (fmap docToHtml mdoc `with` subs) + Nothing `with` [] = spaceHtml + ma `with` bs = ma +++ bs + +subConstructors :: [(Html, Maybe (Doc DocName), [Html])] -> Html +subConstructors = divSubDecls "constructors" "Constructors" . subDlist + +subFields :: [(Html, Maybe (Doc DocName), [Html])] -> Html +subFields = divSubDecls "fields" "Fields" . subDlist + hunk ./html/xhaddock.css 207 -div.top table, div.subdecl { - margin-left: 20px; -} hunk ./html/xhaddock.css 253 +.subs table { + margin-left: 10px; + border-spacing: 1px 1px; + margin-top: 4px; + margin-bottom: 4px; +} + +.subs table table { + margin-left: 0; +} + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 83 - subEntry (decl, mdoc, subs) = Just $ + subEntry (decl, mdoc, subs) = hunk ./src/Haddock/Backends/Xhtml/Layout.hs 85 - +++ ddef << (fmap docToHtml mdoc `with` subs) + +++ + ddef << (fmap docToHtml mdoc `with` subs) + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 91 +subTable :: [SubDecl] -> Maybe Html +subTable [] = Nothing +subTable decls = Just $ table << aboves (concatMap subRow decls) + where + subRow (decl, mdoc, subs) = + (td ! [theclass "src"] << decl + <-> + td << nonEmpty (fmap docToHtml mdoc)) + : map (cell . (td <<)) subs + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 102 -subConstructors = divSubDecls "constructors" "Constructors" . subDlist +subConstructors = divSubDecls "constructors" "Constructors" . subTable hunk ./src/Haddock/Backends/Xhtml/Layout.hs 105 -subFields = divSubDecls "fields" "Fields" . subDlist +subFields = divSubDecls "fields" "Fields" . subTable hunk ./html/xhaddock.css 209 - padding: 3px; - background-color: #f0f0f0; - font-family: monospace; + padding: 3px; + background-color: #f0f0f0; + font-family: monospace; hunk ./html/xhaddock.css 264 +.arguments .caption, hunk ./html/xhaddock.css 269 +/* need extra .subs in the selector to make it override the rules for .subs and .subs table */ + +.subs.arguments { + margin: 0; +} + +.subs.arguments table { + border-spacing: 0; + margin-top: 0; + margin-bottom: 0; +} + +.subs.arguments td.src { + white-space: nowrap; +} + +.subs.arguments + p { + margin-top: 0; +} + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 70 - (vanillaTable << ( - do_args 0 sep typ - (case doc of - Just d -> ndocBox (docToHtml d) - Nothing -> emptyTable) - )) + subArguments (do_args 0 sep typ) +++ maybeDocToHtml doc hunk ./src/Haddock/Backends/Xhtml/Decl.hs 72 - argDocHtml n = case Map.lookup n argDocs of - Just adoc -> docToHtml adoc - Nothing -> noHtml + argDoc n = Map.lookup n argDocs hunk ./src/Haddock/Backends/Xhtml/Decl.hs 75 - do_args :: Int -> Html -> (HsType DocName) -> HtmlTable + do_args :: Int -> Html -> (HsType DocName) -> [SubDecl] hunk ./src/Haddock/Backends/Xhtml/Decl.hs 77 - = (argBox ( - leader <+> + = (leader <+> hunk ./src/Haddock/Backends/Xhtml/Decl.hs 79 - ppLContextNoArrow lctxt unicode) - <-> rdocBox noHtml) - do_largs n (darrow unicode) ltype + ppLContextNoArrow lctxt unicode, + Nothing, []) + : do_largs n (darrow unicode) ltype hunk ./src/Haddock/Backends/Xhtml/Decl.hs 84 - = (argBox (leader <+> ppLContextNoArrow lctxt unicode) - <-> rdocBox noHtml) - do_largs n (darrow unicode) ltype + = (leader <+> ppLContextNoArrow lctxt unicode, + Nothing, []) + : do_largs n (darrow unicode) ltype hunk ./src/Haddock/Backends/Xhtml/Decl.hs 92 - = (argBox (leader <+> ppLFunLhType unicode lt) <-> rdocBox (argDocHtml n)) - do_largs (n+1) (arrow unicode) r + = (leader <+> ppLFunLhType unicode lt, argDoc n, []) + : do_largs (n+1) (arrow unicode) r hunk ./src/Haddock/Backends/Xhtml/Decl.hs 95 - = argBox (leader <+> ppType unicode t) <-> rdocBox (argDocHtml n) + = (leader <+> ppType unicode t, argDoc n, []) : [] hunk ./src/Haddock/Backends/Xhtml/Layout.hs 23 + subArguments, hunk ./src/Haddock/Backends/Xhtml/Layout.hs 102 + +subArguments :: [(Html, Maybe (Doc DocName), [Html])] -> Html +subArguments = divSubDecls "arguments" "Arguments" . subTable + hunk ./html/xhaddock.css 299 -p.inst-header { - font-weight: bold; - margin-bottom: 0; -} hunk ./html/xhaddock.css 300 -p.inst-header img { +img.coll { hunk ./html/xhaddock.css 304 -ul.int { - margin-top: 1em; - margin-bottom: 1em; -} -ul.inst li { - background-color: #f0f0f0; - font-family: monospace; - vertical-align: top; - margin-top: 1px; - margin-bottom: 1px; - padding: 2px; - margin-left: 20px; - list-style-type: none; -} hunk ./src/Haddock/Backends/Xhtml/Decl.hs 395 - | null instances = noHtml - | otherwise = - instHdr instId +++ - collapsed thediv instId ( - spacedTable1 << aboves (map (ppDocInstance unicode) instances) - ) + = subInstances instId (map instDecl instances) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 398 - --- | Print a possibly commented instance. The instance header is printed inside --- an 'argBox'. The comment is printed to the right of the box in normal comment --- style. -ppDocInstance :: Bool -> DocInstance DocName -> HtmlTable -ppDocInstance unicode (instHead, maybeDoc) = - argBox (ppInstHead unicode instHead) <-> maybeRDocBox maybeDoc - - -ppInstHead :: Bool -> InstHead DocName -> Html -ppInstHead unicode ([], n, ts) = ppAppNameTypes n ts unicode -ppInstHead unicode (ctxt, n, ts) = ppContextNoLocs ctxt unicode <+> ppAppNameTypes n ts unicode + instDecl :: DocInstance DocName -> SubDecl + instDecl (inst, maybeDoc) = (instHead inst, maybeDoc, []) + instHead ([], n, ts) = ppAppNameTypes n ts unicode + instHead (ctxt, n, ts) = ppContextNoLocs ctxt unicode <+> ppAppNameTypes n ts unicode hunk ./src/Haddock/Backends/Xhtml/Layout.hs 24 - subConstructors, subFields, + subConstructors, + subFields, + subInstances, hunk ./src/Haddock/Backends/Xhtml/Layout.hs 30 - instHdr, atHdr, methHdr, + atHdr, methHdr, hunk ./src/Haddock/Backends/Xhtml/Layout.hs 75 -divSubDecls :: String -> String -> Maybe Html -> Html +divSubDecls :: (HTML a) => String -> a -> Maybe Html -> Html hunk ./src/Haddock/Backends/Xhtml/Layout.hs 114 +subInstances :: String -> [(Html, Maybe (Doc DocName), [Html])] -> Html +subInstances id_ = divSubDecls "instances" instCaption . instTable + where + instCaption = collapsebutton id_ +++ " Instances" + instTable = (collapsed thediv id_ `fmap`) . subTable hunk ./src/Haddock/Backends/Xhtml/Layout.hs 188 - -instHdr :: String -> Html -instHdr id_ = - h5 << (collapsebutton id_ +++ toHtml " Instances") hunk ./src/Haddock/Backends/Xhtml/Layout.hs 31 - argBox, ndocBox, rdocBox, maybeRDocBox, - - vanillaTable, vanillaTable2, spacedTable1, spacedTable5 + argBox, vanillaTable, vanillaTable2 hunk ./src/Haddock/Backends/Xhtml/Layout.hs 161 --- a box for displaying documentation, not indented. -ndocBox :: Html -> HtmlTable -ndocBox html = tda [theclass "ndoc"] << html - --- a box for displaying documentation, padded on the left a little -rdocBox :: Html -> HtmlTable -rdocBox html = tda [theclass "rdoc"] << html - -maybeRDocBox :: Maybe (Doc DocName) -> HtmlTable -maybeRDocBox Nothing = rdocBox (noHtml) -maybeRDocBox (Just doc) = rdocBox (docToHtml doc) - - hunk ./src/Haddock/Backends/Xhtml/Layout.hs 166 -spacedTable1, spacedTable5 :: Html -> Html -spacedTable1 = table ! [theclass "vanilla", cellspacing 1, cellpadding 0] -spacedTable5 = table ! [theclass "vanilla", cellspacing 5, cellpadding 0] hunk ./html/xhaddock.css 289 +.subs.associated-types, +.subs.methods { + margin-left: 20px; +} + +.subs.associated-types .caption, +.subs.methods .caption { + margin-top: 0.5em; + margin-left: -10px; +} + +.subs.associated-types .src + .src, +.subs.methods .src + .src { + margin-top: 8px; +} + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 369 - atBit - | null ats = noHtml - | otherwise = atHdr +++ ( - thediv ! [theclass "subdecl"] << - concatHtml [ ppAssocType summary links doc at unicode + atBit = subAssociatedTypes [ ppAssocType summary links doc at unicode hunk ./src/Haddock/Backends/Xhtml/Decl.hs 372 - ) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 373 - methodBit - | null lsigs = noHtml - | otherwise = methHdr +++ ( - thediv ! [theclass "subdecl"] << - concatHtml [ ppFunSig summary links loc doc n typ unicode + methodBit = subMethods [ ppFunSig summary links loc doc n typ unicode hunk ./src/Haddock/Backends/Xhtml/Decl.hs 376 - ) hunk ./src/Haddock/Backends/Xhtml/Layout.hs 24 + subAssociatedTypes, hunk ./src/Haddock/Backends/Xhtml/Layout.hs 28 + subMethods, hunk ./src/Haddock/Backends/Xhtml/Layout.hs 32 - atHdr, methHdr, hunk ./src/Haddock/Backends/Xhtml/Layout.hs 102 - hunk ./src/Haddock/Backends/Xhtml/Layout.hs 103 -subArguments :: [(Html, Maybe (Doc DocName), [Html])] -> Html +subBlock :: [Html] -> Maybe Html +subBlock [] = Nothing +subBlock hs = Just $ toHtml hs + + +subArguments :: [SubDecl] -> Html hunk ./src/Haddock/Backends/Xhtml/Layout.hs 111 -subConstructors :: [(Html, Maybe (Doc DocName), [Html])] -> Html +subAssociatedTypes :: [Html] -> Html +subAssociatedTypes = divSubDecls "associated-types" "Associated Types" . subBlock + +subConstructors :: [SubDecl] -> Html hunk ./src/Haddock/Backends/Xhtml/Layout.hs 117 -subFields :: [(Html, Maybe (Doc DocName), [Html])] -> Html +subFields :: [SubDecl] -> Html hunk ./src/Haddock/Backends/Xhtml/Layout.hs 120 -subInstances :: String -> [(Html, Maybe (Doc DocName), [Html])] -> Html +subInstances :: String -> [SubDecl] -> Html hunk ./src/Haddock/Backends/Xhtml/Layout.hs 126 +subMethods :: [Html] -> Html +subMethods = divSubDecls "methods" "Methods" . subBlock + + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 177 - - -methHdr, atHdr :: Html -methHdr = h5 << "Methods" -atHdr = h5 << "Associated Types" hunk ./html/xhaddock.css 173 -#synopsis p.src { - padding: 0; +#synopsis ul { + margin: 0; + padding-top: 0; + padding-left: 20px; + list-style-type: none; hunk ./html/xhaddock.css 179 + hunk ./html/xhaddock.css 181 - background-color: #f0f0f0; - font-family: monospace; - vertical-align: top; hunk ./html/xhaddock.css 184 - list-style-type: none; hunk ./html/xhaddock.css 186 -#synopsis ul { - margin: 0; - padding-top: 0; -} - -#synopsis li ul li { - margin: 3px; +#synopsis li li { hunk ./html/xhaddock.css 188 + margin-top: 0; + margin-bottom: 0; hunk ./src/Haddock/Backends/Xhtml/Decl.hs 67 - | summary = declElem pref1 + | summary = pref1 hunk ./src/Haddock/Backends/Xhtml/Decl.hs 162 - | summary = declElem (ppTyFamHeader True associated decl unicode) + | summary = ppTyFamHeader True associated decl unicode hunk ./src/Haddock/Backends/Xhtml/Decl.hs 202 - | summary = declElem(ppTyInstHeader True associated decl unicode) + | summary = ppTyInstHeader True associated decl unicode hunk ./src/Haddock/Backends/Xhtml/Decl.hs 334 - then (if summary then declElem else topDeclElem links loc nm) hdr - else (if summary then declElem else topDeclElem links loc nm) (hdr <+> keyword "where") - +++ vanillaTable << aboves + then (if summary then id else topDeclElem links loc nm) hdr + else (if summary then id else topDeclElem links loc nm) (hdr <+> keyword "where") + +++ shortSubDecls hunk ./src/Haddock/Backends/Xhtml/Decl.hs 338 - [ argBox $ ppAssocType summary links doc at unicode | at <- ats + [ ppAssocType summary links doc at unicode | at <- ats hunk ./src/Haddock/Backends/Xhtml/Decl.hs 341 - [ argBox $ ppFunSig summary links loc doc n typ unicode + [ ppFunSig summary links loc doc n typ unicode hunk ./src/Haddock/Backends/Xhtml/Decl.hs 410 - | [] <- cons = declElem dataHeader + | [] <- cons = dataHeader hunk ./src/Haddock/Backends/Xhtml/Decl.hs 414 - = declElem (dataHeader <+> equals <+> cHead) +++ cBody +++ cFoot + = (dataHeader <+> equals <+> cHead) +++ cBody +++ cFoot hunk ./src/Haddock/Backends/Xhtml/Decl.hs 416 - | ResTyH98 <- resTy = declElem dataHeader - +++ unordList (zipWith doConstr ('=':repeat '|') cons) + | ResTyH98 <- resTy = dataHeader + +++ shortSubDecls (zipWith doConstr ('=':repeat '|') cons) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 419 - | otherwise = declElem (dataHeader <+> keyword "where") - +++ unordList (map doGADTConstr cons) + | otherwise = (dataHeader <+> keyword "where") + +++ shortSubDecls (map doGADTConstr cons) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 496 - doRecordFields fields = unordList (map (ppShortField summary unicode) fields) + doRecordFields fields = shortSubDecls (map (ppShortField summary unicode) fields) hunk ./src/Haddock/Backends/Xhtml/Layout.hs 20 + shortSubDecls, + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 34 - argBox, vanillaTable, vanillaTable2 + vanillaTable, vanillaTable2 hunk ./src/Haddock/Backends/Xhtml/Layout.hs 70 +shortSubDecls :: [Html] -> Html +shortSubDecls items = ulist ! [theclass "subs"] << map (li <<) items + + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 172 --- a box for displaying an 'argument' (some code which has text to the --- right of it). Wrapping is not allowed in these boxes, whereas it is --- in a declBox. -argBox :: Html -> HtmlTable -argBox html = tda [theclass "arg"] << html - - hunk ./src/Haddock/Backends/Xhtml/Names.hs 46 -linkTarget :: OccName -> Html -linkTarget n = namedAnchor (anchorNameStr n) << toHtml "" - hunk ./src/Haddock/Backends/Xhtml/Names.hs 54 -ppBinder False n = linkTarget n +++ bold << ppBinder' n +ppBinder False n = namedAnchor (anchorNameStr n) << bold << ppBinder' n hunk ./src/Haddock/Backends/Xhtml/Util.hs 180 --- This actually generates two anchor tags, one with the name unescaped, and one +-- This used to generate two anchor tags, one with the name unescaped, and one hunk ./src/Haddock/Backends/Xhtml/Util.hs 183 --- -namedAnchor :: String -> Html -> Html -namedAnchor n c = anchor ! [Html.name n] << noHtml +++ - anchor ! [Html.name (escapeStr n)] << c +-- The escaped form for IE 7 is probably erroneous and not needed... hunk ./src/Haddock/Backends/Xhtml/Util.hs 185 +namedAnchor :: String -> Html -> Html +namedAnchor n c = anchor ! [Html.name n] << c hunk ./src/Haddock/Backends/Xhtml/Util.hs 188 +linkedAnchor :: String -> Html -> Html +linkedAnchor frag = anchor ! [href hr_] + where hr_ | null frag = "" + | otherwise = '#': escapeStr frag + -- this escape function is over-zealous for the fragment part of a URI + -- (':' for example does not need to be escaped) + hunk ./src/Haddock/Backends/Xhtml/Util.hs 216 -linkedAnchor :: String -> Html -> Html -linkedAnchor frag = anchor ! [href hr_] - where hr_ | null frag = "" - | otherwise = '#': escapeStr frag - hunk ./html/haddock-util.js 141 + +function setActiveStyleSheet(href) { + var i, a, main; + for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { + if(a.getAttribute("rel").indexOf("style") != -1 + && a.getAttribute("title")) { + a.disabled = true; + if(a.getAttribute("href") == href) a.disabled = false; + //a.disabled = a.getAttribute("title") != title; + } + } +} + addfile ./html/shaddock.css hunk ./html/shaddock.css 1 +/* -------- Global things --------- */ + +@font-face { + font-family: 'DroidSerif'; + src: url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Regular.eot'); + src: local('Droid Serif'), + url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Regular.woff') format('woff'), + url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Regular.ttf') format('truetype'), + url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Regular.svg#DroidSerif') format('svg'); +} + +@font-face { + font-family: 'DroidSerif'; + font-style: italic; + src: url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Italic.eot'); + src: local('Droid Serif'), + url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Italic.woff') format('woff'), + url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Italic.ttf') format('truetype'), + url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Italic.svg#DroidSerif-Italic') format('svg'); +} + +@font-face { + font-family: 'DroidSerif'; + font-weight: bold; + src: url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Bold.eot'); + src: local('Droid Serif'), + url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Bold.woff') format('woff'), + url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Bold.ttf') format('truetype'), + url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Bold.svg#DroidSerif-Bold') format('svg'); +} + +@font-face { + font-family: 'DroidSerif'; + src: url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-BoldItalic.eot'); + font-weight: bold; + font-style: italic; + src: local('Droid Serif'), + url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-BoldItalic.woff') format('woff'), + url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-BoldItalic.ttf') format('truetype'), + url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-BoldItalic.svg#DroidSerif-BoldItalic') format('svg'); +} + + + +html { + background-color: #f0f3ff; + width: 100%; +} + +body { + -moz-border-radius:5px; + -webkit-border-radius:5px; + width: 50em; + margin: 2em auto; + padding: 0; + background-color: #ffffff; + color: #000000; + font-size: 110%; + font-family: DroidSerif, Georgia, serif; + } + +div { + padding: 0 30px; +} + + + +a:link { color: #5200A3; text-decoration: none } +a:visited { color: #5200A3; text-decoration: none } +a:hover { color: #5200A3; text-decoration: none; border-bottom:#5200A3 dashed 1px; } + +table{ + border-spacing: 1px 1px; +} + +td { + border-width: 0px; + vertical-align: top; +} + +p { + margin-top: 0; + margin-bottom: 0.75em; + padding-left: 4px; + font-size: 95%; + line-height: 1.66; + } + +li p { margin: 0pt } + + +tt, pre, code { + font-family: Monaco, + "DejaVu Sans Mono", + "Bitstream Vera Sans Mono", + "Lucida Console", + monospace; + font-size: 90%; +} + +.src { + padding: 4px 8px; + background-color: #f0f0f0; + font-size: 80%; + font-family: Monaco, + "DejaVu Sans Mono", + "Bitstream Vera Sans Mono", + "Lucida Console", + monospace; + + vertical-align: top; + white-space: nowrap; +} + +ul { + padding: 0; +} + +ul ul { + padding-left: 30px; +} + +ul.links { + list-style: none; + position: absolute; + right: 1px; + top: 0; + margin: 0; +} + +ul.links li { + display: inline; + white-space: nowrap; +} + + + +/* Captions and Headers */ + +p.caption, h1, h2, h3, h4 { + font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif; + margin: 0; + padding: 0; + font-size: inherit; + line-height: inherit; +} + +#module-header .caption { + font-weight: bold; letter-spacing: -0.02em; + font-size: 201%; + margin: 0; + padding: 0; +} + +h1, +#description .caption, +#synopsis .caption { + padding-top: 14px; + margin-bottom: 0; + font-weight: bold; + letter-spacing: -0.02em; + font-size: 140% + } + +h2 { + padding-top: 14px; + font-weight: bold; + letter-spacing: -0.02em; + font-size: 120% +} + +h3 { + padding-top: 12px; + font-weight: bold; + letter-spacing: -0.02em; + font-size: 105% +} + +h4, +#table-of-contents .caption, +.constructors .caption, +.instances .caption, +.methods .caption { + font-weight: bold; + padding-top: 12px; + padding-bottom: 4px; + letter-spacing: -0.02em; + font-size: 90% +} + +.arguments .caption, +.fields .caption { + display: none; +} + +/* Per Section Styling */ + +#package-header { + font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif; + background: #3465a4 url(haskell_icon.gif) no-repeat 4px 3px; + padding: 0; + -moz-border-radius-topleft:5px; + -moz-border-radius-topright:5px; + -webkit-border-radius-topleft:5px; + -webkit-border-radius-topright:5px; + position: relative; +} + +#package-header li { + font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif; + padding-left: 5px; + padding-right: 5px; + border-left-width: 1px; + border-left-color: #ffffff; + border-left-style: solid; + letter-spacing: -0.02em; + font-weight: bold; +} + +#package-header a { color: #ffffff } +#package-header a:visited { color: #ffff00 } +#package-header a:hover { background-color: #C9D3DE; } +#package-header li:hover { background-color: #C9D3DE; } + +#module-header { + font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif; + color: #141B24; + background-color: #C9D3DE; + padding: 5px; + border-top-width: 1px; + border-top-color: #ffffff; + border-top-style: solid; + -moz-border-radius-bottomleft:5px; + -moz-border-radius-bottomright:5px; + -webkit-border-radius-bottomleft:5px; + -webkit-border-radius-bottomright:5px; +} + +#module-header .info { + display: none; +} + +#table-of-contents, +#description, +#synopsis, +#footer { + margin-top: 15px; +} + +#table-of-contents ul { + font-size: 80%; + font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif; + letter-spacing: -0.01em; + margin: 0; + list-style: none; +} + +#synopsis ul { + list-style: none; +} + +#synopsis .src, +.instances .src { + background-color: #FAFAFA; + border-bottom: #F2F2F2 solid 1px; + border-top: #FCFCFC solid 1px; +} + +.top { + padding: 20px 0 0.5ex 0; +} + +.top .src, +#interface .subs.methods .src { + border-spacing: 0px; + border-bottom:1px solid #d7d7df; + border-right:1px solid #d7d7df; + border-top:1px solid #f4f4f9; + border-left:1px solid #f4f4f9; + padding: 4px; +} + +#interface p + div { + margin-top: -15px +} + +.subs p { + margin: 0; +} + +#interface .subs .src { + padding: 2px 12px; + border: none; +} + +#interface .subs td + td { + font-style: italic; + font-size: 80%; + font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif; +} + +#interface .methods .src { + margin-top: 15px; +} +#interface .instances div { + margin: 0; + padding: 0; +} + +div.arguments { + padding-left: 0; + padding-top: 9px; +} + +.arguments table { + border-spacing: 0; +} + +#footer { + font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif; + -moz-border-radius:5px; + -webkit-border-radius:5px; + background-color: #3465a4; + color: #ffffff; + padding: 5px +} + +#footer p { + margin: 0; +} + +#footer a:link { + color: #ffffff; + text-decoration: underline + } +#footer a:visited { + color: #ffff00 + } +#footer a:hover { + background-color: #6060ff + } + + + addfile ./html/thaddock.css hunk ./html/thaddock.css 1 +html, body { + height:100%; + margin:0; + padding:0; +} + +body { + background-color:#FFFFFF; + color:#000000; + font-family:Helvetica,Arial,sans-serif; + font-size:small; + margin:3px 8px; + + max-width:956px; + padding-left:24px; +} + +#package-header { + background: #eaeaea url(haskell_icon.gif) no-repeat 5px 6px; + height: 2em; + margin: 0 0 0 -10px; + position: relative; +} + +#module-header .caption { + background:transparent none repeat scroll 0 0; + border:medium none; + font-size: 170%; + line-height: 130%; + margin:0 0 0 -10px; + /* padding:0.8em 0 0; */ + + background-color:#E5ECF9; + border-top:1px solid #3366CC; + padding:1px 3px; + font-weight: bold; + position: relative; +} + + +dl.info { + position: absolute; + display: block; + right: 1em; + top: 3em; + background-color:#FAFAFA; + border:1px solid #BBBBBB; + padding:0.99em; +} + +dl.info dt { + float: left; + clear: left; + width: 5em; + font-weight: bold; + margin: 0; + padding: 0; +} + +dl.info dd { + padding-left: 6em; + margin: 0; +} + +#description .caption, +#synopsis .caption, +h1 { + background-color:#E5ECF9; + border-top:1px solid #3366CC; + font-size:130%; + font-weight:bold; + margin:2em 0 0 -10px; + padding:1px 3px; + position:relative; +} + +#table-of-contents .caption, +h2 { + font-size:130%; + font-weight:bold; + margin:1.5em 0 0; + padding: 0; + top:0; +} + +#synopsis li.src * { + display: inline; +} + +#synopsis ul.subs, +#synopsis ul.subs li { + padding: 0 0 0 0.25em; + margin: 0; +} + +#footer { + color:#666666; + background-color: #eaeaea; + margin: 2em 0 0 -10px; + position: relative; +} + +#footer p { + margin: 0; + padding: 0.5em; + border-top: 1px solid #919191; +} + +ol, ul { + line-height:125%; + margin:0.5em 0 0 15px; + padding:0; +} + +li { + margin:0.3em 0 0 1.5em; + padding:0; +} + +p { + line-height:125%; + margin:0; + padding:0; +} + +h1 + p, h2 + p, h3 + p, +pre + p, +p + p { + padding-top: 1em; +} + +code, pre { + color:#007000; + font-family:monospace; +} + +pre { + background-color:#FAFAFA; + border:1px solid #BBBBBB; + font-size:9pt; + line-height:125%; + margin:1em 0 0; + overflow:auto; + padding:0.99em; +} + +code { + font-size:10pt; +} + +a, a:link { + color:#0000CC; +} + +ul.links { + list-style: none; + position: absolute; + right: 1px; + top: 0; +} + +ul.links li { + display: inline; + white-space: nowrap; + padding: 0 10px; + border-left: 1px solid #919191; + margin: 0; +} + +dl { + line-height:125%; + margin:0; + padding:0; +} + +dt { + font-weight:normal; + margin:0.75em 0 0; + padding:0; +} + +dd { + font-weight:normal; + margin:0.4em 0 0 2em; + padding:0; +} + +.top, .subs { + margin:0.4em 0 0 2em; + padding:0; +} + +.top .src { + font-family:monospace; + font-size:larger; + font-weight:bold; + margin:0.75em 0 0 -2em; + padding:0; +} + +.top .subs .src { + margin-left: 0; +} + +.arguments { + margin: 0 0 1em; +} +.arguments .caption, +.fields .caption { + display: none; +} + +.associated-types, +.constructors, +.methods { + background-color:#FAFAFA; + border:1px solid #BBBBBB; + padding:0.99em; +} + +.caption { + margin-top: 0; + padding-top: 0; +} + +.subs .caption { + font-weight: bold; + color: #919100; +} + +.subs td { + padding-right: 1em; + padding-left: 1em; +} hunk ./src/Haddock/Backends/Xhtml.hs 141 -copyHtmlBits odir libdir maybe_css = do +copyHtmlBits odir libdir _maybe_css = do hunk ./src/Haddock/Backends/Xhtml.hs 144 + {- hunk ./src/Haddock/Backends/Xhtml.hs 149 + -} hunk ./src/Haddock/Backends/Xhtml.hs 152 - copyFile css_file css_destination + --copyFile css_file css_destination + mapM_ copyLibFile cssFiles hunk ./src/Haddock/Backends/Xhtml.hs 207 - ]) ! [theclass "links"] + ] ++ stylePickers) ! [theclass "links"] hunk ./src/Haddock/Backends/Xhtml.hs 223 - ]) ! [theclass "links"] + ] ++ stylePickers) ! [theclass "links"] hunk ./src/Haddock/Backends/Xhtml/Util.hs 29 - documentCharacterEncoding, styleSheet + documentCharacterEncoding, + + cssFiles, styleSheet, stylePickers hunk ./src/Haddock/Backends/Xhtml/Util.hs 222 +-- Standard set of style sheets, first is the preferred +cssThemes :: [(String, String)] +cssThemes = [ + ("Classic", "xhaddock.css"), + ("Tibbe", "thaddock.css"), + ("Snappy", "shaddock.css") + ] + +cssFiles :: [String] +cssFiles = map snd cssThemes + hunk ./src/Haddock/Backends/Xhtml/Util.hs 234 -styleSheet = - (thelink ! [href cssFile, rel "stylesheet", thetype "text/css"]) noHtml +styleSheet = toHtml $ zipWith mkLink cssThemes rels + where + rels = ("stylesheet" : repeat "alternate stylesheet") + mkLink (aTitle, aFile) aRel = + (thelink ! [href aFile, rel aRel, thetype "text/css", Html.title aTitle]) noHtml hunk ./src/Haddock/Backends/Xhtml/Util.hs 240 +stylePickers :: [Html] +stylePickers = map mkPicker cssThemes + where + mkPicker (aTitle, aFile) = + let js = "setActiveStyleSheet('" ++ aFile ++ "'); return false;" in + anchor ! [href "#", onclick js] << aTitle + hunk ./html/haddock-util.js 139 + resetStyle(); // ugly: we are using setSynopsis as a hook! hunk ./html/haddock-util.js 144 - var i, a, main; - for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { - if(a.getAttribute("rel").indexOf("style") != -1 - && a.getAttribute("title")) { - a.disabled = true; - if(a.getAttribute("href") == href) a.disabled = false; - //a.disabled = a.getAttribute("title") != title; - } - } + var i, a, found = false; + for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { + if(a.getAttribute("rel").indexOf("style") != -1 + && a.getAttribute("title")) { + a.disabled = true; + // need to do this always, some browsers are edge triggered + if(a.getAttribute("href") == href) { + a.disabled = false; + found = true; + } + } + } + if (!found) href = ""; + document.cookie = "style=" + href + ";path=/"; + styleMenu(false); hunk ./html/haddock-util.js 160 + +function resetStyle() { + var nameEQ = "style="; + var s; + var ca = document.cookie.split(';'); + for(var i=0;i < ca.length;i++) { + var c = ca[i]; + while (c.charAt(0)==' ') c = c.substring(1,c.length); + if (c.indexOf(nameEQ) == 0) s = c.substring(nameEQ.length,c.length); + } + if (s) setActiveStyleSheet(s); +} + + +function styleMenu(show) { + var m = document.getElementById('style-menu'); + if (show == null) { show = m.className == "hide"; } + m.className = show ? "show" : "hide"; +} + hunk ./html/shaddock.css 136 - +.hide { display: none; } +.show { } hunk ./html/shaddock.css 149 +#package-header .caption { + font-size: 80%; + font-weight: bold; + padding-left: 26px; + padding-top: 2px; + padding-bottom: 3px; +} + hunk ./html/shaddock.css 234 +div#style-menu-holder { + position: relative; + z-index: 2; + display: inline; + margin: 0; + padding: 0; +} + +#style-menu { + position: absolute; + z-index: 1; + overflow: visible; + background-color: #3465a4; + margin: 0; + width: 6em; + text-align: center; + right: 0; + padding: 0 2px 1px; + border-left: 1px solid #fffffff; + border-right: 1px solid #fffffff; + border-bottom: 1px solid #fffffff; +} + +#style-menu li { + display: list-item; + border-style: none; + margin: 0; + padding: 3px; + color: #000; + list-style-type: none; +} + +#style-menu li + li { + border-top: 1px solid #ffffff; +} + hunk ./html/thaddock.css 25 +#package-header .caption { + margin-left: 30px; + padding-top: 6px; +} + + + +div#style-menu-holder { + position: relative; + z-index: 2; + display: inline; +} + +#style-menu { + position: absolute; + z-index: 1; + overflow: visible; + background-color: #eaeaea; + margin: 0; + width: 6em; + text-align: center; + right: 0; + padding: 0 2px 1px; + border-left: 1px solid #919191; + border-right: 1px solid #919191; + border-bottom: 1px solid #919191; +} + +#style-menu li { + display: list-item; + border-style: none; + margin: 0; + padding: 3px; + color: #000; + list-style-type: none; +} + +#style-menu li + li { + border-top: 1px solid #919191; +} + hunk ./html/thaddock.css 229 +.hide { display: none; } +.show { } + hunk ./html/xhaddock.css 79 +ul.links { + list-style: none; + text-align: left; + position: absolute; + right: 5px; + top: 5px; + display: inline-table; +} + +ul.links li { + display: inline; + border-left-width: 1px; + border-left-color: #ffffff; + border-left-style: solid; + white-space: nowrap; + padding: 1px 5px; +} + +.hide { display: none; } +.show { } hunk ./html/xhaddock.css 108 +#package-header .caption { + font-weight: normal; + font-style: normal; +} hunk ./html/xhaddock.css 117 -ul.links { - list-style: none; - text-align: left; +div#style-menu-holder { + position: relative; + z-index: 2; + display: inline; +} + +#style-menu { hunk ./html/xhaddock.css 125 - right: 5px; - top: 5px; - display: inline-table; + z-index: 1; + overflow: visible; + background-color: #000099; + margin: 0; + width: 6em; + text-align: center; + right: 0; + padding: 2px 2px 1px; hunk ./html/xhaddock.css 135 -ul.links li { - display: inline; - border-left-width: 1px; - border-left-color: #ffffff; - border-left-style: solid; - white-space: nowrap; - padding: 1px 5px; +#style-menu li { + display: list-item; + border-style: none; + margin: 0; + padding: 3px; + color: #000; + list-style-type: none; + border-top: 1px solid #ffffff; hunk ./src/Haddock/Backends/Xhtml.hs 207 - ] ++ stylePickers) ! [theclass "links"] + ] ++ [styleMenu]) ! [theclass "links"] hunk ./src/Haddock/Backends/Xhtml.hs 223 - ] ++ stylePickers) ! [theclass "links"] + ] ++ [styleMenu]) ! [theclass "links"] hunk ./src/Haddock/Backends/Xhtml/Util.hs 31 - cssFiles, styleSheet, stylePickers + cssFiles, styleSheet, stylePickers, styleMenu hunk ./src/Haddock/Backends/Xhtml/Util.hs 246 - + +styleMenu :: Html +styleMenu = thediv ! [identifier "style-menu-holder"] << [ + anchor ! [ href "#", onclick js ] << "Style\9662", + unordList stylePickers ! [ identifier "style-menu", theclass "hide" ] + ] + where + js = "styleMenu(); return false;" + hunk ./src/Haddock/Backends/Xhtml.hs 600 - body << thediv ! [ theclass "outer" ] << ( - (thediv ! [theclass "mini-topbar"] - << toHtml (moduleString mdl)) +++ + miniBody << + (divModuleHeader << sectionName << moduleString mdl +++ hunk ./src/Haddock/Backends/Xhtml.hs 656 - thediv ! [ theclass "mini-synopsis" ] - << hsep (map (processForMiniSynopsis mdl unicode) $ exports) + divInterface << mapMaybe (processForMiniSynopsis mdl unicode) exports hunk ./src/Haddock/Backends/Xhtml.hs 660 -processForMiniSynopsis :: Module -> Bool -> ExportItem DocName -> Html +processForMiniSynopsis :: Module -> Bool -> ExportItem DocName -> Maybe Html hunk ./src/Haddock/Backends/Xhtml.hs 662 - thediv ! [theclass "decl" ] << - case decl0 of - TyClD d@(TyFamily{}) -> ppTyFamHeader True False d unicode - TyClD d@(TyData{tcdTyPats = ps}) - | Nothing <- ps -> keyword "data" <+> ppTyClBinderWithVarsMini mdl d - | Just _ <- ps -> keyword "data" <+> keyword "instance" - <+> ppTyClBinderWithVarsMini mdl d - TyClD d@(TySynonym{tcdTyPats = ps}) - | Nothing <- ps -> keyword "type" <+> ppTyClBinderWithVarsMini mdl d - | Just _ <- ps -> keyword "type" <+> keyword "instance" - <+> ppTyClBinderWithVarsMini mdl d - TyClD d@(ClassDecl {}) -> - keyword "class" <+> ppTyClBinderWithVarsMini mdl d + ((divTopDecl <<).(declElem <<)) `fmap` case decl0 of + TyClD d -> let b = ppTyClBinderWithVarsMini mdl d in case d of + (TyFamily{}) -> Just $ ppTyFamHeader True False d unicode + (TyData{tcdTyPats = ps}) + | Nothing <- ps -> Just $ keyword "data" <+> b + | Just _ <- ps -> Just $ keyword "data" <+> keyword "instance" <+> b + (TySynonym{tcdTyPats = ps}) + | Nothing <- ps -> Just $ keyword "type" <+> b + | Just _ <- ps -> Just $ keyword "type" <+> keyword "instance" <+> b + (ClassDecl {}) -> Just $ keyword "class" <+> b + _ -> Nothing hunk ./src/Haddock/Backends/Xhtml.hs 674 - let nm = docNameOcc n - in ppNameMini mdl nm - _ -> noHtml + Just $ ppNameMini mdl (docNameOcc n) + _ -> Nothing hunk ./src/Haddock/Backends/Xhtml.hs 677 - let heading - | lvl == 1 = h1 - | lvl == 2 = h2 - | lvl >= 3 = h3 - | otherwise = error "bad group level" - in heading << docToHtml txt -processForMiniSynopsis _ _ _ = noHtml + Just $ groupTag lvl << docToHtml txt +processForMiniSynopsis _ _ _ = Nothing hunk ./src/Haddock/Backends/Xhtml/Layout.hs 14 + miniBody, + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 51 +miniBody :: Html -> Html +miniBody = body ! [identifier "mini"] + hunk ./src/Haddock/Backends/Xhtml.hs 36 -import qualified Text.XHtml as Html hunk ./src/Haddock/Backends/Xhtml.hs 394 - body << vanillaTable << Html.p << ( - foldr (+++) noHtml (map (+++br) mods)) + miniBody << divModuleList << + (sectionName << "Modules" +++ shortDeclList mods) hunk ./src/Haddock/Backends/Xhtml/Layout.hs 17 - divTableOfContents, divDescription, divSynposis, divInterface, - + divModuleList, divTableOfContents, + divDescription, divSynposis, divInterface, + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 60 -divTableOfContents, divDescription, divSynposis, divInterface :: Html -> Html +divModuleList, divTableOfContents, + divDescription, divSynposis, divInterface :: Html -> Html +divModuleList = thediv ! [identifier "module-list"] hunk ./src/Haddock/Backends/Xhtml.hs 50 +import Data.List ( intercalate ) hunk ./src/Haddock/Backends/Xhtml.hs 274 - simpleHeader doctitle Nothing maybe_index_url - maybe_source_url maybe_wiki_url +++ - vanillaTable << ( - ppPrologue doctitle prologue - ppModuleTree doctitle tree) +++ - footer + simpleHeader doctitle Nothing maybe_index_url + maybe_source_url maybe_wiki_url +++ + ppPrologue doctitle prologue +++ + ppModuleTree tree +++ + footer hunk ./src/Haddock/Backends/Xhtml.hs 294 -ppPrologue :: String -> Maybe (Doc GHC.RdrName) -> HtmlTable -ppPrologue _ Nothing = emptyTable -ppPrologue title (Just doc) = - (tda [theclass "section1"] << toHtml title) - (tda [theclass "doc"] << (rdrDocToHtml doc)) +ppPrologue :: String -> Maybe (Doc GHC.RdrName) -> Html +ppPrologue _ Nothing = noHtml +ppPrologue title (Just doc) = + divDescription << (h1 << title +++ rdrDocToHtml doc) hunk ./src/Haddock/Backends/Xhtml.hs 299 -ppModuleTree :: String -> [ModuleTree] -> HtmlTable -ppModuleTree _ ts = - tda [theclass "section1"] << toHtml "Modules" - td << vanillaTable2 << htmlTable - where - genTable tbl id_ [] = (tbl, id_) - genTable tbl id_ (x:xs) = genTable (tbl u) id' xs - where - (u,id') = mkNode [] x 0 id_ - - (htmlTable,_) = genTable emptyTable 0 ts +ppModuleTree :: [ModuleTree] -> Html +ppModuleTree ts = + divModuleList << (sectionName << "Modules" +++ mkNodeList [] "n" ts) hunk ./src/Haddock/Backends/Xhtml.hs 303 -mkNode :: [String] -> ModuleTree -> Int -> Int -> (HtmlTable,Int) -mkNode ss (Node s leaf pkg short ts) depth id_ = htmlNode +mkNodeList :: [String] -> String -> [ModuleTree] -> Html +mkNodeList ss p ts = case ts of + [] -> noHtml + _ -> unordList (zipWith (mkNode ss) ps ts) hunk ./src/Haddock/Backends/Xhtml.hs 308 - htmlNode = case ts of - [] -> (td_pad_w 1.25 depth << htmlModule <-> shortDescr <-> htmlPkg,id_) - _ -> (td_w depth << (collapsebutton id_s +++ htmlModule) <-> shortDescr <-> htmlPkg - (td_subtree << sub_tree), id') - - mod_width = 50::Int {-em-} - - td_pad_w :: Double -> Int -> Html -> HtmlTable - td_pad_w pad depth_ = - tda [thestyle ("padding-left: " ++ show pad ++ "em;" ++ - "width: " ++ show (mod_width - depth_*2) ++ "em")] - - td_w depth_ = - tda [thestyle ("width: " ++ show (mod_width - depth_*2) ++ "em")] - - td_subtree = - tda [thestyle ("padding: 0; padding-left: 2em")] - - shortDescr :: HtmlTable - shortDescr = case short of - Nothing -> cell $ td empty - Just doc -> tda [theclass "rdoc"] (origDocToHtml doc) - + ps = [ p ++ '.' : show i | i <- [(1::Int)..]] + +mkNode :: [String] -> String -> ModuleTree -> Html +mkNode ss p (Node s leaf pkg short ts) = + collBtn +++ htmlModule +++ shortDescr +++ htmlPkg +++ subtree + where + collBtn = case ts of + [] -> noHtml + _ -> collapsebutton p + hunk ./src/Haddock/Backends/Xhtml.hs 319 - | leaf = ppModule (mkModule (stringToPackageId pkgName) + | leaf = ppModule (mkModule (stringToPackageId (fromMaybe "" pkg)) hunk ./src/Haddock/Backends/Xhtml.hs 323 - -- ehm.. TODO: change the ModuleTree type - (htmlPkg, pkgName) = case pkg of - Nothing -> (td << empty, "") - Just p -> (td << toHtml p, p) - - mdl = foldr (++) "" (s' : map ('.':) ss') - (s':ss') = reverse (s:ss) - -- reconstruct the module name + mdl = intercalate "." (reverse (s:ss)) hunk ./src/Haddock/Backends/Xhtml.hs 325 - id_s = "n." ++ show id_ - - (sub_tree,id') = genSubTree emptyTable (id_+1) ts - - genSubTree :: HtmlTable -> Int -> [ModuleTree] -> (Html,Int) - genSubTree htmlTable id__ [] = (sub_tree_, id__) - where - sub_tree_ = collapsed vanillaTable2 id_s htmlTable - genSubTree htmlTable id__ (x:xs) = genSubTree (htmlTable u) id__' xs - where - (u,id__') = mkNode (s:ss) x (depth+1) id__ + shortDescr = maybe noHtml origDocToHtml short + htmlPkg = maybe noHtml toHtml pkg + + subtree = mkNodeList (s:ss) p ts ! [identifier p] hunk ./src/Haddock/Backends/Xhtml.hs 361 - (sectionName << "Modules" +++ shortDeclList mods) + (sectionName << "Modules" +++ unordList mods) hunk ./src/Haddock/Backends/Xhtml/Layout.hs 138 - instTable = (collapsed thediv id_ `fmap`) . subTable + instTable = fmap (thediv ! [identifier id_] <<) . subTable hunk ./src/Haddock/Backends/Xhtml/Util.hs 28 - collapsebutton, collapseId, collapsed, + collapsebutton, collapseId, hunk ./src/Haddock/Backends/Xhtml/Util.hs 209 -collapsed :: (HTML a) => (Html -> Html) -> String -> a -> Html -collapsed fn id_ html = - fn ! [identifier id_, thestyle "display:block;"] << html - hunk ./src/Haddock/Backends/Xhtml.hs 318 - htmlModule - | leaf = ppModule (mkModule (stringToPackageId (fromMaybe "" pkg)) + htmlModule = thespan ! [theclass "module" ] << + (if leaf + then ppModule (mkModule (stringToPackageId (fromMaybe "" pkg)) hunk ./src/Haddock/Backends/Xhtml.hs 322 - | otherwise = toHtml s - + else toHtml s + ) + hunk ./src/Haddock/Backends/Xhtml.hs 328 - htmlPkg = maybe noHtml toHtml pkg + htmlPkg = maybe noHtml (thespan ! [theclass "package"] <<) pkg hunk ./src/Haddock/Backends/Xhtml.hs 363 - (sectionName << "Modules" +++ unordList mods) + (sectionName << "Modules" +++ + ulist << [ li ! [theclass "module"] << m | m <- mods ]) hunk ./src/Haddock/Backends/Xhtml.hs 382 - let html = - header (documentCharacterEncoding +++ - thetitle (toHtml (doctitle ++ " (Index)")) +++ - styleSheet +++ - (script ! [src jsFile, thetype "text/javascript"] $ noHtml)) +++ - body << ( - simpleHeader doctitle maybe_contents_url Nothing - maybe_source_url maybe_wiki_url +++ - vanillaTable << index_html - ) + let html = indexPage split_indices Nothing + (if split_indices then [] else index) hunk ./src/Haddock/Backends/Xhtml.hs 399 - where - - index_html - | split_indices = - tda [theclass "section1"] << - toHtml ("Index") - indexInitialLetterLinks - | otherwise = - cell $ td << setTrClass (table ! [identifier "indexlist", cellpadding 0, cellspacing 5] << - aboves (map indexElt index)) - - -- an arbitrary heuristic: - -- too large, and a single-page will be slow to load - -- too small, and we'll have lots of letter-indexes with only one - -- or two members in them, which seems inefficient or - -- unnecessarily hard to use. - split_indices = length index > 150 - - setTrClass :: Html -> Html - setTrClass = id - -- XHtml is more strict about not allowing you to poke inside a structure - -- hence this approach won't work for now -- since the whole table is - -- going away soon, this is just disabled for now. -{- - setTrClass (Html xs) = Html $ map f xs - where - f (HtmlTag name attrs inner) - | map toUpper name == "TR" = HtmlTag name (theclass "indexrow":attrs) inner - | otherwise = HtmlTag name attrs (setTrClass inner) - f x = x --} - indexInitialLetterLinks = - td << setTrClass (table ! [cellpadding 0, cellspacing 5] << - besides [ td << anchor ! [href (subIndexHtmlFile c)] << - toHtml [c] - | c <- initialChars - , any ((==c) . toUpper . head . fst) index ]) - - -- todo: what about names/operators that start with Unicode - -- characters? - -- Exports beginning with '_' can be listed near the end, - -- presumably they're not as important... but would be listed - -- with non-split index! - initialChars = [ 'A'..'Z' ] ++ ":!#$%&*+./<=>?@\\^|-~" ++ "_" - - do_sub_index this_ix c - = unless (null index_part) $ - writeFile (joinPath [odir, subIndexHtmlFile c]) (renderToString html) - where - html = header (documentCharacterEncoding +++ - thetitle (toHtml (doctitle ++ " (Index)")) +++ - styleSheet) +++ - body << ( - simpleHeader doctitle maybe_contents_url Nothing - maybe_source_url maybe_wiki_url +++ - vanillaTable << ( - indexInitialLetterLinks - tda [theclass "section1"] << - toHtml ("Index (" ++ c:")") - td << setTrClass (table ! [identifier "indexlist", cellpadding 0, cellspacing 5] << - aboves (map indexElt index_part) ) - )) - - index_part = [(n,stuff) | (n,stuff) <- this_ix, toUpper (head n) == c] - - - index :: [(String, Map GHC.Name [(Module,Bool)])] - index = sortBy cmp (Map.toAscList full_index) - where cmp (n1,_) (n2,_) = map toUpper n1 `compare` map toUpper n2 - - -- for each name (a plain string), we have a number of original HsNames that - -- it can refer to, and for each of those we have a list of modules - -- that export that entity. Each of the modules exports the entity - -- in a visible or invisible way (hence the Bool). - full_index :: Map String (Map GHC.Name [(Module,Bool)]) - full_index = Map.fromListWith (flip (Map.unionWith (++))) - (concat (map getIfaceIndex ifaces)) - - getIfaceIndex iface = - [ (getOccString name - , Map.fromList [(name, [(mdl, name `elem` instVisibleExports iface)])]) - | name <- instExports iface ] - where mdl = instMod iface - - indexElt :: (String, Map GHC.Name [(Module,Bool)]) -> HtmlTable - indexElt (str, entities) = - case Map.toAscList entities of - [(nm,entries)] -> - tda [ theclass "indexentry" ] << toHtml str <-> - indexLinks nm entries - many_entities -> - tda [ theclass "indexentry" ] << toHtml str - aboves (map doAnnotatedEntity (zip [1..] many_entities)) - - doAnnotatedEntity :: (Integer, (Name, [(Module, Bool)])) -> HtmlTable - doAnnotatedEntity (j,(nm,entries)) - = tda [ theclass "indexannot" ] << - toHtml (show j) <+> parens (ppAnnot (nameOccName nm)) <-> - indexLinks nm entries hunk ./src/Haddock/Backends/Xhtml.hs 400 - ppAnnot n | not (isValOcc n) = toHtml "Type/Class" - | isDataOcc n = toHtml "Data Constructor" - | otherwise = toHtml "Function" + where + indexPage showLetters ch items = + header (documentCharacterEncoding +++ + thetitle (toHtml (doctitle ++ " (" ++ indexName ch ++ ")")) +++ + styleSheet +++ + (script ! [src jsFile, thetype "text/javascript"] $ noHtml) + ) +++ + body << + (simpleHeader doctitle maybe_contents_url Nothing + maybe_source_url maybe_wiki_url +++ + divIndex << + (sectionName << indexName ch +++ + (if showLetters then indexInitialLetterLinks else noHtml) +++ + (if null items then noHtml else buildIndex items) + ) + ) + + indexName ch = "Index" ++ maybe "" (\c -> " - " ++ [c]) ch + + buildIndex items = table << aboves (map indexElt items) hunk ./src/Haddock/Backends/Xhtml.hs 421 - indexLinks nm entries = - tda [ theclass "indexlinks" ] << - hsep (punctuate comma - [ if visible then - linkId mdl (Just nm) << toHtml (moduleString mdl) - else - toHtml (moduleString mdl) - | (mdl, visible) <- entries ]) + -- an arbitrary heuristic: + -- too large, and a single-page will be slow to load + -- too small, and we'll have lots of letter-indexes with only one + -- or two members in them, which seems inefficient or + -- unnecessarily hard to use. + split_indices = length index > 150 + + indexInitialLetterLinks = + unordList [ anchor ! [href (subIndexHtmlFile c)] << [c] + | c <- initialChars + , any ((==c) . toUpper . head . fst) index ] + + -- todo: what about names/operators that start with Unicode + -- characters? + -- Exports beginning with '_' can be listed near the end, + -- presumably they're not as important... but would be listed + -- with non-split index! + initialChars = [ 'A'..'Z' ] ++ ":!#$%&*+./<=>?@\\^|-~" ++ "_" + + do_sub_index this_ix c + = unless (null index_part) $ + writeFile (joinPath [odir, subIndexHtmlFile c]) (renderToString html) + where + html = indexPage True (Just c) index_part + index_part = [(n,stuff) | (n,stuff) <- this_ix, toUpper (head n) == c] + + + index :: [(String, Map GHC.Name [(Module,Bool)])] + index = sortBy cmp (Map.toAscList full_index) + where cmp (n1,_) (n2,_) = map toUpper n1 `compare` map toUpper n2 + + -- for each name (a plain string), we have a number of original HsNames that + -- it can refer to, and for each of those we have a list of modules + -- that export that entity. Each of the modules exports the entity + -- in a visible or invisible way (hence the Bool). + full_index :: Map String (Map GHC.Name [(Module,Bool)]) + full_index = Map.fromListWith (flip (Map.unionWith (++))) + (concat (map getIfaceIndex ifaces)) + + getIfaceIndex iface = + [ (getOccString name + , Map.fromList [(name, [(mdl, name `elem` instVisibleExports iface)])]) + | name <- instExports iface ] + where mdl = instMod iface + + indexElt :: (String, Map GHC.Name [(Module,Bool)]) -> HtmlTable + indexElt (str, entities) = + case Map.toAscList entities of + [(nm,entries)] -> + td ! [ theclass "src" ] << toHtml str <-> + indexLinks nm entries + many_entities -> + td ! [ theclass "src" ] << toHtml str <-> td << spaceHtml + aboves (map doAnnotatedEntity (zip [1..] many_entities)) + + doAnnotatedEntity :: (Integer, (Name, [(Module, Bool)])) -> HtmlTable + doAnnotatedEntity (j,(nm,entries)) + = td ! [ theclass "alt" ] << + toHtml (show j) <+> parens (ppAnnot (nameOccName nm)) <-> + indexLinks nm entries + + ppAnnot n | not (isValOcc n) = toHtml "Type/Class" + | isDataOcc n = toHtml "Data Constructor" + | otherwise = toHtml "Function" + + indexLinks nm entries = + td ! [ theclass "module" ] << + hsep (punctuate comma + [ if visible then + linkId mdl (Just nm) << toHtml (moduleString mdl) + else + toHtml (moduleString mdl) + | (mdl, visible) <- entries ]) hunk ./src/Haddock/Backends/Xhtml/Layout.hs 17 - divModuleList, divTableOfContents, + divIndex, divModuleList, divTableOfContents, hunk ./src/Haddock/Backends/Xhtml/Layout.hs 60 -divModuleList, divTableOfContents, - divDescription, divSynposis, divInterface :: Html -> Html +divIndex, divModuleList, divTableOfContents :: Html -> Html +divIndex = thediv ! [identifier "index"] hunk ./src/Haddock/Backends/Xhtml/Layout.hs 64 + +divDescription, divSynposis, divInterface :: Html -> Html hunk ./html/xhaddock.css 197 -#synopsis .caption { +#synopsis .caption, +#module-list .caption { hunk ./html/xhaddock.css 387 -/* @group Original Selectors */ - -/* --------- Contents page ---------- */ hunk ./html/xhaddock.css 388 -div.node { - padding-left: 3em; +#module-list ul { + list-style: none; + margin-left: 10px; + padding-bottom: 15px; hunk ./html/xhaddock.css 394 -div.cnode { - padding-left: 1.75em; +#mini #module-list .caption { + display: none; hunk ./html/xhaddock.css 398 -span.pkg { - position: absolute; - left: 50em; +#index .caption { + display: none; hunk ./html/xhaddock.css 402 -/* --------- Mini Synopsis for Frame View --------- */ +#index .src { + background: none; + font-family: inherit; +} hunk ./html/xhaddock.css 407 -.outer { - margin: 0 0; - padding: 0 0; +#index td.alt { + padding-left: 2em; hunk ./html/xhaddock.css 411 -.mini-synopsis { - padding: 0.25em 0.25em; +#index td { + padding-top: 2px; + padding-bottom: 1px; + padding-right: 1em; hunk ./html/xhaddock.css 417 -.mini-synopsis h1 { font-size: 130%; } -.mini-synopsis h2 { font-size: 110%; } -.mini-synopsis h3 { font-size: 100%; } -.mini-synopsis h1, .mini-synopsis h2, .mini-synopsis h3 { + +#mini h1 { font-size: 130%; } +#mini h2 { font-size: 110%; } +#mini h3 { font-size: 100%; } +#mini h1, #mini h2, #mini h3 { hunk ./html/xhaddock.css 427 -.mini-synopsis h1 { border-bottom: 1px solid #ccc; } +#mini h1 { border-bottom: 1px solid #ccc; } hunk ./html/xhaddock.css 429 -.mini-topbar { +#mini #module-header { + margin: 0; + padding: 0; +} +#mini #module-header .caption { hunk ./html/xhaddock.css 437 + height: inherit; + margin: 0; hunk ./html/xhaddock.css 441 -/* @end */ - +#mini #interface .top { + margin: 0; + padding: 0; +} +#mini #interface .src { + margin: 0; + padding: 0; + font-family: inherit; + background: inherit; +} hunk ./src/Haddock/Backends/Xhtml/Layout.hs 36 - - vanillaTable, vanillaTable2 hunk ./src/Haddock/Backends/Xhtml/Layout.hs 95 +{- + if we ever decide to style sub-declarations with dl lists, this code does it + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 109 +-} hunk ./src/Haddock/Backends/Xhtml/Layout.hs 182 - - --- a vanilla table has width 100%, no border, no padding, no spacing -vanillaTable, vanillaTable2 :: Html -> Html -vanillaTable = table ! [theclass "vanilla", cellspacing 0, cellpadding 0] -vanillaTable2 = table ! [theclass "vanilla2", cellspacing 0, cellpadding 0] hunk ./src/Haddock/Backends/Xhtml/Decl.hs 155 - Nothing -> empty + Nothing -> noHtml hunk ./src/Haddock/Backends/Xhtml/Decl.hs 282 -ppContextNoArrow [] _ = empty +ppContextNoArrow [] _ = noHtml hunk ./src/Haddock/Backends/Xhtml/Decl.hs 287 -ppContextNoLocs [] _ = empty +ppContextNoLocs [] _ = noHtml hunk ./src/Haddock/Backends/Xhtml/Decl.hs 296 -pp_hs_context [] _ = empty +pp_hs_context [] _ = noHtml hunk ./src/Haddock/Backends/Xhtml/Decl.hs 318 - <+> (if not . null . unLoc $ lctxt then ppLContext lctxt unicode else empty) + <+> (if not . null . unLoc $ lctxt then ppLContext lctxt unicode else noHtml) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 447 - | null cons = empty + | null cons = noHtml hunk ./src/Haddock/Backends/Xhtml/Decl.hs 450 - _ -> empty + _ -> noHtml hunk ./src/Haddock/Backends/Xhtml/Decl.hs 523 - Implicit -> empty + Implicit -> noHtml hunk ./src/Haddock/Backends/Xhtml/Decl.hs 611 -ppBang HsNoBang = empty +ppBang HsNoBang = noHtml hunk ./src/Haddock/Backends/Xhtml/Util.hs 19 - (<+>), char, empty, nonEmpty, + (<+>), char, nonEmpty, hunk ./src/Haddock/Backends/Xhtml/Util.hs 25 - tda, emptyTable, s8, - abovesSep, hsep, + hsep, hunk ./src/Haddock/Backends/Xhtml/Util.hs 111 -empty :: Html -empty = noHtml - hunk ./src/Haddock/Backends/Xhtml/Util.hs 134 -abovesSep :: HtmlTable -> [HtmlTable] -> HtmlTable -abovesSep _ [] = emptyTable -abovesSep h (d0:ds) = go d0 ds - where - go d [] = d - go d (e:es) = d h go e es - hunk ./src/Haddock/Backends/Xhtml/Util.hs 144 -tda :: [HtmlAttr] -> Html -> HtmlTable -tda as = cell . (td ! as) - -emptyTable :: HtmlTable -emptyTable = cell noHtml - hunk ./src/Haddock/Backends/Xhtml/Util.hs 159 -s8 :: HtmlTable -s8 = tda [ theclass "s8" ] << noHtml - hunk ./src/Haddock/Backends/Xhtml/Util.hs 39 -import qualified Text.XHtml as Html +import qualified Text.XHtml as XHtml hunk ./src/Haddock/Backends/Xhtml/Util.hs 168 -namedAnchor n c = anchor ! [Html.name n] << c +namedAnchor n c = anchor ! [XHtml.name n] << c hunk ./src/Haddock/Backends/Xhtml/Util.hs 214 - (thelink ! [href aFile, rel aRel, thetype "text/css", Html.title aTitle]) noHtml + (thelink ! [href aFile, rel aRel, thetype "text/css", XHtml.title aTitle]) noHtml hunk ./html/haddock-util.js 139 - resetStyle(); // ugly: we are using setSynopsis as a hook! hunk ./src/Haddock/Backends/Xhtml.hs 156 + +headHtml :: String -> Maybe String -> Html +headHtml docTitle miniPage = + header << [ + meta ! [httpequiv "Content-Type", content "text/html; charset=UTF-8"], + thetitle << docTitle, + styleSheet, + script ! [src jsFile, thetype "text/javascript"] << noHtml, + script ! [thetype "text/javascript"] + -- NB: Within XHTML, the content of script tags needs to be + -- a " in it! + << primHtml ( + "//\n") + ] + where + setSynopsis = maybe "" (\p -> "setSynopsis(\"" ++ p ++ "\");") miniPage + + hunk ./src/Haddock/Backends/Xhtml.hs 288 - header - (documentCharacterEncoding +++ - thetitle (toHtml doctitle) +++ - styleSheet +++ - (script ! [src jsFile, thetype "text/javascript"] $ noHtml)) +++ + headHtml doctitle Nothing +++ hunk ./src/Haddock/Backends/Xhtml.hs 373 - header - (documentCharacterEncoding +++ - thetitle (toHtml doctitle) +++ - styleSheet +++ - (script ! [src jsFile, thetype "text/javascript"] $ noHtml)) +++ + headHtml doctitle Nothing +++ hunk ./src/Haddock/Backends/Xhtml.hs 414 - header (documentCharacterEncoding +++ - thetitle (toHtml (doctitle ++ " (" ++ indexName ch ++ ")")) +++ - styleSheet +++ - (script ! [src jsFile, thetype "text/javascript"] $ noHtml) - ) +++ + headHtml (doctitle ++ " (" ++ indexName ch ++ ")") Nothing +++ hunk ./src/Haddock/Backends/Xhtml.hs 518 - header (documentCharacterEncoding +++ - thetitle (toHtml mdl_str) +++ - styleSheet +++ - (script ! [src jsFile, thetype "text/javascript"] $ noHtml) +++ - (script ! [thetype "text/javascript"] - -- NB: Within XHTML, the content of script tags needs to be - -- a CDATA section. Will break if the generated name could - -- have "]]>" in it! - << primHtml ( - "//\n") - ) - ) +++ + headHtml mdl_str (Just $ "mini_" ++ moduleHtmlFile mdl) +++ hunk ./src/Haddock/Backends/Xhtml.hs 534 - header - (documentCharacterEncoding +++ - thetitle (toHtml $ moduleString mdl) +++ - styleSheet +++ - (script ! [src jsFile, thetype "text/javascript"] $ noHtml)) +++ + headHtml (moduleString mdl) Nothing +++ hunk ./src/Haddock/Backends/Xhtml/Util.hs 28 - documentCharacterEncoding, hunk ./src/Haddock/Backends/Xhtml/Util.hs 193 -documentCharacterEncoding :: Html -documentCharacterEncoding = - meta ! [httpequiv "Content-Type", content "text/html; charset=UTF-8"] hunk ./src/Haddock/Backends/Xhtml.hs 216 -simpleHeader :: String -> Maybe String -> Maybe String - -> SourceURLs -> WikiURLs -> Html -simpleHeader doctitle maybe_contents_url maybe_index_url - maybe_source_url maybe_wiki_url = - divPackageHeader << ( - sectionName << nonEmpty doctitle +++ - unordList (catMaybes [ - srcButton maybe_source_url Nothing, - wikiButton maybe_wiki_url Nothing, - contentsButton maybe_contents_url, - indexButton maybe_index_url - ] ++ [styleMenu]) ! [theclass "links"] - ) hunk ./src/Haddock/Backends/Xhtml.hs 217 -pageHeader :: String -> Interface -> String +bodyHtml :: String -> Maybe Interface hunk ./src/Haddock/Backends/Xhtml.hs 219 - -> Maybe String -> Maybe String -> Html -pageHeader mdl iface doctitle + -> Maybe String -> Maybe String + -> Html -> Html +bodyHtml doctitle iface hunk ./src/Haddock/Backends/Xhtml.hs 223 - maybe_contents_url maybe_index_url = - divPackageHeader << ( - sectionName << nonEmpty doctitle +++ - unordList (catMaybes [ - srcButton maybe_source_url (Just iface), - wikiButton maybe_wiki_url (Just $ ifaceMod iface), + maybe_contents_url maybe_index_url + pageContent = + body << [ + divPackageHeader << [ + sectionName << nonEmpty doctitle, + unordList (catMaybes [ + srcButton maybe_source_url iface, + wikiButton maybe_wiki_url (ifaceMod `fmap` iface), hunk ./src/Haddock/Backends/Xhtml.hs 234 - ) +++ - divModuleHeader << ( - sectionName << mdl +++ - moduleInfo iface - ) + ], + pageContent, + footer + ] hunk ./src/Haddock/Backends/Xhtml.hs 278 - body << ( - simpleHeader doctitle Nothing maybe_index_url - maybe_source_url maybe_wiki_url +++ - ppPrologue doctitle prologue +++ - ppModuleTree tree +++ - footer - ) + bodyHtml doctitle Nothing + maybe_source_url maybe_wiki_url + Nothing maybe_index_url << [ + ppPrologue doctitle prologue, + ppModuleTree tree + ] hunk ./src/Haddock/Backends/Xhtml.hs 403 - body << - (simpleHeader doctitle maybe_contents_url Nothing - maybe_source_url maybe_wiki_url +++ - divIndex << + bodyHtml doctitle Nothing + maybe_source_url maybe_wiki_url + maybe_contents_url Nothing << + divIndex << hunk ./src/Haddock/Backends/Xhtml.hs 411 - ) hunk ./src/Haddock/Backends/Xhtml.hs 506 - body << ( - pageHeader mdl_str iface doctitle - maybe_source_url maybe_wiki_url - maybe_contents_url maybe_index_url +++ - ifaceToHtml maybe_source_url maybe_wiki_url iface unicode +++ - footer) + bodyHtml doctitle (Just iface) + maybe_source_url maybe_wiki_url + maybe_contents_url maybe_index_url << [ + divModuleHeader << (sectionName << mdl_str +++ moduleInfo iface), + ifaceToHtml maybe_source_url maybe_wiki_url iface unicode + ] hunk ./src/Haddock/Backends/Xhtml.hs 176 -footer :: Html -footer = - divFooter << paragraph << ( - "Produced by " +++ - (anchor ! [href projectUrl] << toHtml projectName) +++ - (" version " ++ projectVersion) - ) - hunk ./src/Haddock/Backends/Xhtml.hs 228 - footer + divFooter << paragraph << ( + "Produced by " +++ + (anchor ! [href projectUrl] << toHtml projectName) +++ + (" version " ++ projectVersion) + ) hunk ./html/shaddock.css 166 -#synopsis .caption { +#synopsis .caption, +#index .caption, +#module-list .caption { hunk ./html/shaddock.css 176 -h2 { +h2 +{ hunk ./html/shaddock.css 184 -h3 { +h3, +#mini #module-list .caption { hunk ./html/shaddock.css 392 +#index td { + background-color: #f0f0f0; + padding-left: 1em; + padding-right: 1em; +} +#index td.alt { + font-size: 70%; + font-style: italic; + padding-left: 3em; +} + hunk ./html/shaddock.css 405 +body#mini { + width: auto; + padding: 0; + background-color: #ffffff; + color: #000000; + font-size: 90%; + font-family: DroidSerif, Georgia, serif; + margin: 0.5em; +} + +#mini div { + padding: 0 10px; +} hunk ./html/shaddock.css 419 +#module-list ul { + list-style: none; + margin-top: 0.5em; +} hunk ./html/thaddock.css 280 +#index .caption, +#module-list .caption { + font-size:130%; + font-weight:bold; + padding: 0; + top:0; + margin: 0.5em 0; +} + +#index table { + border-spacing: 0; +} +#index td { + padding-right: 1em; + border-top: 1px solid #eaeaea; + padding-top: 2px; + padding-bottom: 2px; +} + +#index td.alt { + padding-left: 2em; + font-style: italic; + font-size: 80%; +} + +.module { +} + +#mini { + padding: 0; + margin: 0 0 0 10px; +} + +#mini h1, #mini h2, #mini h3, #mini h4 { + margin-top: 0.5em; + color: #a9a9a9; +} + +#mini h1 { + background-color: #eff2f9; +} + +#module-list ul { + list-style: none; + margin: 0 0 0 -10px; + padding: 0; +} + +#module-list li { + margin: 0; + border-top: 1px solid #eaeaea; + padding-top: 2px; + padding-bottom: 2px; + padding-left: 10px; +} + +#mini #interface .top, +#mini #interface .src { + margin-top: 2px; + font-weight: normal; + font-style: normal; +} + +#mini #interface .src a { + font-weight: bold; +} hunk ./html/shaddock.css 392 + +#alphabet ul { + list-style: none; + padding: 0; + margin: 0.5em 0 0; + font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif; + font-weight: bold; +} + +#alphabet li { + display: inline; + margin: 0 0.25em; +} + +#alphabet a { + text-decoration: none; +} + hunk ./html/shaddock.css 441 + +#module-list .package { + float: right; +} hunk ./html/thaddock.css 305 +#alphabet ul { + list-style: none; + padding: 0; + margin: 0.5em 0 0; +} + +#alphabet li { + display: inline; + margin: 0 0.25em; +} + +#alphabet a { + text-decoration: none; + font-weight: bold; +} + hunk ./html/thaddock.css 340 - margin: 0 0 0 -10px; hunk ./html/thaddock.css 341 + margin: 0; hunk ./html/thaddock.css 347 - padding-top: 2px; - padding-bottom: 2px; - padding-left: 10px; + padding: 2px 0 2px 1.4em; +} + +#module-list li .package { + float: right; hunk ./html/xhaddock.css 198 -#module-list .caption { +#module-list .caption, +#index .caption { hunk ./html/xhaddock.css 391 - margin-left: 10px; hunk ./html/xhaddock.css 392 + padding-left: 2px; + margin: 0; hunk ./html/xhaddock.css 396 +#module-list ul ul { + padding-bottom: 0; + padding-left: 20px; +} + +#module-list li .package { + float: right; +} hunk ./html/xhaddock.css 409 - display: none; +} + +#alphabet ul { + list-style: none; + padding: 0; + margin: 0.5em 0 0; +} + +#alphabet li { + display: inline; + margin: 0 0.2em; hunk ./src/Haddock/Backends/Xhtml.hs 401 - maybe_contents_url Nothing << - divIndex << - (sectionName << indexName ch +++ - (if showLetters then indexInitialLetterLinks else noHtml) +++ - (if null items then noHtml else buildIndex items) - ) + maybe_contents_url Nothing << [ + if showLetters then indexInitialLetterLinks else noHtml, + if null items then noHtml else + divIndex << [sectionName << indexName ch, buildIndex items] + ] hunk ./src/Haddock/Backends/Xhtml.hs 418 - indexInitialLetterLinks = + indexInitialLetterLinks = + divAlphabet << hunk ./src/Haddock/Backends/Xhtml/Layout.hs 17 - divIndex, divModuleList, divTableOfContents, + divIndex, divAlphabet, divModuleList, divTableOfContents, hunk ./src/Haddock/Backends/Xhtml/Layout.hs 58 -divIndex, divModuleList, divTableOfContents :: Html -> Html +divIndex, divAlphabet, divModuleList, divTableOfContents :: Html -> Html hunk ./src/Haddock/Backends/Xhtml/Layout.hs 60 +divAlphabet = thediv ! [identifier "alphabet"] hunk ./src/Haddock/Backends/Xhtml/Layout.hs 17 - divIndex, divAlphabet, divModuleList, divTableOfContents, - divDescription, divSynposis, divInterface, + divTableOfContents, divDescription, divSynposis, divInterface, + divIndex, divAlphabet, divModuleList, hunk ./src/Haddock/Backends/Xhtml/Layout.hs 53 -divPackageHeader, divModuleHeader, divFooter :: Html -> Html -divPackageHeader = thediv ! [identifier "package-header"] -divModuleHeader = thediv ! [identifier "module-header"] -divFooter = thediv ! [identifier "footer"] hunk ./src/Haddock/Backends/Xhtml/Layout.hs 54 -divIndex, divAlphabet, divModuleList, divTableOfContents :: Html -> Html -divIndex = thediv ! [identifier "index"] -divAlphabet = thediv ! [identifier "alphabet"] -divModuleList = thediv ! [identifier "module-list"] -divTableOfContents = thediv ! [identifier "table-of-contents"] +sectionDiv :: String -> Html -> Html +sectionDiv i = thediv ! [identifier i] hunk ./src/Haddock/Backends/Xhtml/Layout.hs 57 -divDescription, divSynposis, divInterface :: Html -> Html -divDescription = thediv ! [identifier "description"] -divSynposis = thediv ! [identifier "synopsis"] -divInterface = thediv ! [identifier "interface"] - --- | The name of a section, used directly after opening a section hunk ./src/Haddock/Backends/Xhtml/Layout.hs 61 +divPackageHeader, divModuleHeader, divFooter, + divTableOfContents, divDescription, divSynposis, divInterface, + divIndex, divAlphabet, divModuleList + :: Html -> Html + +divPackageHeader = sectionDiv "package-header" +divModuleHeader = sectionDiv "module-header" +divFooter = sectionDiv "footer" +divTableOfContents = sectionDiv "table-of-contents" +divDescription = sectionDiv "description" +divSynposis = sectionDiv "synopsis" +divInterface = sectionDiv "interface" +divIndex = sectionDiv "index" +divAlphabet = sectionDiv "alphabet" +divModuleList = sectionDiv "module-list" + + + hunk ./html/shaddock.css 62 -div { +div#content { hunk ./html/shaddock.css 65 - hunk ./html/shaddock.css 66 +div#module-header { + margin: 0 -30px; +} + hunk ./src/Haddock/Backends/Xhtml.hs 227 - pageContent, + divContent << pageContent, hunk ./src/Haddock/Backends/Xhtml/Layout.hs 16 - divPackageHeader, divModuleHeader, divFooter, + divPackageHeader, divContent, divModuleHeader, divFooter, hunk ./src/Haddock/Backends/Xhtml/Layout.hs 61 -divPackageHeader, divModuleHeader, divFooter, +divPackageHeader, divContent, divModuleHeader, divFooter, hunk ./src/Haddock/Backends/Xhtml/Layout.hs 67 +divContent = sectionDiv "content" hunk ./src/Haddock/Backends/Xhtml.hs 297 - divDescription << (h1 << title +++ rdrDocToHtml doc) + docElement divDescription << (h1 << title +++ rdrDocToHtml doc) hunk ./src/Haddock/Backends/Xhtml.hs 546 - sectionName << "Description" +++ docToHtml doc + sectionName << "Description" +++ docSection doc hunk ./src/Haddock/Backends/Xhtml.hs 657 - = nothingIf summary $ docToHtml doc + = nothingIf summary $ docSection doc hunk ./src/Haddock/Backends/Xhtml/Decl.hs 68 - | Map.null argDocs = topDeclElem links loc docname pref1 +++ maybeDocToHtml doc + | Map.null argDocs = topDeclElem links loc docname pref1 +++ maybeDocSection doc hunk ./src/Haddock/Backends/Xhtml/Decl.hs 70 - subArguments (do_args 0 sep typ) +++ maybeDocToHtml doc + subArguments (do_args 0 sep typ) +++ maybeDocSection doc hunk ./src/Haddock/Backends/Xhtml/Decl.hs 163 - | otherwise = header_ +++ maybeDocToHtml mbDoc +++ instancesBit + | otherwise = header_ +++ maybeDocSection mbDoc +++ instancesBit hunk ./src/Haddock/Backends/Xhtml/Decl.hs 203 - | otherwise = header_ +++ maybeDocToHtml mbDoc + | otherwise = header_ +++ maybeDocSection mbDoc hunk ./src/Haddock/Backends/Xhtml/Decl.hs 358 - | otherwise = classheader +++ maybeDocToHtml mbDoc + | otherwise = classheader +++ maybeDocSection mbDoc hunk ./src/Haddock/Backends/Xhtml/Decl.hs 436 - | otherwise = header_ +++ maybeDocToHtml mbDoc +++ constrBit +++ instancesBit + | otherwise = header_ +++ maybeDocSection mbDoc +++ constrBit +++ instancesBit hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 14 - docToHtml, maybeDocToHtml, + docToHtml, hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 16 - origDocToHtml + origDocToHtml, + + docElement, docSection, maybeDocSection, hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 90 -maybeDocToHtml :: Maybe (Doc DocName) -> Html -maybeDocToHtml = maybe noHtml docToHtml + + +docElement :: (ADDATTRS a) => a -> a +docElement = (! [theclass "doc"]) + +docSection :: Doc DocName -> Html +docSection = (docElement thediv <<) . docToHtml + +maybeDocSection :: Maybe (Doc DocName) -> Html +maybeDocSection = maybe noHtml docSection + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 112 - ddef << (fmap docToHtml mdoc `with` subs) + docElement ddef << (fmap docToHtml mdoc `with` subs) hunk ./src/Haddock/Backends/Xhtml/Layout.hs 125 - td << nonEmpty (fmap docToHtml mdoc)) + docElement td << nonEmpty (fmap docToHtml mdoc)) hunk ./src/Haddock/Backends/DevHelp.hs 85 - text "text (escapeStr (getOccString name))<>text"\" link=\""<>text (nameHtmlRef mdl (nameOccName name))<>text"\"/>" $$ + text "text (escapeStr (getOccString name))<>text"\" link=\""<>text (moduleNameUrl mdl (nameOccName name))<>text"\"/>" $$ hunk ./src/Haddock/Backends/HH.hs 128 - text " text (nameHtmlRef mdl name) <> text "\">" $$ + text " text (moduleNameURL mdl name) <> text "\">" $$ hunk ./src/Haddock/Backends/HH2.hs 117 - ppJump name (Module mdl) = text " text (nameHtmlRef mdl name) <> text "\"/>" + ppJump name (Module mdl) = text " text (moduleNameUrl mdl name) <> text "\"/>" hunk ./src/Haddock/Backends/Html.hs 732 - anchor ! [ href ( moduleHtmlFile mdl ++ "#" - ++ (escapeStr (anchorNameStr nm))) + anchor ! [ href (moduleNameUrl mdl nm) hunk ./src/Haddock/Backends/Html.hs 1671 -linkTarget n = namedAnchor (anchorNameStr n) << toHtml "" +linkTarget n = namedAnchor (nameAnchorId n) << toHtml "" hunk ./src/Haddock/Backends/Html.hs 1680 -ppBinder True n = linkedAnchor (anchorNameStr n) << ppBinder' n +ppBinder True n = linkedAnchor (nameAnchorId n) << ppBinder' n hunk ./src/Haddock/Backends/Html.hs 1698 - Nothing -> moduleHtmlFile mdl - Just name -> nameHtmlRef mdl name + Nothing -> moduleUrl mdl + Just name -> moduleNameUrl mdl name hunk ./src/Haddock/Backends/Xhtml.hs 321 - (mkModuleName mdl)) "" + (mkModuleName mdl)) hunk ./src/Haddock/Backends/Xhtml.hs 600 - anchor ! [ href ( moduleHtmlFile mdl ++ "#" - ++ (escapeStr (anchorNameStr nm))) + anchor ! [ href (moduleNameUrl mdl nm) hunk ./src/Haddock/Backends/Xhtml.hs 658 - = processDeclOneLiner summary $ toHtml "module" <+> ppModule mdl "" + = processDeclOneLiner summary $ toHtml "module" <+> ppModule mdl hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 42 - in ppModule (mkModuleNoPackage mdl) ref, + in ppModuleRef (mkModuleNoPackage mdl) ref, hunk ./src/Haddock/Backends/Xhtml/Names.hs 16 - ppModule, + ppModule, ppModuleRef, hunk ./src/Haddock/Backends/Xhtml/Names.hs 53 -ppBinder True n = linkedAnchor (anchorNameStr n) << ppBinder' n -ppBinder False n = namedAnchor (anchorNameStr n) << bold << ppBinder' n +ppBinder True n = linkedAnchor (nameAnchorId n) << ppBinder' n +ppBinder False n = namedAnchor (nameAnchorId n) << bold << ppBinder' n hunk ./src/Haddock/Backends/Xhtml/Names.hs 68 -linkIdOcc mdl mbName = anchor ! [href uri] +linkIdOcc mdl mbName = anchor ! [href url] hunk ./src/Haddock/Backends/Xhtml/Names.hs 70 - uri = case mbName of - Nothing -> moduleHtmlFile mdl - Just name -> nameHtmlRef mdl name + url = case mbName of + Nothing -> moduleUrl mdl + Just name -> moduleNameUrl mdl name hunk ./src/Haddock/Backends/Xhtml/Names.hs 74 -ppModule :: Module -> String -> Html -ppModule mdl ref = anchor ! [href ((moduleHtmlFile mdl) ++ ref)] - << toHtml (moduleString mdl) +ppModule :: Module -> Html +ppModule mdl = anchor ! [href (moduleUrl mdl)] + << toHtml (moduleString mdl) hunk ./src/Haddock/Backends/Xhtml/Names.hs 78 +ppModuleRef :: Module -> String -> Html +ppModuleRef mdl ref = anchor ! [href (moduleUrl mdl ++ ref)] + << toHtml (moduleString mdl) + -- NB: The ref paramaeter already includes the '#'. + -- This function is only called from markupModule expanding a + -- DocModule, which doesn't seem to be ever be used. hunk ./src/Haddock/Backends/Xhtml/Util.hs 160 --- --- This used to generate two anchor tags, one with the name unescaped, and one --- with the name URI-escaped. This is needed because Opera 9.52 (and later --- versions) needs the name to be unescaped, while IE 7 needs it to be escaped. --- The escaped form for IE 7 is probably erroneous and not needed... - hunk ./src/Haddock/Backends/Xhtml/Util.hs 161 -namedAnchor n c = anchor ! [XHtml.name n] << c +namedAnchor n = anchor ! [XHtml.name n] hunk ./src/Haddock/Backends/Xhtml/Util.hs 164 -linkedAnchor frag = anchor ! [href hr_] - where hr_ | null frag = "" - | otherwise = '#': escapeStr frag - -- this escape function is over-zealous for the fragment part of a URI - -- (':' for example does not need to be escaped) +linkedAnchor n = anchor ! [href ('#':n)] hunk ./src/Haddock/Utils.hs 20 - moduleHtmlFile, nameHtmlRef, + moduleHtmlFile, hunk ./src/Haddock/Utils.hs 25 - anchorNameStr, hunk ./src/Haddock/Utils.hs 27 + -- * Anchor and URL utilities + moduleNameUrl, moduleUrl, + nameAnchorId, + makeAnchorId, + hunk ./src/Haddock/Utils.hs 65 -import Data.Char ( isAlpha, ord, chr ) +import Data.Char ( isAlpha, isAlphaNum, isAscii, ord, chr ) hunk ./src/Haddock/Utils.hs 183 -nameHtmlRef :: Module -> OccName -> String -nameHtmlRef mdl n = moduleHtmlFile mdl ++ '#':escapeStr (anchorNameStr n) - hunk ./src/Haddock/Utils.hs 208 -anchorNameStr :: OccName -> String -anchorNameStr name | isValOcc name = "v:" ++ occNameString name - | otherwise = "t:" ++ occNameString name +-- ----------------------------------------------------------------------------- +-- Anchor and URL utilities +-- +-- NB: Anchor IDs, used as the destination of a link within a document must +-- conform to XML's NAME production. That, taken with XHTML and HTML 4.01's +-- various needs and compatibility constraints, means these IDs have to match: +-- [A-Za-z][A-Za-z0-9:_.-]* +-- Such IDs do not need to be escaped in any way when used as the fragment part +-- of a URL. Indeed, %-escaping them can lead to compatibility issues as it +-- isn't clear if such fragment identifiers should, or should not be unescaped +-- before being matched with IDs in the target document. + +moduleUrl :: Module -> String +moduleUrl = moduleHtmlFile + +moduleNameUrl :: Module -> OccName -> String +moduleNameUrl mdl n = moduleUrl mdl ++ '#' : nameAnchorId n + +nameAnchorId :: OccName -> String +nameAnchorId name = makeAnchorId (prefix : ':' : occNameString name) + where prefix | isValOcc name = 'v' + | otherwise = 't' hunk ./src/Haddock/Utils.hs 231 +-- | Takes an arbitrary string and makes it a valid anchor ID. The mapping is +-- identity preserving. +makeAnchorId :: String -> String +makeAnchorId [] = [] +makeAnchorId (f:r) = escape isAlpha f ++ concatMap (escape isLegal) r + where + escape p c | p c = [c] + | otherwise = '-' : (show (ord c)) ++ "-" + isLegal ':' = True + isLegal '_' = True + isLegal '.' = True + isLegal c = isAscii c && isAlphaNum c + -- NB: '-' is legal in IDs, but we use it as the escape char hunk ./src/Haddock/Utils.hs 303 - +-- NB: These functions do NOT escape Unicode strings for URLs as per the RFCs hunk ./html/shaddock.css 118 +.def { + font-weight: bold; +} + hunk ./html/xhaddock.css 79 +.def { + font-weight: bold; +} + hunk ./src/Haddock/Backends/Xhtml/Names.hs 54 -ppBinder False n = namedAnchor (nameAnchorId n) << bold << ppBinder' n +ppBinder False n = namedAnchor (nameAnchorId n) ! [theclass "def"] + << ppBinder' n move ./src/Haddock/Backends/Xhtml/Util.hs ./src/Haddock/Backends/Xhtml/Utils.hs hunk ./haddock.cabal 120 - Haddock.Backends.Xhtml.Util + Haddock.Backends.Xhtml.Utils hunk ./haddock.cabal 187 - Haddock.Backends.Xhtml.Util + Haddock.Backends.Xhtml.Utils hunk ./src/Haddock/Backends/Xhtml.hs 30 -import Haddock.Backends.Xhtml.Util +import Haddock.Backends.Xhtml.Utils hunk ./src/Haddock/Backends/Xhtml/Decl.hs 24 -import Haddock.Backends.Xhtml.Util +import Haddock.Backends.Xhtml.Utils hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 22 -import Haddock.Backends.Xhtml.Util +import Haddock.Backends.Xhtml.Utils hunk ./src/Haddock/Backends/Xhtml/Layout.hs 40 -import Haddock.Backends.Xhtml.Util +import Haddock.Backends.Xhtml.Utils hunk ./src/Haddock/Backends/Xhtml/Names.hs 20 -import Haddock.Backends.Xhtml.Util +import Haddock.Backends.Xhtml.Utils hunk ./src/Haddock/Backends/Xhtml/Utils.hs 13 -module Haddock.Backends.Xhtml.Util ( +module Haddock.Backends.Xhtml.Utils ( hunk ./src/Haddock/Backends/Xhtml.hs 13 -module Haddock.Backends.Xhtml ( - ppHtml, copyHtmlBits, +module Haddock.Backends.Xhtml ( + ppHtml, copyHtmlBits, hunk ./src/Haddock/Backends/Xhtml.hs 82 - when (not (isJust maybe_contents_url)) $ + when (not (isJust maybe_contents_url)) $ hunk ./src/Haddock/Backends/Xhtml.hs 89 - when (not (isJust maybe_index_url)) $ + when (not (isJust maybe_index_url)) $ hunk ./src/Haddock/Backends/Xhtml.hs 91 - maybe_contents_url maybe_source_url maybe_wiki_url + maybe_contents_url maybe_source_url maybe_wiki_url hunk ./src/Haddock/Backends/Xhtml.hs 93 - - when (not (isJust maybe_contents_url && isJust maybe_index_url)) $ + + when (not (isJust maybe_contents_url && isJust maybe_index_url)) $ hunk ./src/Haddock/Backends/Xhtml.hs 101 -ppHtmlHelpFiles +ppHtmlHelpFiles hunk ./src/Haddock/Backends/Xhtml.hs 132 - + hunk ./src/Haddock/Backends/Xhtml.hs 142 - let + let hunk ./src/Haddock/Backends/Xhtml.hs 166 - -- a String + -> String hunk ./src/Haddock/Backends/Xhtml.hs 374 - -> [InstalledInterface] + -> [InstalledInterface] hunk ./src/Haddock/Backends/Xhtml.hs 387 - + hunk ./src/Haddock/Backends/Xhtml.hs 403 - if null items then noHtml else + if null items then noHtml else hunk ./src/Haddock/Backends/Xhtml.hs 406 - + hunk ./src/Haddock/Backends/Xhtml.hs 408 - + hunk ./src/Haddock/Backends/Xhtml.hs 417 - + hunk ./src/Haddock/Backends/Xhtml.hs 419 - divAlphabet << + divAlphabet << hunk ./src/Haddock/Backends/Xhtml.hs 423 - + hunk ./src/Haddock/Backends/Xhtml.hs 430 - + hunk ./src/Haddock/Backends/Xhtml.hs 434 - where + where hunk ./src/Haddock/Backends/Xhtml.hs 437 - - + + hunk ./src/Haddock/Backends/Xhtml.hs 442 - + hunk ./src/Haddock/Backends/Xhtml.hs 450 - - getIfaceIndex iface = + + getIfaceIndex iface = hunk ./src/Haddock/Backends/Xhtml.hs 456 - + hunk ./src/Haddock/Backends/Xhtml.hs 458 - indexElt (str, entities) = + indexElt (str, entities) = hunk ./src/Haddock/Backends/Xhtml.hs 460 - [(nm,entries)] -> - td ! [ theclass "src" ] << toHtml str <-> + [(nm,entries)] -> + td ! [ theclass "src" ] << toHtml str <-> hunk ./src/Haddock/Backends/Xhtml.hs 464 - td ! [ theclass "src" ] << toHtml str <-> td << spaceHtml + td ! [ theclass "src" ] << toHtml str <-> td << spaceHtml hunk ./src/Haddock/Backends/Xhtml.hs 466 - + hunk ./src/Haddock/Backends/Xhtml.hs 469 - = td ! [ theclass "alt" ] << + = td ! [ theclass "alt" ] << hunk ./src/Haddock/Backends/Xhtml.hs 472 - + hunk ./src/Haddock/Backends/Xhtml.hs 476 - - indexLinks nm entries = - td ! [ theclass "module" ] << - hsep (punctuate comma + + indexLinks nm entries = + td ! [ theclass "module" ] << + hsep (punctuate comma hunk ./src/Haddock/Backends/Xhtml.hs 497 - let + let hunk ./src/Haddock/Backends/Xhtml.hs 500 - html = + html = hunk ./src/Haddock/Backends/Xhtml.hs 508 - + hunk ./src/Haddock/Backends/Xhtml.hs 518 - miniBody << + miniBody << hunk ./src/Haddock/Backends/Xhtml.hs 561 - = case exports of + = case exports of hunk ./src/Haddock/Backends/Xhtml.hs 569 - + hunk ./src/Haddock/Backends/Xhtml.hs 618 - + hunk ./src/Haddock/Backends/Xhtml.hs 623 - process n items@(ExportGroup lev id0 doc : rest) + process n items@(ExportGroup lev id0 doc : rest) hunk ./src/Haddock/Backends/Xhtml.hs 641 - go n (ExportGroup lev _ doc : es) + go n (ExportGroup lev _ doc : es) hunk ./src/Haddock/Backends/Xhtml.hs 680 - hunk ./tests/golden-tests/runtests.hs 66 - (["-w", "-o", outdir, "-h", "--optghc=-fglasgow-exts" + (["-w", "-o", outdir, "-h", "--xhtml", "--optghc=-fglasgow-exts" hunk ./src/Haddock/Backends/Xhtml.hs 63 -ppHtml :: String - -> Maybe String -- package - -> [Interface] - -> FilePath -- destination directory - -> Maybe (Doc GHC.RdrName) -- prologue text, maybe - -> Maybe String -- the Html Help format (--html-help) - -> SourceURLs -- the source URL (--source) - -> WikiURLs -- the wiki URL (--wiki) - -> Maybe String -- the contents URL (--use-contents) - -> Maybe String -- the index URL (--use-index) - -> Bool -- whether to use unicode in output (--use-unicode) - -> IO () +ppHtml :: String + -> Maybe String -- package + -> [Interface] + -> FilePath -- destination directory + -> Maybe (Doc GHC.RdrName) -- prologue text, maybe + -> Maybe String -- the Html Help format (--html-help) + -> SourceURLs -- the source URL (--source) + -> WikiURLs -- the wiki URL (--wiki) + -> Maybe String -- the contents URL (--use-contents) + -> Maybe String -- the index URL (--use-index) + -> Bool -- whether to use unicode in output (--use-unicode) + -> IO () hunk ./src/Haddock/Backends/Xhtml.hs 103 - -> Maybe String -- package - -> [Interface] - -> FilePath -- destination directory - -> Maybe String -- the Html Help format (--html-help) - -> [FilePath] -- external packages paths - -> IO () + -> Maybe String -- package + -> [Interface] + -> FilePath -- destination directory + -> Maybe String -- the Html Help format (--html-help) + -> [FilePath] -- external packages paths + -> IO () hunk ./src/Haddock/Backends/Xhtml/Decl.hs 15 - + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 40 -ppDecl :: Bool -> LinksInfo -> LHsDecl DocName -> +ppDecl :: Bool -> LinksInfo -> LHsDecl DocName -> hunk ./src/Haddock/Backends/Xhtml/Decl.hs 46 - | Just _ <- tcdTyPats d -> ppDataInst summ links loc mbDoc d + | Just _ <- tcdTyPats d -> ppDataInst summ links loc mbDoc d hunk ./src/Haddock/Backends/Xhtml/Decl.hs 71 - where + where hunk ./src/Haddock/Backends/Xhtml/Decl.hs 74 - do_largs n leader (L _ t) = do_args n leader t + do_largs n leader (L _ t) = do_args n leader t hunk ./src/Haddock/Backends/Xhtml/Decl.hs 77 - = (leader <+> + = (leader <+> hunk ./src/Haddock/Backends/Xhtml/Decl.hs 104 - + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 115 - = ppTypeOrFunSig summary links loc name (unLoc ltype) doc + = ppTypeOrFunSig summary links loc name (unLoc ltype) doc hunk ./src/Haddock/Backends/Xhtml/Decl.hs 154 - Just kind -> dcolon unicode <+> ppKind kind + Just kind -> dcolon unicode <+> ppKind kind hunk ./src/Haddock/Backends/Xhtml/Decl.hs 161 - - | summary = ppTyFamHeader True associated decl unicode + + | summary = ppTyFamHeader True associated decl unicode hunk ./src/Haddock/Backends/Xhtml/Decl.hs 197 - + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 201 - + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 203 - | otherwise = header_ +++ maybeDocSection mbDoc + | otherwise = header_ +++ maybeDocSection mbDoc hunk ./src/Haddock/Backends/Xhtml/Decl.hs 222 - + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 225 -ppAssocType summ links doc (L loc decl) unicode = +ppAssocType summ links doc (L loc decl) unicode = hunk ./src/Haddock/Backends/Xhtml/Decl.hs 229 - _ -> error "declaration type not supported by ppAssocType" + _ -> error "declaration type not supported by ppAssocType" hunk ./src/Haddock/Backends/Xhtml/Decl.hs 239 -ppTyClBinderWithVars summ decl = +ppTyClBinderWithVars summ decl = hunk ./src/Haddock/Backends/Xhtml/Decl.hs 255 -ppAppDocNameNames summ n ns = +ppAppDocNameNames summ n ns = hunk ./src/Haddock/Backends/Xhtml/Decl.hs 272 --- Contexts +-- Contexts hunk ./src/Haddock/Backends/Xhtml/Decl.hs 316 -ppClassHdr summ lctxt n tvs fds unicode = - keyword "class" +ppClassHdr summ lctxt n tvs fds unicode = + keyword "class" hunk ./src/Haddock/Backends/Xhtml/Decl.hs 325 - if null fds then noHtml else + if null fds then noHtml else hunk ./src/Haddock/Backends/Xhtml/Decl.hs 343 - , let doc = lookupAnySubdoc n subdocs ] + , let doc = lookupAnySubdoc n subdocs ] hunk ./src/Haddock/Backends/Xhtml/Decl.hs 349 - + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 360 - where + where hunk ./src/Haddock/Backends/Xhtml/Decl.hs 368 - + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 378 - + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 399 - + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 413 - (cHead,cBody,cFoot) <- ppShortConstrParts summary (unLoc lcon) unicode + (cHead,cBody,cFoot) <- ppShortConstrParts summary (unLoc lcon) unicode hunk ./src/Haddock/Backends/Xhtml/Decl.hs 421 - + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 434 - + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 441 - resTy = (con_res . unLoc . head) cons - + resTy = (con_res . unLoc . head) cons + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 446 - whereBit - | null cons = noHtml - | otherwise = case resTy of + whereBit + | null cons = noHtml + | otherwise = case resTy of hunk ./src/Haddock/Backends/Xhtml/Decl.hs 450 - _ -> noHtml + _ -> noHtml hunk ./src/Haddock/Backends/Xhtml/Decl.hs 452 - constrBit = subConstructors + constrBit = subConstructors hunk ./src/Haddock/Backends/Xhtml/Decl.hs 463 - + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 468 -ppShortConstrParts summary con unicode = case con_res con of - ResTyH98 -> case con_details con of - PrefixCon args -> +ppShortConstrParts summary con unicode = case con_res con of + ResTyH98 -> case con_details con of + PrefixCon args -> hunk ./src/Haddock/Backends/Xhtml/Decl.hs 481 - ResTyGADT resTy -> case con_details con of + ResTyGADT resTy -> case con_details con of hunk ./src/Haddock/Backends/Xhtml/Decl.hs 494 - + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 504 - tyVars = tyvarNames ltvs + tyVars = tyvarNames ltvs hunk ./src/Haddock/Backends/Xhtml/Decl.hs 521 - ppForall = case forall of + ppForall = case forall of hunk ./src/Haddock/Backends/Xhtml/Decl.hs 527 - where - decl = case con_res con of - ResTyH98 -> case con_details con of - PrefixCon args -> + where + decl = case con_res con of + ResTyH98 -> case con_details con of + PrefixCon args -> hunk ./src/Haddock/Backends/Xhtml/Decl.hs 533 - + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 535 - - InfixCon arg1 arg2 -> + + InfixCon arg1 arg2 -> hunk ./src/Haddock/Backends/Xhtml/Decl.hs 540 - + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 548 - fieldPart = case con_details con of + fieldPart = case con_details con of hunk ./src/Haddock/Backends/Xhtml/Decl.hs 552 - doRecordFields fields = subFields + doRecordFields fields = subFields hunk ./src/Haddock/Backends/Xhtml/Decl.hs 593 - | otherwise = + | otherwise = hunk ./src/Haddock/Backends/Xhtml/Decl.hs 595 - (if tcdND decl == NewType then keyword "newtype" else keyword "data") <+> + (if tcdND decl == NewType then keyword "newtype" else keyword "data") <+> hunk ./src/Haddock/Backends/Xhtml/Decl.hs 611 -ppBang HsNoBang = noHtml +ppBang HsNoBang = noHtml hunk ./src/Haddock/Backends/Xhtml/Decl.hs 618 -tupleParens Unboxed = ubxParenList +tupleParens Unboxed = ubxParenList hunk ./src/Haddock/Backends/Xhtml/Decl.hs 622 --- Rendering of HsType +-- Rendering of HsType hunk ./src/Haddock/Backends/Xhtml/Decl.hs 645 -ppLParendType unicode y = ppParendType unicode (unLoc y) +ppLParendType unicode y = ppParendType unicode (unLoc y) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 650 -ppType unicode ty = ppr_mono_ty pREC_TOP ty unicode -ppParendType unicode ty = ppr_mono_ty pREC_CON ty unicode +ppType unicode ty = ppr_mono_ty pREC_TOP ty unicode +ppParendType unicode ty = ppr_mono_ty pREC_CON ty unicode hunk ./src/Haddock/Backends/Xhtml/Decl.hs 670 - forall_part = hsep (forallSymbol unicode : ppTyVars tvs) +++ dot + forall_part = hsep (forallSymbol unicode : ppTyVars tvs) +++ dot hunk ./src/Haddock/Backends/Xhtml/Decl.hs 674 -ppr_mono_lty ctxt_prec ty unicode = ppr_mono_ty ctxt_prec (unLoc ty) unicode +ppr_mono_lty ctxt_prec ty unicode = ppr_mono_ty ctxt_prec (unLoc ty) unicode hunk ./src/Haddock/Backends/Xhtml/Decl.hs 678 -ppr_mono_ty ctxt_prec (HsForAllTy expl tvs ctxt ty) unicode +ppr_mono_ty ctxt_prec (HsForAllTy expl tvs ctxt ty) unicode hunk ./src/Haddock/Backends/Xhtml/Decl.hs 699 -ppr_mono_ty ctxt_prec (HsAppTy fun_ty arg_ty) unicode +ppr_mono_ty ctxt_prec (HsAppTy fun_ty arg_ty) unicode hunk ./src/Haddock/Backends/Xhtml/Decl.hs 703 -ppr_mono_ty ctxt_prec (HsOpTy ty1 op ty2) unicode +ppr_mono_ty ctxt_prec (HsOpTy ty1 op ty2) unicode hunk ./src/Haddock/Backends/Xhtml/Decl.hs 710 -ppr_mono_ty ctxt_prec (HsParTy ty) unicode +ppr_mono_ty ctxt_prec (HsParTy ty) unicode hunk ./src/Haddock/Backends/Xhtml/Decl.hs 714 -ppr_mono_ty ctxt_prec (HsDocTy ty _) unicode +ppr_mono_ty ctxt_prec (HsDocTy ty _) unicode hunk ./src/Haddock/Backends/Xhtml/Decl.hs 718 -ppr_fun_ty :: Int -> LHsType DocName -> LHsType DocName -> Bool -> Html +ppr_fun_ty :: Int -> LHsType DocName -> LHsType DocName -> Bool -> Html hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 17 - + hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 115 - fmtUnParagraphLists = idMarkup { + fmtUnParagraphLists = idMarkup { hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 118 - } + } hunk ./src/Haddock/Backends/Xhtml/Layout.hs 15 - + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 21 - + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 24 - + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 26 - + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 34 - + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 104 - + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 113 - + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 162 -topDeclElem ((_,_,maybe_source_url), (_,_,maybe_wiki_url)) loc name html = +topDeclElem ((_,_,maybe_source_url), (_,_,maybe_wiki_url)) loc name html = hunk ./src/Haddock/Backends/Xhtml/Layout.hs 177 - + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 179 - -- because only that will have the source. + -- because only that will have the source. hunk ./src/Haddock/Backends/Xhtml/Names.hs 41 -ppDocName (Documented name mdl) = +ppDocName (Documented name mdl) = hunk ./src/Haddock/Backends/Xhtml/Names.hs 70 - where + where hunk ./src/Haddock/Backends/Xhtml/Utils.hs 15 - + hunk ./src/Haddock/Backends/Xhtml/Utils.hs 18 - + hunk ./src/Haddock/Backends/Xhtml/Utils.hs 21 - + hunk ./src/Haddock/Backends/Xhtml/Utils.hs 24 - + hunk ./src/Haddock/Backends/Xhtml/Utils.hs 26 - + hunk ./src/Haddock/Backends/Xhtml/Utils.hs 28 - + hunk ./src/Haddock/Backends/Xhtml/Utils.hs 45 -spliceURL :: Maybe FilePath -> Maybe Module -> Maybe GHC.Name -> +spliceURL :: Maybe FilePath -> Maybe Module -> Maybe GHC.Name -> hunk ./src/Haddock/Backends/Xhtml/Utils.hs 53 - + hunk ./src/Haddock/Backends/Xhtml/Utils.hs 165 - + hunk ./src/Haddock/Backends/Xhtml/Utils.hs 175 -collapsebutton id_ = +collapsebutton id_ = hunk ./src/Haddock/Backends/Xhtml/Utils.hs 205 - mkPicker (aTitle, aFile) = + mkPicker (aTitle, aFile) = hunk ./src/Haddock/Backends/Xhtml/Utils.hs 216 - + + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 38 + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 49 --- Sections of the document hunk ./src/Haddock/Backends/Xhtml/Layout.hs 50 +-------------------------------------------------------------------------------- +-- * Sections of the document +-------------------------------------------------------------------------------- + + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 62 + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 85 +-------------------------------------------------------------------------------- +-- * Declaration containers +-------------------------------------------------------------------------------- hunk ./src/Haddock/Backends/Xhtml/Layout.hs 89 --- | Declaration containers hunk ./src/Haddock/Backends/Xhtml/Layout.hs 93 + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 104 + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 128 + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 139 + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 148 + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 152 + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 156 + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 160 + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 167 + hunk ./src/Haddock/Backends/Xhtml/Layout.hs 176 + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 20 + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 57 + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 66 + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 138 --- Type families +-- * Type families hunk ./src/Haddock/Backends/Xhtml/Decl.hs 180 --- Indexed data types +-- * Indexed data types hunk ./src/Haddock/Backends/Xhtml/Decl.hs 189 --- Indexed newtypes +-- * Indexed newtypes hunk ./src/Haddock/Backends/Xhtml/Decl.hs 197 --- Indexed types +-- * Indexed types hunk ./src/Haddock/Backends/Xhtml/Decl.hs 223 --- Associated Types +-- * Associated Types hunk ./src/Haddock/Backends/Xhtml/Decl.hs 236 --- TyClDecl helpers +-- * TyClDecl helpers hunk ./src/Haddock/Backends/Xhtml/Decl.hs 247 --- Type applications +-- * Type applications hunk ./src/Haddock/Backends/Xhtml/Decl.hs 275 --- Contexts +-- * Contexts hunk ./src/Haddock/Backends/Xhtml/Decl.hs 312 --- Class declarations +-- * Class declarations hunk ./src/Haddock/Backends/Xhtml/Decl.hs 334 + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 386 - hunk ./src/Haddock/Backends/Xhtml/Decl.hs 404 - --- ----------------------------------------------------------------------------- --- Data & newtype declarations +------------------------------------------------------------------------------- +-- * Data & newtype declarations +------------------------------------------------------------------------------- hunk ./src/Haddock/Backends/Xhtml/Decl.hs 433 + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 514 + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 530 + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 578 + hunk ./src/Haddock/Backends/Xhtml/Decl.hs 609 --- ---------------------------------------------------------------------------- --- Types and contexts +-------------------------------------------------------------------------------- +-- * Types and contexts +-------------------------------------------------------------------------------- hunk ./src/Haddock/Backends/Xhtml/Decl.hs 630 --- Rendering of HsType +-- * Rendering of HsType hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 21 + hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 76 - hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 82 + hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 87 + hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 93 - hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 96 + hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 100 + hunk ./src/Haddock/Backends/Xhtml/Names.hs 20 + hunk ./src/Haddock/Backends/Xhtml/Names.hs 32 + hunk ./src/Haddock/Backends/Xhtml/Names.hs 36 + hunk ./src/Haddock/Backends/Xhtml/Names.hs 40 + hunk ./src/Haddock/Backends/Xhtml/Names.hs 44 + hunk ./src/Haddock/Backends/Xhtml/Names.hs 51 + hunk ./src/Haddock/Backends/Xhtml/Names.hs 81 + hunk ./src/Haddock/Backends/Xhtml/Names.hs 86 + hunk ./src/Haddock/Backends/Xhtml/Names.hs 90 - -- NB: The ref paramaeter already includes the '#'. + -- NB: The ref parameter already includes the '#'. hunk ./src/Haddock/Backends/Xhtml/Types.hs 23 + hunk ./src/Haddock/Backends/Xhtml/Utils.hs 32 + hunk ./src/Haddock/Backends/Xhtml/Utils.hs 93 + hunk ./src/Haddock/Backends/Xhtml/Utils.hs 98 + hunk ./src/Haddock/Backends/Xhtml/Utils.hs 103 + hunk ./src/Haddock/Backends/Xhtml/Utils.hs 107 + hunk ./src/Haddock/Backends/Xhtml/Utils.hs 112 + hunk ./src/Haddock/Backends/Xhtml/Utils.hs 116 --- | ensure content contains at least something (a non-breaking space) + +-- | Ensure content contains at least something (a non-breaking space) hunk ./src/Haddock/Backends/Xhtml/Utils.hs 133 + hunk ./src/Haddock/Backends/Xhtml/Utils.hs 141 + hunk ./src/Haddock/Backends/Xhtml/Utils.hs 145 + hunk ./src/Haddock/Backends/Xhtml/Utils.hs 149 + hunk ./src/Haddock/Backends/Xhtml/Utils.hs 169 - hunk ./src/Haddock/Backends/Xhtml/Utils.hs 173 + hunk ./src/Haddock/Backends/Xhtml/Utils.hs 177 + hunk ./src/Haddock/Backends/Xhtml/Utils.hs 190 + hunk ./src/Haddock/Backends/Xhtml/Utils.hs 205 + hunk ./src/Haddock/Backends/Xhtml/Utils.hs 209 + hunk ./src/Haddock/Backends/Xhtml/Utils.hs 217 + hunk ./src/Haddock/Backends/Xhtml/Utils.hs 225 + hunk ./src/Haddock/Backends/Xhtml.hs 59 +-------------------------------------------------------------------------------- +-- * Generating HTML documentation +-------------------------------------------------------------------------------- hunk ./src/Haddock/Backends/Xhtml.hs 63 --- ----------------------------------------------------------------------------- --- Generating HTML documentation hunk ./src/Haddock/Backends/Xhtml.hs 102 + hunk ./src/Haddock/Backends/Xhtml.hs 126 + hunk ./src/Haddock/Backends/Xhtml.hs 201 + hunk ./src/Haddock/Backends/Xhtml.hs 207 + hunk ./src/Haddock/Backends/Xhtml.hs 240 + hunk ./src/Haddock/Backends/Xhtml.hs 260 --- --------------------------------------------------------------------------- --- Generate the module contents + +-------------------------------------------------------------------------------- +-- * Generate the module contents +-------------------------------------------------------------------------------- + hunk ./src/Haddock/Backends/Xhtml.hs 303 + hunk ./src/Haddock/Backends/Xhtml.hs 309 + hunk ./src/Haddock/Backends/Xhtml.hs 314 + hunk ./src/Haddock/Backends/Xhtml.hs 322 + hunk ./src/Haddock/Backends/Xhtml.hs 366 + hunk ./src/Haddock/Backends/Xhtml.hs 378 --- --------------------------------------------------------------------------- --- Generate the index + +-------------------------------------------------------------------------------- +-- * Generate the index +-------------------------------------------------------------------------------- + hunk ./src/Haddock/Backends/Xhtml.hs 503 --- --------------------------------------------------------------------------- --- Generate the HTML page for a module + +-------------------------------------------------------------------------------- +-- * Generate the HTML page for a module +-------------------------------------------------------------------------------- + hunk ./src/Haddock/Backends/Xhtml.hs 533 + hunk ./src/Haddock/Backends/Xhtml.hs 545 + hunk ./src/Haddock/Backends/Xhtml.hs 594 + hunk ./src/Haddock/Backends/Xhtml.hs 601 + hunk ./src/Haddock/Backends/Xhtml.hs 622 + hunk ./src/Haddock/Backends/Xhtml.hs 629 + hunk ./src/Haddock/Backends/Xhtml.hs 636 + hunk ./src/Haddock/Backends/Xhtml.hs 662 + hunk ./src/Haddock/Backends/Xhtml.hs 674 + hunk ./src/Haddock/Backends/Xhtml.hs 689 + hunk ./src/Haddock/Backends/Xhtml.hs 694 + hunk ./src/Haddock/Backends/Xhtml.hs 699 + hunk ./src/Haddock/Backends/Xhtml.hs 704 + hunk ./src/Haddock/Backends/LaTeX.hs 91 + +haddockSty :: String hunk ./src/Haddock/Backends/LaTeX.hs 95 + hunk ./src/Haddock/Backends/LaTeX.hs 180 - xs -> parens (sep (punctuate comma (map (ppDocBinder . fst) subdocs))) + _ -> parens (sep (punctuate comma (map (ppDocBinder . fst) subdocs))) hunk ./src/Haddock/Backends/LaTeX.hs 281 +ppTyFam :: t -> t1 -> t2 -> t3 -> t4 -> a hunk ./src/Haddock/Backends/LaTeX.hs 285 +ppDataInst :: t -> t1 -> t2 -> a hunk ./src/Haddock/Backends/LaTeX.hs 289 +ppTyInst :: t -> t1 -> t2 -> t3 -> t4 -> a hunk ./src/Haddock/Backends/LaTeX.hs 293 +ppFor :: t -> t1 -> t2 -> t3 -> a hunk ./src/Haddock/Backends/LaTeX.hs 329 - unicode methods + unicode _ hunk ./src/Haddock/Backends/LaTeX.hs 435 - decl@(ClassDecl lctxt lname ltyvars lfds lsigs _ ats _) unicode + (ClassDecl lctxt lname ltyvars lfds lsigs _ _ _) unicode hunk ./src/Haddock/Backends/LaTeX.hs 443 - nm = unLoc $ tcdLName decl - hunk ./src/Haddock/Backends/LaTeX.hs 448 - | null lsigs, null ats = Nothing - | null ats = Just methodTable + | null lsigs = Nothing + | otherwise = Just methodTable + hunk ./src/Haddock/Backends/LaTeX.hs 499 -ppDataDecl instances subdocs loc mbDoc dataDecl unicode +ppDataDecl instances subdocs _ mbDoc dataDecl unicode hunk ./src/Haddock/Backends/LaTeX.hs 506 - docname = unLoc . tcdLName $ dataDecl hunk ./src/Haddock/Backends/LaTeX.hs 530 -isRecCon :: Located (ConDecl a) -> Bool -isRecCon lcon = case con_details (unLoc lcon) of - RecCon _ -> True - _ -> False - hunk ./src/Haddock/Backends/LaTeX.hs 871 -ppVerbBinder :: OccName -> LaTeX -ppVerbBinder n - | isVarSym n = parens $ ppVerbOccName n - | otherwise = ppVerbOccName n - hunk ./src/Haddock/Backends/LaTeX.hs 897 -ppVerbDocBinder :: DocName -> LaTeX -ppVerbDocBinder = ppVerbBinder . docNameOcc - hunk ./src/Haddock/Backends/LaTeX.hs 900 -ppVerbName :: Name -> LaTeX -ppVerbName = ppVerbOccName . nameOccName - hunk ./src/Haddock/Backends/LaTeX.hs 906 +latexMunge :: Char -> String -> String hunk ./src/Haddock/Backends/LaTeX.hs 921 +latexMonoMunge :: Char -> String -> String hunk ./src/Haddock/Backends/LaTeX.hs 937 - markupModule = \m v -> let (mdl,_ref) = break (=='#') m in tt (text mdl), + markupModule = \m _ -> let (mdl,_ref) = break (=='#') m in tt (text mdl), hunk ./src/Haddock/Backends/LaTeX.hs 939 - markupMonospaced = \p v -> tt (p Mono), + markupMonospaced = \p _ -> tt (p Mono), hunk ./src/Haddock/Backends/LaTeX.hs 941 - markupPic = \path v -> parens (text "image: " <> text path), + markupPic = \path _ -> parens (text "image: " <> text path), hunk ./src/Haddock/Backends/LaTeX.hs 1000 -latexStripLeadingPara :: Doc a -> Doc a -latexStripLeadingPara (DocParagraph p) = p -latexStripLeadingPara (DocAppend l r) = DocAppend (latexStripLeadingPara l) r -latexStripLeadingPara d = d - hunk ./src/Haddock/Backends/LaTeX.hs 46 - (++), head, last, tail, init, null, length, map, reverse, + (++), head, last, tail, init, null, length, map, reverse, hunk ./src/Haddock/Backends/LaTeX.hs 98 + hunk ./src/Haddock/Backends/LaTeX.hs 135 + hunk ./src/Haddock/Backends/LaTeX.hs 177 + hunk ./src/Haddock/Backends/LaTeX.hs 193 + hunk ./src/Haddock/Backends/LaTeX.hs 211 + hunk ./src/Haddock/Backends/LaTeX.hs 218 + hunk ./src/Haddock/Backends/LaTeX.hs 223 + hunk ./src/Haddock/Backends/LaTeX.hs 238 + hunk ./src/Haddock/Backends/LaTeX.hs 246 + hunk ./src/Haddock/Backends/LaTeX.hs 253 + hunk ./src/Haddock/Backends/LaTeX.hs 259 + hunk ./src/Haddock/Backends/LaTeX.hs 263 + hunk ./src/Haddock/Backends/LaTeX.hs 268 --- ----------------------------------------------------------------------------- --- Decls + +------------------------------------------------------------------------------- +-- * Decls +------------------------------------------------------------------------------- + hunk ./src/Haddock/Backends/LaTeX.hs 296 + hunk ./src/Haddock/Backends/LaTeX.hs 301 + hunk ./src/Haddock/Backends/LaTeX.hs 306 + hunk ./src/Haddock/Backends/LaTeX.hs 311 + hunk ./src/Haddock/Backends/LaTeX.hs 316 --- ----------------------------------------------------------------------------- --- Type Synonyms + +------------------------------------------------------------------------------- +-- * Type Synonyms +------------------------------------------------------------------------------- + hunk ./src/Haddock/Backends/LaTeX.hs 334 --- ----------------------------------------------------------------------------- --- Function signatures + +------------------------------------------------------------------------------- +-- * Function signatures +------------------------------------------------------------------------------- + hunk ./src/Haddock/Backends/LaTeX.hs 350 + hunk ./src/Haddock/Backends/LaTeX.hs 390 + hunk ./src/Haddock/Backends/LaTeX.hs 395 + hunk ./src/Haddock/Backends/LaTeX.hs 399 + hunk ./src/Haddock/Backends/LaTeX.hs 403 + hunk ./src/Haddock/Backends/LaTeX.hs 414 + hunk ./src/Haddock/Backends/LaTeX.hs 428 + +------------------------------------------------------------------------------- +-- * Rendering Doc hunk ./src/Haddock/Backends/LaTeX.hs 432 --- Rendering Doc + hunk ./src/Haddock/Backends/LaTeX.hs 437 + hunk ./src/Haddock/Backends/LaTeX.hs 443 + hunk ./src/Haddock/Backends/LaTeX.hs 445 --- Class declarations +-- * Class declarations hunk ./src/Haddock/Backends/LaTeX.hs 448 + hunk ./src/Haddock/Backends/LaTeX.hs 515 + hunk ./src/Haddock/Backends/LaTeX.hs 519 + hunk ./src/Haddock/Backends/LaTeX.hs 524 + hunk ./src/Haddock/Backends/LaTeX.hs 531 --- ----------------------------------------------------------------------------- --- Data & newtype declarations + +------------------------------------------------------------------------------- +-- * Data & newtype declarations +------------------------------------------------------------------------------- hunk ./src/Haddock/Backends/LaTeX.hs 588 + hunk ./src/Haddock/Backends/LaTeX.hs 643 + hunk ./src/Haddock/Backends/LaTeX.hs 698 + hunk ./src/Haddock/Backends/LaTeX.hs 714 --- TyClDecl helpers +-- * TyClDecl helpers hunk ./src/Haddock/Backends/LaTeX.hs 725 --- Type applications +-- * Type applications hunk ./src/Haddock/Backends/LaTeX.hs 753 --- Contexts +-- * Contexts hunk ./src/Haddock/Backends/LaTeX.hs 789 --- ---------------------------------------------------------------------------- --- Types and contexts +------------------------------------------------------------------------------- +-- * Types and contexts +------------------------------------------------------------------------------- + hunk ./src/Haddock/Backends/LaTeX.hs 797 + hunk ./src/Haddock/Backends/LaTeX.hs 802 + hunk ./src/Haddock/Backends/LaTeX.hs 807 --- ----------------------------------------------------------------------------- --- Rendering of HsType + +------------------------------------------------------------------------------- +-- * Rendering of HsType hunk ./src/Haddock/Backends/LaTeX.hs 812 +------------------------------------------------------------------------------- + hunk ./src/Haddock/Backends/LaTeX.hs 915 --- ----------------------------------------------------------------------------- --- Names + +------------------------------------------------------------------------------- +-- * Names +------------------------------------------------------------------------------- + hunk ./src/Haddock/Backends/LaTeX.hs 926 + hunk ./src/Haddock/Backends/LaTeX.hs 932 + hunk ./src/Haddock/Backends/LaTeX.hs 936 + hunk ./src/Haddock/Backends/LaTeX.hs 940 + hunk ./src/Haddock/Backends/LaTeX.hs 944 + hunk ./src/Haddock/Backends/LaTeX.hs 948 + hunk ./src/Haddock/Backends/LaTeX.hs 952 + hunk ./src/Haddock/Backends/LaTeX.hs 956 + hunk ./src/Haddock/Backends/LaTeX.hs 960 + hunk ./src/Haddock/Backends/LaTeX.hs 964 + hunk ./src/Haddock/Backends/LaTeX.hs 968 + hunk ./src/Haddock/Backends/LaTeX.hs 972 + hunk ./src/Haddock/Backends/LaTeX.hs 988 + hunk ./src/Haddock/Backends/LaTeX.hs 994 --- ----------------------------------------------------------------------------- --- Doc Markup + +------------------------------------------------------------------------------- +-- * Doc Markup +------------------------------------------------------------------------------- + hunk ./src/Haddock/Backends/LaTeX.hs 1043 + hunk ./src/Haddock/Backends/LaTeX.hs 1047 + hunk ./src/Haddock/Backends/LaTeX.hs 1051 + hunk ./src/Haddock/Backends/LaTeX.hs 1055 + hunk ./src/Haddock/Backends/LaTeX.hs 1059 + hunk ./src/Haddock/Backends/LaTeX.hs 1062 + hunk ./src/Haddock/Backends/LaTeX.hs 1077 --- ----------------------------------------------------------------------------- --- LaTeX utils + +------------------------------------------------------------------------------- +-- * LaTeX utils +------------------------------------------------------------------------------- + hunk ./src/Haddock/Backends/LaTeX.hs 1089 + hunk ./src/Haddock/Backends/LaTeX.hs 1096 + hunk ./src/Haddock/Backends/LaTeX.hs 1103 + hunk ./src/Haddock/Backends/LaTeX.hs 1107 + hunk ./src/Haddock/Backends/LaTeX.hs 1111 + hunk ./src/Haddock/Backends/LaTeX.hs 1115 + hunk ./src/Haddock/Backends/LaTeX.hs 1122 + hunk ./src/Haddock/Backends/LaTeX.hs 1126 + hunk ./src/Haddock/Backends/LaTeX.hs 1133 + hunk ./src/Haddock/Backends/LaTeX.hs 1137 + hunk ./src/Haddock/Backends/LaTeX.hs 1141 + hunk ./src/Haddock/Backends/LaTeX.hs 1145 + hunk ./src/Haddock/Backends/LaTeX.hs 1149 + hunk ./src/Haddock/Backends/LaTeX.hs 1153 + hunk ./src/Haddock/Backends/LaTeX.hs 1157 + hunk ./src/Haddock/Backends/LaTeX.hs 1161 + hunk ./src/Main.hs 64 --- Exception handling +-- * Exception handling hunk ./src/Main.hs 114 --- Top level +-- * Top level hunk ./src/Main.hs 237 --- Reading and dumping interface files +-- * Reading and dumping interface files hunk ./src/Main.hs 271 --- Creating a GHC session +-- * Creating a GHC session hunk ./src/Main.hs 308 --- Misc +-- * Misc hunk ./src/Documentation/Haddock.hs 26 - FnArgsDoc, - + FnArgsDoc, + hunk ./src/Documentation/Haddock.hs 50 - + hunk ./src/Haddock/Convert.hs 189 - + hunk ./src/Haddock/GhcUtils.hs 150 --- Located +-- * Located hunk ./src/Haddock/GhcUtils.hs 167 - mapM f (L l x) = (return . L l) =<< f x + mapM f (L l x) = (return . L l) =<< f x hunk ./src/Haddock/GhcUtils.hs 171 --- NamedThing instances +-- * NamedThing instances hunk ./src/Haddock/GhcUtils.hs 184 --- Subordinates +-- * Subordinates hunk ./src/Haddock/GhcUtils.hs 234 --- Utils that work in monads defined by GHC +-- * Utils that work in monads defined by GHC hunk ./src/Haddock/GhcUtils.hs 252 --- DynFlags +-- * DynFlags hunk ./src/Haddock/InterfaceFile.hs 46 -} +} hunk ./src/Haddock/InterfaceFile.hs 212 --- Symbol table +-- * Symbol table hunk ./src/Haddock/InterfaceFile.hs 272 - let + let hunk ./src/Haddock/InterfaceFile.hs 274 - (namecache', names) = + (namecache', names) = hunk ./src/Haddock/InterfaceFile.hs 289 - let + let hunk ./src/Haddock/InterfaceFile.hs 295 - Nothing -> - let + Nothing -> + let hunk ./src/Haddock/InterfaceFile.hs 301 - in - case splitUniqSupply us of { (us',_) -> + in + case splitUniqSupply us of { (us',_) -> hunk ./src/Haddock/InterfaceFile.hs 314 --- GhcBinary instances +-- * GhcBinary instances hunk ./src/Haddock/InterfaceFile.hs 352 - + hunk ./src/Haddock/InterfaceFile.hs 500 - + hunk ./src/Haddock/ModuleTree.hs 26 -mkModuleTree showPkgs mods = +mkModuleTree showPkgs mods = hunk ./src/Haddock/ModuleTree.hs 55 - (s1, '.':s2) -> s1 : split s2 - (s1, _) -> [s1] + (s1, '.':s2) -> s1 : split s2 + (s1, _) -> [s1] hunk ./src/Haddock/Utils.hs 16 - restrictTo, + restrictTo, hunk ./src/Haddock/Utils.hs 34 - + hunk ./src/Haddock/Utils.hs 39 - markup, + markup, hunk ./src/Haddock/Utils.hs 48 - + hunk ./src/Haddock/Utils.hs 75 -import System.IO.Unsafe ( unsafePerformIO ) +import System.IO.Unsafe ( unsafePerformIO ) hunk ./src/Haddock/Utils.hs 87 --- ----------------------------------------------------------------------------- --- Logging +-------------------------------------------------------------------------------- +-- * Logging +-------------------------------------------------------------------------------- hunk ./src/Haddock/Utils.hs 106 --- ----------------------------------------------------------------------------- --- Some Utilities +-------------------------------------------------------------------------------- +-- * Some Utilities +-------------------------------------------------------------------------------- hunk ./src/Haddock/Utils.hs 121 --- --------------------------------------------------------------------------- --- Making abstract declarations +-------------------------------------------------------------------------------- +-- * Making abstract declarations +-------------------------------------------------------------------------------- hunk ./src/Haddock/Utils.hs 128 - TyClD d | isDataDecl d && tcdND d == DataType -> - TyClD (d { tcdCons = restrictCons names (tcdCons d) }) - TyClD d | isDataDecl d && tcdND d == NewType -> + TyClD d | isDataDecl d && tcdND d == DataType -> + TyClD (d { tcdCons = restrictCons names (tcdCons d) }) + TyClD d | isDataDecl d && tcdND d == NewType -> hunk ./src/Haddock/Utils.hs 132 - [] -> TyClD (d { tcdND = DataType, tcdCons = [] }) + [] -> TyClD (d { tcdND = DataType, tcdCons = [] }) hunk ./src/Haddock/Utils.hs 135 - TyClD d | isClassDecl d -> + TyClD d | isClassDecl d -> hunk ./src/Haddock/Utils.hs 140 - + hunk ./src/Haddock/Utils.hs 142 -restrictCons names decls = [ L p d | L p (Just d) <- map (fmap keep) decls ] - where - keep d | unLoc (con_name d) `elem` names = +restrictCons names decls = [ L p d | L p (Just d) <- map (fmap keep) decls ] + where + keep d | unLoc (con_name d) `elem` names = hunk ./src/Haddock/Utils.hs 147 - RecCon fields + RecCon fields hunk ./src/Haddock/Utils.hs 157 - field_types flds = [ t | ConDeclField _ t _ <- flds ] - + field_types flds = [ t | ConDeclField _ t _ <- flds ] + hunk ./src/Haddock/Utils.hs 172 --- ----------------------------------------------------------------------------- --- Filename mangling functions stolen from s main/DriverUtil.lhs. +-------------------------------------------------------------------------------- +-- * Filename mangling functions stolen from s main/DriverUtil.lhs. +-------------------------------------------------------------------------------- hunk ./src/Haddock/Utils.hs 183 - mdl' = map (\c -> if c == '.' then '-' else c) + mdl' = map (\c -> if c == '.' then '-' else c) hunk ./src/Haddock/Utils.hs 212 --- ----------------------------------------------------------------------------- --- Anchor and URL utilities +------------------------------------------------------------------------------- +-- * Anchor and URL utilities hunk ./src/Haddock/Utils.hs 223 +------------------------------------------------------------------------------- hunk ./src/Haddock/Utils.hs 225 + hunk ./src/Haddock/Utils.hs 229 -moduleNameUrl :: Module -> OccName -> String + +moduleNameUrl :: Module -> OccName -> String hunk ./src/Haddock/Utils.hs 233 + hunk ./src/Haddock/Utils.hs 236 - where prefix | isValOcc name = 'v' + where prefix | isValOcc name = 'v' hunk ./src/Haddock/Utils.hs 239 + hunk ./src/Haddock/Utils.hs 254 --- ----------------------------------------------------------------------------- --- Files we need to copy from our $libdir + +------------------------------------------------------------------------------- +-- * Files we need to copy from our $libdir +------------------------------------------------------------------------------- hunk ./src/Haddock/Utils.hs 269 ------------------------------------------------------------------------------ --- misc. +------------------------------------------------------------------------------- +-- * Misc. +------------------------------------------------------------------------------- hunk ./src/Haddock/Utils.hs 346 --- HTML cross references - +-- * HTML cross references +-- hunk ./src/Haddock/Utils.hs 354 +----------------------------------------------------------------------------- hunk ./src/Haddock/Utils.hs 368 --- List utils +-- * List utils hunk ./src/Haddock/Utils.hs 373 -replace a b = map (\x -> if x == a then b else x) +replace a b = map (\x -> if x == a then b else x) hunk ./src/Haddock/Utils.hs 381 + +----------------------------------------------------------------------------- +-- * Put here temporarily hunk ./src/Haddock/Utils.hs 385 --- put here temporarily hunk ./src/Haddock/Utils.hs 432 --- ----------------------------------------------------------------------------- --- System tools +----------------------------------------------------------------------------- +-- * System tools +----------------------------------------------------------------------------- hunk ./haddock.cabal 97 - ghc-options: -funbox-strict-fields -O2 -Wall + ghc-options: -funbox-strict-fields -O2 -Wall -fwarn-tabs hunk ./haddock.cabal 161 - ghc-options: -funbox-strict-fields -O2 -Wall + ghc-options: -funbox-strict-fields -O2 -Wall -fwarn-tabs hunk ./src/Haddock/Backends/Xhtml.hs 29 +import Haddock.Backends.Xhtml.Themes hunk ./src/Haddock/Backends/Xhtml.hs 158 - mapM_ copyLibFile [ iconFile, plusFile, minusFile, jsFile, framesFile ] + mapM_ copyLibFile [ plusFile, minusFile, jsFile, framesFile ] addfile ./src/Haddock/Backends/Xhtml/Themes.hs hunk ./src/Haddock/Backends/Xhtml/Themes.hs 1 +----------------------------------------------------------------------------- +-- | +-- Module : Haddock.Backends.Html.Themes +-- Copyright : (c) Mark Lentczner 2010 +-- License : BSD-like +-- +-- Maintainer : haddock@projects.haskell.org +-- Stability : experimental +-- Portability : portable +----------------------------------------------------------------------------- +module Haddock.Backends.Xhtml.Themes ( + CssTheme(..), + + cssFiles, styleSheet, stylePickers, styleMenu + ) + where + +import Haddock.Backends.Xhtml.Utils (onclick) +import Haddock.Utils (iconFile) + +import Data.List (nub) + +import Text.XHtml hiding ( name, title, p, quote ) +import qualified Text.XHtml as XHtml + + +-- Standard set of style sheets, first is the preferred + +data CssTheme = CssTheme { + themeName :: String, + themeHref :: String, + themeFiles :: [FilePath] + } + + +themes :: [CssTheme] +themes = [ + CssTheme "Classic" "xhaddock.css" ["xhaddock.css", iconFile], + CssTheme "Tibbe" "thaddock.css" ["thaddock.css", iconFile], + CssTheme "Snappy" "shaddock.css" ["shaddock.css", iconFile] + ] + +cssFiles :: [String] +cssFiles = nub (concatMap themeFiles themes) + +styleSheet :: Html +styleSheet = toHtml $ zipWith mkLink themes rels + where + rels = ("stylesheet" : repeat "alternate stylesheet") + mkLink (CssTheme aTitle aRef _) aRel = + (thelink ! [href aRef, rel aRel, thetype "text/css", XHtml.title aTitle]) noHtml + +stylePickers :: [Html] +stylePickers = map mkPicker themes + where + mkPicker (CssTheme aTitle aRef _) = + let js = "setActiveStyleSheet('" ++ aRef ++ "'); return false;" in + anchor ! [href "#", onclick js] << aTitle + +styleMenu :: Html +styleMenu = thediv ! [identifier "style-menu-holder"] << [ + anchor ! [ href "#", onclick js ] << "Style\9662", + unordList stylePickers ! [ identifier "style-menu", theclass "hide" ] + ] + where + js = "styleMenu(); return false;" hunk ./src/Haddock/Backends/Xhtml/Utils.hs 26 - + hunk ./src/Haddock/Backends/Xhtml/Utils.hs 28 - + hunk ./src/Haddock/Backends/Xhtml/Utils.hs 205 - hunk ./src/Haddock/Backends/Xhtml/Utils.hs 208 - hunk ./src/Haddock/Backends/Xhtml/Utils.hs 215 - hunk ./src/Haddock/Backends/Xhtml/Utils.hs 218 - mkPicker (aTitle, aFile) = + mkPicker (aTitle, aFile) = hunk ./src/Haddock/Backends/Xhtml/Utils.hs 222 - hunk ./src/Haddock/Backends/Xhtml/Utils.hs 229 - - + addfile ./html/hslogo-16.png binary ./html/hslogo-16.png oldhex * newhex *89504e470d0a1a0a0000000d4948445200000017000000100806000000fd2fe418000002ee6943 *43504943432050726f66696c65000078018554cf6b134114fe366ea9d022085a6b0eb278902249 *59ab6845d436fd11626b0cdb1fb64590643349d66e36ebee26b5a588e4e2d12ade45eda107ff80 *1e7af0642f4a855a4528deab2862a1172df1cd6e4cb6a5eac0ce7ef3de37ef7d6f76df000d72d2 *34f58004e40dc752a211696c7c426afc88008ea20941342555dbec4e2406418373f97be7d87a0f *815b56c37bfb77b277ad9ad2b69a0784fd40e0479ad92ab0ef17710a591202883cdfa129c77408 *dfe3d8f2ec8f394e7978c1b50f2b3dc459227c40352dce7f4db853cd25d34083483894f571523e *9cd78b94d71d07696e66c6c810bd4f90a6bbcceeab62a19c4ef60e90bd9df47e4eb3de3ec221c2 *0b19ad3f46b88d9ef58cd53fe261e1a4e6c4863d1c1835f4f86015b71aa9f835c2145f104d27a2 *5471d92e0df198aefd56f24a82709038ca646180735a484fd74c6ef8ba87057d26d713afe27756 *51e1798f1367ded4ddef45da02af300e1d0c1a0c9a0d48501045046198b05040863c1a3134b272 *3f23ab061b937b3275246abb746244b1417b36dc3db751a4dd3cfe2822719443b50892fc41fe2a *afc94fe579f9cb5cb0d856f794ad9b9abaf2e03bc5e599b91a1ed7d3c8e3734d5e7c95d4769357 *4796ac797abc9aec1a3fec579731e682358fc473b0fbf12d5f95cc97298c14c5e355f3ea4b8475 *5a3137df9f6c7f3b3de22ecf2eb5d673ad898b37569b9767fd6a48fbeeaabc93e655f94f5ef5f1 *fc67cdc463e2293126768ae7218997c52ef192d84bab0be2606dc7089d958629d26d91fa24d560 *609abcf52f5d3f5b78bd467f0cf5519419ccd25489f77fc22a64349db90e6ffa8fdbc7fc17e4f7 *8ae79f28022f6ce0c899ba6d5371ef10a165a56e73ae0217bfd17df0b66e6ba37e38fc04583cab *16ad52359f20bc011c76877a1ee82998d39696cd3952872c9f93bae9ca6252cc50db435252d725 *d7654b16b3995562e976d899d31d6e1ca13942f7c4a74a6593faaff111b0fdb052f9f9ac52d97e *4e1ad68197fa6fc0bcfd45c0788b89000000097048597300000dd700000dd70142289b78000003 *4c4944415438118d945b48145118c7677766767736ddf5868a5808b12c859445f4e0e62a56446a *4544172d888a100a7a360aca102a921e7c2942e9466258bd59a0962eea53ae208b8215e28350b8 *a0a8bb33b3d7e9ff9706dc50ea5b7e7bce9cef9cfff9ce772e16c330de0882d00462c00ece7777 *77cf783c9e715553938aa248baa68ff9fdfe03f0d12cc058abfde3cf0aff751006141630595753 *53d3cceaeaea8382fc020a6b6eb7db1708046ed21f0c062596ff631688b1df29f00e98d17f42bd *0e823f10f9765dd7d3f8b6c0f65555554d0c0f0f4b3535351cc8556c6a8c5c04efc10bc0e85570 *145c9a9d9d3d0e41548514266120cff901e124db00cb4de1004ec0c85c600a9402a6c78070fee0 *e0e08de2e2e2bb8b8b8b6a4e4e8e736969e95e7575f59d542a754a1445195d29bee10accb4b053 *02d481be3f75b67d0687909e90d3e92cd7342d25cbb2383737b7a3b1b1b101be47605363d4340a *73a33e826780c21a38089aa7a7a74fa0a4592449124a4a4a7a516f07836cdcccccc8e937d3a3a0 *3e0e7602a68bed9efefefe638585858f575656b4dcdc5c251c0eb7d5d6d6b6213de7909e79f4e1 *de659819f9fac60df3c70e067f862123ef465656d6edbebebe7208bfc404d97033900c5b1f39d3 *c2cde90457004f8d135cede8e8085456567e43ce29ce5392c6e991f1fdddebf5ee292a2afa82b6 *fd20c3ccc8cd5d3f022f840dee0185874167454505ef00851376bb5d44de65555563488f673234 *d902572de0980cfbfb2886e0ddc61e10e2512c1c1818b886a3d88aa3a8bb5c2ec7f2f2f243b4ef *cdcece3e1c8944e258816d6161c15f5f5fff0be9a9429a56317c2d688a7323b8d4d7e00230d371 *b1abab6b025187a2d168c2a138644dd54238e3bbc6c6c6bcc964720a93586d369b251e8fcfe3ed *d98ab119c619209c3a8992c2bcfe4c473f7885c7eb03a2415510637a8cabb9cc0f9fcf3703e116 *bc3914d6b0a2d2d1d1d1a7f4e10e385070ff248ae760ec1394343b047494a77133efe7e5e579b0 *69bacbedb2a6d3e95bb8f6e3bdbdbd367644a4ed48d1084e8d82e399c0e56ac69bd3505656a6a3 *649724d3f2169533c07cb4cef6f4f4cc22eaaf916824e9549c12261881989f2360160c16f9be0c *0d0d79ad566b10abd80271219148fc447d371eb7706b6babf5378fa474c8975829d60000000049 *454e44ae426082 addfile ./html/nhaddock.css hunk ./html/nhaddock.css 1 - +/* Defaults */ +* { margin: 0; padding: 0 } +ul { margin-left: 2em; } +p { margin: 0.5em 0; } + +/* Is this portable? */ +html { +/* background-color: #f4f7f9; */ + background-color: white; + width: 100%; +} + +body { + font-family: sans-serif; + background: white; + color: black; + margin: 0 auto; + max-width: 50em; + text-align: left; + line-height: 1.4; + padding: 0 0em; +} + +a { text-decoration: none; } +a:link { color: rgb(196,69,29); } +a:visited { color: rgb(171,105,84); } +a:hover { text-decoration:underline; } +/* a:hover { background: #D9CBB8; } */ + +.caption, h1, h2, h3, h4, h5, h6 { + font-weight: bold; + color: rgb(78,98,114); + margin: 0.8em 0 0.5em 0; +} + +#package-header { + background: rgb(41,56,69) url(hslogo-16.png) no-repeat 5px; + border-top: 5px solid rgb(78,98,114); + color: #ddd; + padding: 5px; + position: relative; + text-align: left; +} + +#package-header a:link, #package-header a:visited { color: white; } +#package-header a:hover { background: rgb(78,98,114); } +#package-header .caption { + color: white; + margin: 0 0 0 30px; + font-weight: normal; + font-style: normal; +} + +ul.links { + list-style: none; + text-align: left; + position: absolute; + right: 5px; + top: 5px; + display: inline-table; +} + +.fields .caption { display: none; } +.methods, .constructors { + background: #f8f8f8; + border: 1px solid #eee; +} + +.fields p { margin: 0 0; } + +ul.links li { + display: inline; +/* border-left: 1px solid rgb(78,98,114); */ + white-space: nowrap; + padding: 0; +} + +ul.links li a { padding: 5px 10px; } + +div#style-menu-holder { + position: relative; + z-index: 2; + display: inline; +} + +#style-menu { + position: absolute; + z-index: 1; + overflow: visible; + background: rgb(41,56,69); +/* background-color: #eaeaea; */ + margin: 0; + width: 6em; + text-align: center; + right: 0; + padding: 0 2px 1px; + border-left: 1px solid #919191; + border-right: 1px solid #919191; + border-bottom: 1px solid #919191; +} + + +#style-menu li { + display: list-item; + border-style: none; + margin: 0; + padding: 3px; + color: #000; + list-style-type: none; +} + +#style-menu li + li { + border-top: 1px solid #919191; +} + + + +/* +ul.links { + list-style: none; + text-align: left; + position: absolute; + right: 5px; + top: 5px; + display: inline-table; + margin: 0; +} +*/ +/* +ul.links li { + display: inline; + white-space: nowrap; +} +*/ +.hide { display: none; } + +.src { font-family: monospace; } +.keyword { font-weight: bold; } + +#module-header, #table-of-contents, #description, #synopsis, #interface { + margin: 1em 1em; + text-align: left; +/* border: 1px solid red; */ +} + +#module-header .caption { + color: rgb(78,98,114); + font-size: 200%; + font-weight: bold; + border-bottom: 1px solid #ddd; +} + +#table-of-contents { +} +#table-of-contents .caption { + color: rgb(78,98,114); + font-weight: bold; +} + +#table-of-contents > ul { margin-left: 1em; } + +#table-of-contents { +/* background: rgb(239,238,209); */ +/* border: 1px solid rgba(196,69,29,0.2); */ +} + +#table-of-contents ul { + list-style: none; +} + +#description > * { + margin-left: 1em; +} + +#description .caption { + font-size: 120%; + margin-left: 0; +} + +#synopsis { border-bottom: 1px solid #ddd; } +#synopsis ul { list-style: none; margin-left: 1em; margin-right: 1em; } +#synopsis > ul { + background: #f8f8f8; +/* border: 1px solid #ddd; */ +/* border-top: 0; */ + margin-bottom: 1em; +} +#synopsis li { padding: 0.2em 0.5em; line-height: normal; +} +#synopsis > ul > li { border-top: 1px dashed #ddd; } + +#synopsis .caption { + font-size: 120%; + color: rgb(78,98,114); + font-weight: bold; + padding-left: 0; + margin-bottom: 0.5em; +} + +#interface h1 { font-size: 150%; } +#interface h2 { font-size: 130%; } +#interface h3 { font-size: 120%; } +#interface h4 { font-size: 110%; } +#interface h5 { font-size: 105%; } + +#interface div.top { margin: 1em 0 0.5em 1em; } +#interface div, #interface p, #interface ul, #interface ol { margin-left: 0.5em; } +#interface div.top > p.src, #interface div.subs > p.src, +#interface div.top > .caption, #interface div.subs > .caption + { margin-left: 0; } + +#interface code { background: #f0f0f0; } +/* div.top code { border: 1px solid #ddd; } */ +.subs { margin-left: 1em !important; } + +#interface .src { + background: #f0f0f0; + line-height: normal; + padding: 0.2em 0.5em; + white-space: nowrap; +} +#interface p.src { + border-top: 1px solid #ccc; +} + +.fields > .caption { margin-top: 0.5em; } +.fields { padding-left: 1em; } +#interface table { border-spacing: 2px; } +#interface td { vertical-align: top; } + +.screen, pre { + padding: 0.5em; + margin: 0.5em 0; +/* border-top: 1px solid rgb(78,98,114); */ +/* border-bottom: 1px solid rgb(78,98,114); */ +/* background: rgb(226,235,243); */ + background: rgb(229,237,244); + margin-left: 1em; + margin-right: 1em; +} + +.screen code { border: 0 !important; background: inherit !important; } + +.info { + float: right; + background: rgb(239,238,209); + padding: 0.5em 1em; + margin-right: 0.5em; + margin-top: 1.5em; + border: 1px solid rgba(196,69,29,0.2); +} + +.info dd { margin-left: 2em; } + +#footer { + margin: 1em 0 0 0; + background: #ddd; + border-top: 1px solid #aaa; + padding: 0.5em; + color: #666; + text-align: center; +} + +/* + background: rgb(239,238,209); + padding: 0.5em 1em; + margin-right: 0.5em; + margin-top: 1.5em; + border: 1px solid rgba(196,69,29,0.2); +*/ hunk ./src/Haddock/Backends/Xhtml/Themes.hs 40 - CssTheme "Snappy" "shaddock.css" ["shaddock.css", iconFile] + CssTheme "Snappy" "shaddock.css" ["shaddock.css", iconFile], + CssTheme "Nomi" "nhaddock.css" ["nhaddock.css", "hslogo-16.png"] addfile ./html/s_haskell_icon.gif binary ./html/s_haskell_icon.gif oldhex * newhex *47494638396110001000f66000204a87224b88234d89254e8a28508b315790315890335a91365c *933f64983465a43d69a33969a63a6aa73c6ba83d6ca840649844679b4b6d9e4975ae4b77ae5575 *a45676a45a79a6567eb25c83b55c83b65d85b76783ad7f94ae6f8ab16f90bc6f92bf7191bb7490 *b87693bb7893ba7996bd7496c1729fcf75a1d076a2d076a2d17da7d37ea7d37fa8d48195af859c *bd8ca1c18ca2c180a0c884a4ca88aed790aed192afd28bb0d891b2d692b3d795b3d596b4d7a2b4 *cda4b5ceb4bcc6b5bdc7aabad1b8c6d9a3c1e0a4c1e0b4cce5b6cde6c4c9cfc8d2e1c4d7ebc8d9 *ece0e6efe3e8f0e5eaf1e6eaf1e6ecf4ebeff5ebf0f6ecf1f6edf3f9eef3f9eef4f9f2f4f8f3f5 *f8f4f6f9f5f7faf7fafcf8fafdfbfbfdfcfdfefdfdfefdfefefefeffffffff0000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *0000000000000021f90400000000002c00000000100010000007bc800b1d3f468586873f2e0b2e *5452504e4f4b4b5f94955f2e3f4327360a1905003c969484542a2c1b0a24000655a2855f44273b *0a1411002fae465f58342a260a2500034a96af5f4927390d0e17001cc5ba943427330a21020047 *95c65fd329d6000012dbd148273a0b0e16e1004094af582c28210a2300042f0008585fafb13ab4 *200080b125c1c07e46a2a438a54004800357be04b9d7c4c80f21277028c06000408f4aeb3c24a2 *12254a1328922c5559c24411a643302d76581008003b hunk ./html/shaddock.css 220 - background: #3465a4 url(haskell_icon.gif) no-repeat 4px 3px; + background: #3465a4 url(s_haskell_icon.gif) no-repeat 4px 3px; hunk ./src/Haddock/Backends/Xhtml/Themes.hs 40 - CssTheme "Snappy" "shaddock.css" ["shaddock.css", iconFile], + CssTheme "Snappy" "shaddock.css" ["shaddock.css", "s_haskell_icon.gif"], hunk ./html/thaddock.css 72 - /* padding:0.8em 0 0; */ hunk ./html/thaddock.css 163 - padding:0; + padding:1em 0 0; hunk ./html/thaddock.css 191 -a, a:link { +a:link { hunk ./html/thaddock.css 231 -.top, .subs { +.top { hunk ./html/thaddock.css 237 - font-family:monospace; - font-size:larger; - font-weight:bold; hunk ./html/thaddock.css 245 -.arguments { - margin: 0 0 1em; -} hunk ./html/thaddock.css 258 -.caption { - margin-top: 0; - padding-top: 0; -} - hunk ./html/thaddock.css 260 - color: #919100; hunk ./html/thaddock.css 351 + +.keyword { + font-weight: bold; + font-family: monospace; +} + +#synopsis { + display: none; +} + +td p { + padding-top: 0; +} + +.src { + font-family: monospace; + font-size: larger; +} + +.def { + font-weight: bold; +} + hunk ./src/Haddock/Backends/Xhtml/Themes.hs 63 - anchor ! [ href "#", onclick js ] << "Style\9662", + anchor ! [ href "#", onclick js ] << "Style \9662", hunk ./src/Haddock/Backends/Xhtml/Utils.hs 26 - + + onclick, hunk ./src/Haddock/Backends/Xhtml/Utils.hs 29 - - cssFiles, styleSheet, stylePickers, styleMenu hunk ./src/Haddock/Backends/Xhtml/Utils.hs 195 - --- Standard set of style sheets, first is the preferred -cssThemes :: [(String, String)] -cssThemes = [ - ("Classic", "xhaddock.css"), - ("Tibbe", "thaddock.css"), - ("Snappy", "shaddock.css") - ] - -cssFiles :: [String] -cssFiles = map snd cssThemes - -styleSheet :: Html -styleSheet = toHtml $ zipWith mkLink cssThemes rels - where - rels = ("stylesheet" : repeat "alternate stylesheet") - mkLink (aTitle, aFile) aRel = - (thelink ! [href aFile, rel aRel, thetype "text/css", XHtml.title aTitle]) noHtml - -stylePickers :: [Html] -stylePickers = map mkPicker cssThemes - where - mkPicker (aTitle, aFile) = - let js = "setActiveStyleSheet('" ++ aFile ++ "'); return false;" in - anchor ! [href "#", onclick js] << aTitle - -styleMenu :: Html -styleMenu = thediv ! [identifier "style-menu-holder"] << [ - anchor ! [ href "#", onclick js ] << "Style\9662", - unordList stylePickers ! [ identifier "style-menu", theclass "hide" ] - ] - where - js = "styleMenu(); return false;" - hunk ./src/Main.hs 154 + when (any (`elem` [Flag_Html, Flag_Xhtml, Flag_Hoogle, Flag_LaTeX]) flags) $ + throwE "No input file(s)." + hunk ./src/Main.hs 357 + + when ((Flag_GenIndex `elem` flags || Flag_GenContents `elem` flags) + && Flag_Xhtml `elem` flags) $ + throwE "--xhtml cannot be used with --gen-index or --gen-contents" + + when ((Flag_GenIndex `elem` flags || Flag_GenContents `elem` flags) + && Flag_Hoogle `elem` flags) $ + throwE "--hoogle cannot be used with --gen-index or --gen-contents" + + when ((Flag_GenIndex `elem` flags || Flag_GenContents `elem` flags) + && Flag_LaTeX `elem` flags) $ + throwE "--latex cannot be used with --gen-index or --gen-contents" hunk ./src/Main.hs 124 - handleEasyFlags flags + shortcutFlags flags hunk ./src/Main.hs 339 -handleEasyFlags :: [Flag] -> IO () -handleEasyFlags flags = do +shortcutFlags :: [Flag] -> IO () +shortcutFlags flags = do hunk ./src/Haddock/Backends/LaTeX.hs 91 - -haddockSty :: String hunk ./src/Haddock/Backends/LaTeX.hs 181 - _ -> parens (sep (punctuate comma (map (ppDocBinder . fst) subdocs))) + xs -> parens (sep (punctuate comma (map (ppDocBinder . fst) subdocs))) hunk ./src/Haddock/Backends/LaTeX.hs 287 - SigD (TypeSig (L _ n) (L _ t)) -> ppFunSig loc (mbDoc, fnArgsDoc) n t unicode False + SigD (TypeSig (L _ n) (L _ t)) -> ppFunSig loc (mbDoc, fnArgsDoc) n t unicode hunk ./src/Haddock/Backends/LaTeX.hs 294 - -ppTyFam :: t -> t1 -> t2 -> t3 -> t4 -> a -ppTyFam _ _ _ _ _ = +ppTyFam _ _ _ _ _ = hunk ./src/Haddock/Backends/LaTeX.hs 297 - -ppDataInst :: t -> t1 -> t2 -> a hunk ./src/Haddock/Backends/LaTeX.hs 300 - -ppTyInst :: t -> t1 -> t2 -> t3 -> t4 -> a hunk ./src/Haddock/Backends/LaTeX.hs 303 - -ppFor :: t -> t1 -> t2 -> t3 -> a hunk ./src/Haddock/Backends/LaTeX.hs 316 - = ppTypeOrFunSig loc name (unLoc ltype) doc + = ppTypeOrFunSig loc name (unLoc ltype) doc hunk ./src/Haddock/Backends/LaTeX.hs 331 - -> Bool -> Bool - -> LaTeX -ppFunSig loc doc docname typ unicode methods = + -> Bool -> LaTeX +ppFunSig loc doc docname typ unicode = hunk ./src/Haddock/Backends/LaTeX.hs 335 - unicode methods + unicode hunk ./src/Haddock/Backends/LaTeX.hs 342 - -> Bool -> Bool -> LaTeX + -> Bool -> LaTeX hunk ./src/Haddock/Backends/LaTeX.hs 344 - unicode _ + unicode methods hunk ./src/Haddock/Backends/LaTeX.hs 461 - (ClassDecl lctxt lname ltyvars lfds lsigs _ _ _) unicode + decl@(ClassDecl lctxt lname ltyvars lfds lsigs _ ats _) unicode hunk ./src/Haddock/Backends/LaTeX.hs 469 + nm = unLoc $ tcdLName decl + hunk ./src/Haddock/Backends/LaTeX.hs 479 --- | otherwise = atTable $$ methodTable + | otherwise = error "LaTeX.ppClassDecl" hunk ./src/Haddock/Backends/LaTeX.hs 483 - vcat [ ppFunSig loc doc n typ unicode True + vcat [ ppFunSig loc doc n typ unicode hunk ./src/Haddock/Backends/LaTeX.hs 532 -ppDataDecl instances subdocs _ mbDoc dataDecl unicode +ppDataDecl instances subdocs loc mbDoc dataDecl unicode hunk ./src/Haddock/Backends/LaTeX.hs 539 + docname = unLoc . tcdLName $ dataDecl hunk ./src/Haddock/Backends/LaTeX.hs 564 +isRecCon :: Located (ConDecl a) -> Bool +isRecCon lcon = case con_details (unLoc lcon) of + RecCon _ -> True + _ -> False + hunk ./src/Haddock/Backends/LaTeX.hs 923 - +ppVerbBinder :: OccName -> LaTeX +ppVerbBinder n + | isVarSym n = parens $ ppVerbOccName n + | otherwise = ppVerbOccName n + hunk ./src/Haddock/Backends/LaTeX.hs 961 - +ppVerbDocBinder :: DocName -> LaTeX +ppVerbDocBinder = ppVerbBinder . docNameOcc + hunk ./src/Haddock/Backends/LaTeX.hs 967 - +ppVerbName :: Name -> LaTeX +ppVerbName = ppVerbOccName . nameOccName + hunk ./src/Haddock/Backends/LaTeX.hs 977 - -latexMunge :: Char -> String -> String hunk ./src/Haddock/Backends/LaTeX.hs 991 - -latexMonoMunge :: Char -> String -> String hunk ./src/Haddock/Backends/LaTeX.hs 1009 - markupModule = \m _ -> let (mdl,_ref) = break (=='#') m in tt (text mdl), + markupModule = \m v -> let (mdl,_ref) = break (=='#') m in tt (text mdl), hunk ./src/Haddock/Backends/LaTeX.hs 1011 - markupMonospaced = \p _ -> tt (p Mono), + markupMonospaced = \p v -> tt (p Mono), hunk ./src/Haddock/Backends/LaTeX.hs 1013 - markupPic = \path _ -> parens (text "image: " <> text path), + markupPic = \path v -> parens (text "image: " <> text path), hunk ./src/Haddock/Backends/LaTeX.hs 1078 - -------------------------------------------------------------------------------- --- * LaTeX utils -------------------------------------------------------------------------------- - +latexStripLeadingPara :: Doc a -> Doc a +latexStripLeadingPara (DocParagraph p) = p +latexStripLeadingPara (DocAppend l r) = DocAppend (latexStripLeadingPara l) r +latexStripLeadingPara d = d + +-- ----------------------------------------------------------------------------- +-- LaTeX utils hunk ./src/Haddock/Backends/LaTeX.hs 91 + +haddockSty :: FilePath hunk ./src/Haddock/Backends/LaTeX.hs 183 - xs -> parens (sep (punctuate comma (map (ppDocBinder . fst) subdocs))) + _ -> parens (sep (punctuate comma (map (ppDocBinder . fst) subdocs))) hunk ./src/Haddock/Backends/LaTeX.hs 296 -ppTyFam _ _ _ _ _ = + +ppTyFam :: Bool -> SrcSpan -> Maybe (Doc DocName) -> + TyClDecl DocName -> Bool -> LaTeX +ppTyFam _ _ _ _ _ = hunk ./src/Haddock/Backends/LaTeX.hs 302 -ppDataInst _ _ _ = + +ppDataInst :: a +ppDataInst = hunk ./src/Haddock/Backends/LaTeX.hs 307 + +ppTyInst :: Bool -> SrcSpan -> Maybe (Doc DocName) -> + TyClDecl DocName -> Bool -> LaTeX hunk ./src/Haddock/Backends/LaTeX.hs 313 + +ppFor :: SrcSpan -> DocForDecl DocName -> ForeignDecl DocName -> Bool -> LaTeX hunk ./src/Haddock/Backends/LaTeX.hs 328 - = ppTypeOrFunSig loc name (unLoc ltype) doc - (full, hdr, char '=') unicode False + = ppTypeOrFunSig loc name (unLoc ltype) doc (full, hdr, char '=') unicode hunk ./src/Haddock/Backends/LaTeX.hs 355 - unicode methods + unicode hunk ./src/Haddock/Backends/LaTeX.hs 472 - decl@(ClassDecl lctxt lname ltyvars lfds lsigs _ ats _) unicode + (ClassDecl lctxt lname ltyvars lfds lsigs _ ats _) unicode hunk ./src/Haddock/Backends/LaTeX.hs 480 - nm = unLoc $ tcdLName decl - hunk ./src/Haddock/Backends/LaTeX.hs 485 - | null lsigs = Nothing - | otherwise = Just methodTable + | null lsigs, null ats = Nothing + | null ats = Just methodTable +--- | otherwise = atTable $$ methodTable ++ | otherwise = error "LaTeX.ppClassDecl" hunk ./src/Haddock/Backends/LaTeX.hs 490 - | otherwise = error "LaTeX.ppClassDecl" - hunk ./src/Haddock/Backends/LaTeX.hs 541 -ppDataDecl instances subdocs loc mbDoc dataDecl unicode +ppDataDecl instances subdocs _loc mbDoc dataDecl unicode hunk ./src/Haddock/Backends/LaTeX.hs 548 - docname = unLoc . tcdLName $ dataDecl hunk ./src/Haddock/Backends/LaTeX.hs 572 -isRecCon :: Located (ConDecl a) -> Bool -isRecCon lcon = case con_details (unLoc lcon) of - RecCon _ -> True - _ -> False - hunk ./src/Haddock/Backends/LaTeX.hs 926 -ppVerbBinder :: OccName -> LaTeX -ppVerbBinder n - | isVarSym n = parens $ ppVerbOccName n - | otherwise = ppVerbOccName n hunk ./src/Haddock/Backends/LaTeX.hs 960 -ppVerbDocBinder :: DocName -> LaTeX -ppVerbDocBinder = ppVerbBinder . docNameOcc hunk ./src/Haddock/Backends/LaTeX.hs 964 -ppVerbName :: Name -> LaTeX -ppVerbName = ppVerbOccName . nameOccName hunk ./src/Haddock/Backends/LaTeX.hs 972 + +latexMunge :: Char -> String -> String hunk ./src/Haddock/Backends/LaTeX.hs 988 + +latexMonoMunge :: Char -> String -> String hunk ./src/Haddock/Backends/LaTeX.hs 1008 - markupModule = \m v -> let (mdl,_ref) = break (=='#') m in tt (text mdl), + markupModule = \m _ -> let (mdl,_ref) = break (=='#') m in tt (text mdl), hunk ./src/Haddock/Backends/LaTeX.hs 1010 - markupMonospaced = \p v -> tt (p Mono), + markupMonospaced = \p _ -> tt (p Mono), hunk ./src/Haddock/Backends/LaTeX.hs 1012 - markupPic = \path v -> parens (text "image: " <> text path), + markupPic = \path _ -> parens (text "image: " <> text path), hunk ./src/Haddock/Backends/LaTeX.hs 1077 -latexStripLeadingPara :: Doc a -> Doc a -latexStripLeadingPara (DocParagraph p) = p -latexStripLeadingPara (DocAppend l r) = DocAppend (latexStripLeadingPara l) r -latexStripLeadingPara d = d hunk ./src/Haddock/Backends/LaTeX.hs 1078 --- ----------------------------------------------------------------------------- --- LaTeX utils +------------------------------------------------------------------------------- +-- * LaTeX utils +------------------------------------------------------------------------------- + hunk ./src/Haddock/Utils.hs 376 -spanWith _ [] = ([],[]) +spanWith p [] = ([],[]) hunk ./src/Haddock/Utils.hs 375 + hunk ./src/Haddock/Utils.hs 377 -spanWith p [] = ([],[]) +spanWith _ [] = ([],[]) hunk ./src/Haddock/Backends/LaTeX.hs 499 - instancesBit - | null instances = empty - | all (isNothing . snd) instances = - declWithDoc (vcat (map (ppInstDecl unicode) (map fst instances))) Nothing - | otherwise = vcat (map (ppDocInstance unicode) instances) + instancesBit = ppDocInstances unicode instances hunk ./src/Haddock/Backends/LaTeX.hs 503 +ppDocInstances :: Bool -> [DocInstance DocName] -> LaTeX +ppDocInstances unicode [] = empty +ppDocInstances unicode (i : rest) + | Just ihead <- isUndocdInstance i + = declWithDoc (vcat (map (ppInstDecl unicode) (ihead:is))) Nothing $$ + ppDocInstances unicode rest' + | otherwise + = ppDocInstance unicode i $$ ppDocInstances unicode rest + where + (is, rest') = spanWith isUndocdInstance rest + +isUndocdInstance :: DocInstance a -> Maybe (InstHead a) +isUndocdInstance (i,Nothing) = Just i +isUndocdInstance _ = Nothing hunk ./src/Haddock/Backends/LaTeX.hs 576 - instancesBit - | null instances = empty - | all (isNothing . snd) instances = - declWithDoc (vcat (map (ppInstDecl unicode) (map fst instances))) Nothing - | otherwise = vcat (map (ppDocInstance unicode) instances) + instancesBit = ppDocInstances unicode instances hunk ./src/Haddock/Backends/LaTeX.hs 504 -ppDocInstances unicode [] = empty +ppDocInstances _unicode [] = empty hunk ./src/Haddock/Lex.x 187 +#if MIN_VERSION_ghc(6,13,0) hunk ./src/Haddock/Lex.x 189 +#else + pstate = mkPState buffer noSrcLoc dflags +#endif hunk ./src/Haddock/Backends/LaTeX.hs 488 -+ | otherwise = error "LaTeX.ppClassDecl" + | otherwise = error "LaTeX.ppClassDecl" hunk ./html/nhaddock.css 1 -/* Defaults */ +/* @group Fundamentals */ + hunk ./html/nhaddock.css 4 -ul { margin-left: 2em; } -p { margin: 0.5em 0; } hunk ./html/nhaddock.css 20 - padding: 0 0em; + padding: 0 1em; hunk ./html/nhaddock.css 23 +p { margin: 0.5em 0; } + +ul { margin-left: 2em; } + hunk ./html/nhaddock.css 31 + +h1 { font-size: 150%; } +h2 { font-size: 130%; } +h3 { font-size: 120%; } +h4 { font-size: 110%; } +h5 { font-size: 105%; } + hunk ./html/nhaddock.css 40 +/* @end */ + +/* @group Common */ + hunk ./html/nhaddock.css 50 +ul.links { + list-style: none; + text-align: left; + position: absolute; + right: 5px; + top: 5px; + display: inline-table; +} + +ul.links li { + display: inline; +/* border-left: 1px solid rgb(78,98,114); */ + white-space: nowrap; + padding: 0; +} + +ul.links li a { padding: 5px 10px; } + +/* +ul.links { + list-style: none; + text-align: left; + position: absolute; + right: 5px; + top: 5px; + display: inline-table; + margin: 0; +} +*/ +/* +ul.links li { + display: inline; + white-space: nowrap; +} +*/ + +.hide { display: none; } +.show { } + +pre { + padding: 0.5em; + margin: 0.5em 0; +/* border-top: 1px solid rgb(78,98,114); */ +/* border-bottom: 1px solid rgb(78,98,114); */ +/* background: rgb(226,235,243); */ + background: rgb(229,237,244); + margin-left: 1em; + margin-right: 1em; +} + +code { /* background: #f0f0f0; */ } + +.src { + font-family: monospace; + line-height: normal; + white-space: nowrap; + background: #f0f0f0; + padding: 0.2em 0.5em; +} + +.keyword { font-weight: bold; } +.def { font-weight: bold; } + +/* @end */ + +/* @group Page Structure */ + hunk ./html/nhaddock.css 135 -ul.links { - list-style: none; - text-align: left; - position: absolute; - right: 5px; - top: 5px; - display: inline-table; +#module-header, #table-of-contents, #description, #synopsis, #interface { + margin: 1em 0; hunk ./html/nhaddock.css 139 -.fields .caption { display: none; } -.methods, .constructors { - background: #f8f8f8; - border: 1px solid #eee; +#module-header .caption { + color: rgb(78,98,114); + font-size: 200%; + font-weight: bold; + border-bottom: 1px solid #ddd; hunk ./html/nhaddock.css 146 -.fields p { margin: 0 0; } - -ul.links li { - display: inline; -/* border-left: 1px solid rgb(78,98,114); */ - white-space: nowrap; - padding: 0; +.info { + float: right; + background: rgb(239,238,209); + padding: 0.5em 1em; + margin-right: 0.5em; + margin-top: 1.5em; + border: 1px solid rgba(196,69,29,0.2); hunk ./html/nhaddock.css 155 -ul.links li a { padding: 5px 10px; } +.info dd { margin-left: 2em; } hunk ./html/nhaddock.css 179 - hunk ./html/nhaddock.css 192 - - -/* -ul.links { - list-style: none; - text-align: left; - position: absolute; - right: 5px; - top: 5px; - display: inline-table; - margin: 0; -} -*/ -/* -ul.links li { - display: inline; - white-space: nowrap; +#footer { + margin: 1em 0 0 0; + background: #ddd; + border-top: 1px solid #aaa; + padding: 0.5em; + color: #666; + text-align: center; hunk ./html/nhaddock.css 200 -*/ -.hide { display: none; } hunk ./html/nhaddock.css 201 -.src { font-family: monospace; } -.keyword { font-weight: bold; } +/* @end */ hunk ./html/nhaddock.css 203 -#module-header, #table-of-contents, #description, #synopsis, #interface { - margin: 1em 1em; - text-align: left; -/* border: 1px solid red; */ -} +/* @group Front Matter */ hunk ./html/nhaddock.css 205 -#module-header .caption { - color: rgb(78,98,114); - font-size: 200%; - font-weight: bold; - border-bottom: 1px solid #ddd; -} - -#table-of-contents { -} hunk ./html/nhaddock.css 221 -#description > * { - margin-left: 1em; -} - hunk ./html/nhaddock.css 223 - margin-left: 0; hunk ./html/nhaddock.css 225 -#synopsis { border-bottom: 1px solid #ddd; } -#synopsis ul { list-style: none; margin-left: 1em; margin-right: 1em; } -#synopsis > ul { - background: #f8f8f8; -/* border: 1px solid #ddd; */ -/* border-top: 0; */ - margin-bottom: 1em; +#synopsis { + display: none; hunk ./html/nhaddock.css 228 -#synopsis li { padding: 0.2em 0.5em; line-height: normal; -} -#synopsis > ul > li { border-top: 1px dashed #ddd; } hunk ./html/nhaddock.css 229 -#synopsis .caption { - font-size: 120%; - color: rgb(78,98,114); - font-weight: bold; - padding-left: 0; - margin-bottom: 0.5em; -} - -#interface h1 { font-size: 150%; } -#interface h2 { font-size: 130%; } -#interface h3 { font-size: 120%; } -#interface h4 { font-size: 110%; } -#interface h5 { font-size: 105%; } +/* @end */ hunk ./html/nhaddock.css 231 -#interface div.top { margin: 1em 0 0.5em 1em; } -#interface div, #interface p, #interface ul, #interface ol { margin-left: 0.5em; } -#interface div.top > p.src, #interface div.subs > p.src, -#interface div.top > .caption, #interface div.subs > .caption - { margin-left: 0; } +/* @group Main Content */ hunk ./html/nhaddock.css 233 -#interface code { background: #f0f0f0; } -/* div.top code { border: 1px solid #ddd; } */ -.subs { margin-left: 1em !important; } +#interface div.top { margin: 1em 0 0.5em 0; } hunk ./html/nhaddock.css 235 -#interface .src { - background: #f0f0f0; - line-height: normal; - padding: 0.2em 0.5em; - white-space: nowrap; -} -#interface p.src { - border-top: 1px solid #ccc; -} - -.fields > .caption { margin-top: 0.5em; } -.fields { padding-left: 1em; } hunk ./html/nhaddock.css 237 - -.screen, pre { - padding: 0.5em; - margin: 0.5em 0; -/* border-top: 1px solid rgb(78,98,114); */ -/* border-bottom: 1px solid rgb(78,98,114); */ -/* background: rgb(226,235,243); */ - background: rgb(229,237,244); - margin-left: 1em; - margin-right: 1em; +#interface td.doc p { + margin: 0; +} +#interface td.doc p + p { + margin-top: 0.5em; hunk ./html/nhaddock.css 244 -.screen code { border: 0 !important; background: inherit !important; } +/* div.top code { border: 1px solid #ddd; } */ +.top p.src { + border-top: 1px solid #ccc; +} hunk ./html/nhaddock.css 249 -.info { - float: right; - background: rgb(239,238,209); - padding: 0.5em 1em; - margin-right: 0.5em; - margin-top: 1.5em; - border: 1px solid rgba(196,69,29,0.2); +.subs, .doc { + padding-left: 2em; hunk ./html/nhaddock.css 253 -.info dd { margin-left: 2em; } +.fields .caption { display: none; } hunk ./html/nhaddock.css 255 -#footer { - margin: 1em 0 0 0; - background: #ddd; - border-top: 1px solid #aaa; - padding: 0.5em; - color: #666; - text-align: center; +.fields p { margin: 0 0; } + +.methods, .constructors { + background: #f8f8f8; + border: 1px solid #eee; hunk ./html/nhaddock.css 262 -/* - background: rgb(239,238,209); - padding: 0.5em 1em; - margin-right: 0.5em; - margin-top: 1.5em; - border: 1px solid rgba(196,69,29,0.2); -*/ +.fields { padding-left: 1em; } + +/* @end */ hunk ./html/nhaddock.css 135 -#module-header, #table-of-contents, #description, #synopsis, #interface { - margin: 1em 0; -} - hunk ./html/nhaddock.css 201 -#table-of-contents .caption { - color: rgb(78,98,114); - font-weight: bold; +#table-of-contents { + float: right; + background: rgb(239,238,209); + border: 1px solid rgba(196,69,29,0.2); + font-size: 70%; + padding: 0.5em 1em; + position: relative; + top: -5em; + margin: 0 0 1em 1em; hunk ./html/nhaddock.css 212 -#table-of-contents > ul { margin-left: 1em; } - -#table-of-contents { -/* background: rgb(239,238,209); */ -/* border: 1px solid rgba(196,69,29,0.2); */ +#table-of-contents .caption { + text-align: center; + margin: 0; hunk ./html/nhaddock.css 219 + margin-left: 0; +} + +#table-of-contents ul ul { + margin-left: 2em; hunk ./html/nhaddock.css 227 - font-size: 120%; + display: none; hunk ./html/nhaddock.css 269 +/* @end */ + +/* @group Auxillary Pages */ + +#mini #interface h1, +#mini #interface h2, +#mini #interface h3, +#mini #interface h4 +{ + margin-bottom: 0; +} +#mini #interface .top, +#mini #interface .src { + margin: 0; +} + +#mini #module-list ul { + list-style: none; + margin: 0; +} + +#alphabet ul { + list-style: none; + padding: 0; + margin: 0.5em 0 0; + text-align: center; +} + +#alphabet li { + display: inline; + margin: 0 0.25em; +} + +#alphabet a { + font-weight: bold; +} + +#index .caption, +#module-list .caption { font-size: 130%; } + +#index table { + margin-left: 2em; +} + +#index .src { + font-weight: bold; +} +#index .alt { + font-size: 70%; + font-style: italic; + padding-left: 2em; +} + +#index td + td { + padding-left: 1em; +} + +#module-list ul { + list-style: none; + margin: 0 0 0 2em; +} + +#module-list .package { + float: right; +} + hunk ./haddock.cabal 110 - Haddock.Utils.BlockTable - Haddock.Utils.Html hunk ./haddock.cabal 111 - Haddock.Backends.Html hunk ./haddock.cabal 174 - Haddock.Utils.BlockTable - Haddock.Utils.Html hunk ./haddock.cabal 175 - Haddock.Backends.Html hunk ./src/Haddock/Backends/Html.hs 1 ------------------------------------------------------------------------------ --- | --- Module : Haddock.Backends.Html --- Copyright : (c) Simon Marlow 2003-2006, --- David Waern 2006-2009 --- License : BSD-like --- --- Maintainer : haddock@projects.haskell.org --- Stability : experimental --- Portability : portable ------------------------------------------------------------------------------ -module Haddock.Backends.Html ( - ppHtml, copyHtmlBits, - ppHtmlIndex, ppHtmlContents, - ppHtmlHelpFiles -) where - - -import Prelude hiding (div) - -import Haddock.Backends.DevHelp -import Haddock.Backends.HH -import Haddock.Backends.HH2 -import Haddock.ModuleTree -import Haddock.Types -import Haddock.Version -import Haddock.Utils -import Haddock.Utils.Html hiding ( name, title, p ) -import qualified Haddock.Utils.Html as Html -import Haddock.GhcUtils - -import Control.Exception ( bracket ) -import Control.Monad ( when, unless, join ) -import Data.Char ( toUpper ) -import Data.List ( sortBy, groupBy ) -import Data.Maybe -import Foreign.Marshal.Alloc ( allocaBytes ) -import System.IO ( IOMode(..), hClose, hGetBuf, hPutBuf, openFile ) -import System.Directory hiding ( copyFile ) -import System.FilePath hiding ( () ) -import Data.Map ( Map ) -import qualified Data.Map as Map hiding ( Map ) -import Data.Function -import Data.Ord ( comparing ) - -import GHC hiding ( NoLink, moduleInfo ) -import Name -import Module -import RdrName hiding ( Qual, is_explicit ) -import FastString ( unpackFS ) -import BasicTypes ( IPName(..), Boxity(..) ) -import Outputable ( ppr, showSDoc, Outputable ) - --- the base, module and entity URLs for the source code and wiki links. -type SourceURLs = (Maybe String, Maybe String, Maybe String) -type WikiURLs = (Maybe String, Maybe String, Maybe String) - - --- ----------------------------------------------------------------------------- --- Generating HTML documentation - -ppHtml :: String - -> Maybe String -- package - -> [Interface] - -> FilePath -- destination directory - -> Maybe (Doc GHC.RdrName) -- prologue text, maybe - -> Maybe String -- the Html Help format (--html-help) - -> SourceURLs -- the source URL (--source) - -> WikiURLs -- the wiki URL (--wiki) - -> Maybe String -- the contents URL (--use-contents) - -> Maybe String -- the index URL (--use-index) - -> Bool -- whether to use unicode in output (--use-unicode) - -> IO () - -ppHtml doctitle maybe_package ifaces odir prologue maybe_html_help_format - maybe_source_url maybe_wiki_url - maybe_contents_url maybe_index_url unicode = do - let - visible_ifaces = filter visible ifaces - visible i = OptHide `notElem` ifaceOptions i - when (not (isJust maybe_contents_url)) $ - ppHtmlContents odir doctitle maybe_package - maybe_html_help_format maybe_index_url maybe_source_url maybe_wiki_url - (map toInstalledIface visible_ifaces) - False -- we don't want to display the packages in a single-package contents - prologue - - when (not (isJust maybe_index_url)) $ - ppHtmlIndex odir doctitle maybe_package maybe_html_help_format - maybe_contents_url maybe_source_url maybe_wiki_url - (map toInstalledIface visible_ifaces) - - when (not (isJust maybe_contents_url && isJust maybe_index_url)) $ - ppHtmlHelpFiles doctitle maybe_package ifaces odir maybe_html_help_format [] - - mapM_ (ppHtmlModule odir doctitle - maybe_source_url maybe_wiki_url - maybe_contents_url maybe_index_url unicode) visible_ifaces - -ppHtmlHelpFiles - :: String -- doctitle - -> Maybe String -- package - -> [Interface] - -> FilePath -- destination directory - -> Maybe String -- the Html Help format (--html-help) - -> [FilePath] -- external packages paths - -> IO () -ppHtmlHelpFiles doctitle maybe_package ifaces odir maybe_html_help_format pkg_paths = do - let - visible_ifaces = filter visible ifaces - visible i = OptHide `notElem` ifaceOptions i - - -- Generate index and contents page for Html Help if requested - case maybe_html_help_format of - Nothing -> return () - Just "mshelp" -> ppHHProject odir doctitle maybe_package visible_ifaces pkg_paths - Just "mshelp2" -> do - ppHH2Files odir maybe_package visible_ifaces pkg_paths - ppHH2Collection odir doctitle maybe_package - Just "devhelp" -> ppDevHelpFile odir doctitle maybe_package visible_ifaces - Just format -> fail ("The "++format++" format is not implemented") - -copyFile :: FilePath -> FilePath -> IO () -copyFile fromFPath toFPath = - (bracket (openFile fromFPath ReadMode) hClose $ \hFrom -> - bracket (openFile toFPath WriteMode) hClose $ \hTo -> - allocaBytes bufferSize $ \buffer -> - copyContents hFrom hTo buffer) - where - bufferSize = 1024 - - copyContents hFrom hTo buffer = do - count <- hGetBuf hFrom buffer bufferSize - when (count > 0) $ do - hPutBuf hTo buffer count - copyContents hFrom hTo buffer - - -copyHtmlBits :: FilePath -> FilePath -> Maybe FilePath -> IO () -copyHtmlBits odir libdir maybe_css = do - let - libhtmldir = joinPath [libdir, "html"] - css_file = case maybe_css of - Nothing -> joinPath [libhtmldir, cssFile] - Just f -> f - css_destination = joinPath [odir, cssFile] - copyLibFile f = do - copyFile (joinPath [libhtmldir, f]) (joinPath [odir, f]) - copyFile css_file css_destination - mapM_ copyLibFile [ iconFile, plusFile, minusFile, jsFile, framesFile ] - -footer :: HtmlTable -footer = - tda [theclass "botbar"] << - ( toHtml "Produced by" <+> - (anchor ! [href projectUrl] << toHtml projectName) <+> - toHtml ("version " ++ projectVersion) - ) - -srcButton :: SourceURLs -> Maybe Interface -> HtmlTable -srcButton (Just src_base_url, _, _) Nothing = - topButBox (anchor ! [href src_base_url] << toHtml "Source code") - -srcButton (_, Just src_module_url, _) (Just iface) = - let url = spliceURL (Just $ ifaceOrigFilename iface) - (Just $ ifaceMod iface) Nothing Nothing src_module_url - in topButBox (anchor ! [href url] << toHtml "Source code") - -srcButton _ _ = - Html.emptyTable - -spliceURL :: Maybe FilePath -> Maybe Module -> Maybe GHC.Name -> - Maybe SrcSpan -> String -> String -spliceURL maybe_file maybe_mod maybe_name maybe_loc url = run url - where - file = fromMaybe "" maybe_file - mdl = case maybe_mod of - Nothing -> "" - Just m -> moduleString m - - (name, kind) = - case maybe_name of - Nothing -> ("","") - Just n | isValOcc (nameOccName n) -> (escapeStr (getOccString n), "v") - | otherwise -> (escapeStr (getOccString n), "t") - - line = case maybe_loc of - Nothing -> "" - Just span_ -> show $ srcSpanStartLine span_ - - run "" = "" - run ('%':'M':rest) = mdl ++ run rest - run ('%':'F':rest) = file ++ run rest - run ('%':'N':rest) = name ++ run rest - run ('%':'K':rest) = kind ++ run rest - run ('%':'L':rest) = line ++ run rest - run ('%':'%':rest) = "%" ++ run rest - - run ('%':'{':'M':'O':'D':'U':'L':'E':'}':rest) = mdl ++ run rest - run ('%':'{':'F':'I':'L':'E':'}':rest) = file ++ run rest - run ('%':'{':'N':'A':'M':'E':'}':rest) = name ++ run rest - run ('%':'{':'K':'I':'N':'D':'}':rest) = kind ++ run rest - - run ('%':'{':'M':'O':'D':'U':'L':'E':'/':'.':'/':c:'}':rest) = - map (\x -> if x == '.' then c else x) mdl ++ run rest - - run ('%':'{':'F':'I':'L':'E':'/':'/':'/':c:'}':rest) = - map (\x -> if x == '/' then c else x) file ++ run rest - - run ('%':'{':'L':'I':'N':'E':'}':rest) = line ++ run rest - - run (c:rest) = c : run rest - -wikiButton :: WikiURLs -> Maybe Module -> HtmlTable -wikiButton (Just wiki_base_url, _, _) Nothing = - topButBox (anchor ! [href wiki_base_url] << toHtml "User Comments") - -wikiButton (_, Just wiki_module_url, _) (Just mdl) = - let url = spliceURL Nothing (Just mdl) Nothing Nothing wiki_module_url - in topButBox (anchor ! [href url] << toHtml "User Comments") - -wikiButton _ _ = - Html.emptyTable - -contentsButton :: Maybe String -> HtmlTable -contentsButton maybe_contents_url - = topButBox (anchor ! [href url] << toHtml "Contents") - where url = maybe contentsHtmlFile id maybe_contents_url - -indexButton :: Maybe String -> HtmlTable -indexButton maybe_index_url - = topButBox (anchor ! [href url] << toHtml "Index") - where url = maybe indexHtmlFile id maybe_index_url - -simpleHeader :: String -> Maybe String -> Maybe String - -> SourceURLs -> WikiURLs -> HtmlTable -simpleHeader doctitle maybe_contents_url maybe_index_url - maybe_source_url maybe_wiki_url = - (tda [theclass "topbar"] << - vanillaTable << ( - (td << - image ! [src "haskell_icon.gif", width "16", height 16, alt " " ] - ) <-> - (tda [theclass "title"] << toHtml doctitle) <-> - srcButton maybe_source_url Nothing <-> - wikiButton maybe_wiki_url Nothing <-> - contentsButton maybe_contents_url <-> indexButton maybe_index_url - )) - -pageHeader :: String -> Interface -> String - -> SourceURLs -> WikiURLs - -> Maybe String -> Maybe String -> HtmlTable -pageHeader mdl iface doctitle - maybe_source_url maybe_wiki_url - maybe_contents_url maybe_index_url = - (tda [theclass "topbar"] << - vanillaTable << ( - (td << - image ! [src "haskell_icon.gif", width "16", height 16, alt " "] - ) <-> - (tda [theclass "title"] << toHtml doctitle) <-> - srcButton maybe_source_url (Just iface) <-> - wikiButton maybe_wiki_url (Just $ ifaceMod iface) <-> - contentsButton maybe_contents_url <-> - indexButton maybe_index_url - ) - ) - tda [theclass "modulebar"] << - (vanillaTable << ( - (td << font ! [size "6"] << toHtml mdl) <-> - moduleInfo iface - ) - ) - -moduleInfo :: Interface -> HtmlTable -moduleInfo iface = - let - info = ifaceInfo iface - - doOneEntry :: (String, (HaddockModInfo GHC.Name) -> Maybe String) -> Maybe HtmlTable - doOneEntry (fieldName,field) = case field info of - Nothing -> Nothing - Just fieldValue -> - Just ((tda [theclass "infohead"] << toHtml fieldName) - <-> (tda [theclass "infoval"]) << toHtml fieldValue) - - entries :: [HtmlTable] - entries = mapMaybe doOneEntry [ - ("Portability",hmi_portability), - ("Stability",hmi_stability), - ("Maintainer",hmi_maintainer) - ] - in - case entries of - [] -> Html.emptyTable - _ -> tda [align "right"] << narrowTable << (foldl1 () entries) - --- --------------------------------------------------------------------------- --- Generate the module contents - -ppHtmlContents - :: FilePath - -> String - -> Maybe String - -> Maybe String - -> Maybe String - -> SourceURLs - -> WikiURLs - -> [InstalledInterface] -> Bool -> Maybe (Doc GHC.RdrName) - -> IO () -ppHtmlContents odir doctitle - maybe_package maybe_html_help_format maybe_index_url - maybe_source_url maybe_wiki_url ifaces showPkgs prologue = do - let tree = mkModuleTree showPkgs - [(instMod iface, toInstalledDescription iface) | iface <- ifaces] - html = - header - (documentCharacterEncoding +++ - thetitle (toHtml doctitle) +++ - styleSheet +++ - (script ! [src jsFile, thetype "text/javascript"] $ noHtml)) +++ - body << vanillaTable << ( - simpleHeader doctitle Nothing maybe_index_url - maybe_source_url maybe_wiki_url - ppPrologue doctitle prologue - ppModuleTree doctitle tree - s15 - footer - ) - createDirectoryIfMissing True odir - writeFile (joinPath [odir, contentsHtmlFile]) (renderHtml html) - - -- XXX: think of a better place for this? - ppHtmlContentsFrame odir doctitle ifaces - - -- Generate contents page for Html Help if requested - case maybe_html_help_format of - Nothing -> return () - Just "mshelp" -> ppHHContents odir doctitle maybe_package tree - Just "mshelp2" -> ppHH2Contents odir doctitle maybe_package tree - Just "devhelp" -> return () - Just format -> fail ("The "++format++" format is not implemented") - -ppPrologue :: String -> Maybe (Doc GHC.RdrName) -> HtmlTable -ppPrologue _ Nothing = Html.emptyTable -ppPrologue title (Just doc) = - (tda [theclass "section1"] << toHtml title) - docBox (rdrDocToHtml doc) - -ppModuleTree :: String -> [ModuleTree] -> HtmlTable -ppModuleTree _ ts = - tda [theclass "section1"] << toHtml "Modules" - td << vanillaTable2 << htmlTable - where - genTable tbl id_ [] = (tbl, id_) - genTable tbl id_ (x:xs) = genTable (tbl u) id' xs - where - (u,id') = mkNode [] x 0 id_ - - (htmlTable,_) = genTable emptyTable 0 ts - -mkNode :: [String] -> ModuleTree -> Int -> Int -> (HtmlTable,Int) -mkNode ss (Node s leaf pkg short ts) depth id_ = htmlNode - where - htmlNode = case ts of - [] -> (td_pad_w 1.25 depth << htmlModule <-> shortDescr <-> htmlPkg,id_) - _ -> (td_w depth << (collapsebutton id_s +++ htmlModule) <-> shortDescr <-> htmlPkg - (td_subtree << sub_tree), id') - - mod_width = 50::Int {-em-} - - td_pad_w :: Double -> Int -> Html -> HtmlTable - td_pad_w pad depth_ = - tda [thestyle ("padding-left: " ++ show pad ++ "em;" ++ - "width: " ++ show (mod_width - depth_*2) ++ "em")] - - td_w depth_ = - tda [thestyle ("width: " ++ show (mod_width - depth_*2) ++ "em")] - - td_subtree = - tda [thestyle ("padding: 0; padding-left: 2em")] - - shortDescr :: HtmlTable - shortDescr = case short of - Nothing -> td empty - Just doc -> tda [theclass "rdoc"] (origDocToHtml doc) - - htmlModule - | leaf = ppModule (mkModule (stringToPackageId pkgName) - (mkModuleName mdl)) "" - | otherwise = toHtml s - - -- ehm.. TODO: change the ModuleTree type - (htmlPkg, pkgName) = case pkg of - Nothing -> (td << empty, "") - Just p -> (td << toHtml p, p) - - mdl = foldr (++) "" (s' : map ('.':) ss') - (s':ss') = reverse (s:ss) - -- reconstruct the module name - - id_s = "n." ++ show id_ - - (sub_tree,id') = genSubTree emptyTable (id_+1) ts - - genSubTree :: HtmlTable -> Int -> [ModuleTree] -> (Html,Int) - genSubTree htmlTable id__ [] = (sub_tree_, id__) - where - sub_tree_ = collapsed vanillaTable2 id_s htmlTable - genSubTree htmlTable id__ (x:xs) = genSubTree (htmlTable u) id__' xs - where - (u,id__') = mkNode (s:ss) x (depth+1) id__ - --- The URL for source and wiki links, and the current module -type LinksInfo = (SourceURLs, WikiURLs) - --- | 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 -> [InstalledInterface] -> IO () -ppHtmlContentsFrame odir doctitle ifaces = do - let mods = flatModuleTree ifaces - html = - header - (documentCharacterEncoding +++ - thetitle (toHtml doctitle) +++ - styleSheet +++ - (script ! [src jsFile, thetype "text/javascript"] $ noHtml)) +++ - body << vanillaTable << Html.p << ( - foldr (+++) noHtml (map (+++br) mods)) - createDirectoryIfMissing True odir - writeFile (joinPath [odir, frameIndexHtmlFile]) (renderHtml html) - --- --------------------------------------------------------------------------- --- Generate the index - -ppHtmlIndex :: FilePath - -> String - -> Maybe String - -> Maybe String - -> Maybe String - -> SourceURLs - -> WikiURLs - -> [InstalledInterface] - -> IO () -ppHtmlIndex odir doctitle maybe_package maybe_html_help_format - maybe_contents_url maybe_source_url maybe_wiki_url ifaces = do - let html = - header (documentCharacterEncoding +++ - thetitle (toHtml (doctitle ++ " (Index)")) +++ - styleSheet +++ - (script ! [src jsFile, thetype "text/javascript"] $ noHtml)) +++ - body << vanillaTable << ( - simpleHeader doctitle maybe_contents_url Nothing - maybe_source_url maybe_wiki_url - index_html - ) - - createDirectoryIfMissing True odir - - when split_indices $ - mapM_ (do_sub_index index) initialChars - - writeFile (joinPath [odir, indexHtmlFile]) (renderHtml html) - - -- Generate index and contents page for Html Help if requested - case maybe_html_help_format of - Nothing -> return () - Just "mshelp" -> ppHHIndex odir maybe_package ifaces - Just "mshelp2" -> ppHH2Index odir maybe_package ifaces - Just "devhelp" -> return () - Just format -> fail ("The "++format++" format is not implemented") - where - - index_html - | split_indices = - tda [theclass "section1"] << - toHtml ("Index") - indexInitialLetterLinks - | otherwise = - td << setTrClass (table ! [identifier "indexlist", cellpadding 0, cellspacing 5] << - aboves (map indexElt index)) - - -- an arbitrary heuristic: - -- too large, and a single-page will be slow to load - -- too small, and we'll have lots of letter-indexes with only one - -- or two members in them, which seems inefficient or - -- unnecessarily hard to use. - split_indices = length index > 150 - - setTrClass :: Html -> Html - setTrClass (Html xs) = Html $ map f xs - where - f (HtmlTag name attrs inner) - | map toUpper name == "TR" = HtmlTag name (theclass "indexrow":attrs) inner - | otherwise = HtmlTag name attrs (setTrClass inner) - f x = x - - indexInitialLetterLinks = - td << setTrClass (table ! [cellpadding 0, cellspacing 5] << - besides [ td << anchor ! [href (subIndexHtmlFile c)] << - toHtml [c] - | c <- initialChars - , any ((==c) . toUpper . head . fst) index ]) - - -- todo: what about names/operators that start with Unicode - -- characters? - -- Exports beginning with '_' can be listed near the end, - -- presumably they're not as important... but would be listed - -- with non-split index! - initialChars = [ 'A'..'Z' ] ++ ":!#$%&*+./<=>?@\\^|-~" ++ "_" - - do_sub_index this_ix c - = unless (null index_part) $ - writeFile (joinPath [odir, subIndexHtmlFile c]) (renderHtml html) - where - html = header (documentCharacterEncoding +++ - thetitle (toHtml (doctitle ++ " (Index)")) +++ - styleSheet) +++ - body << vanillaTable << ( - simpleHeader doctitle maybe_contents_url Nothing - maybe_source_url maybe_wiki_url - indexInitialLetterLinks - tda [theclass "section1"] << - toHtml ("Index (" ++ c:")") - td << setTrClass (table ! [identifier "indexlist", cellpadding 0, cellspacing 5] << - aboves (map indexElt index_part) ) - ) - - index_part = [(n,stuff) | (n,stuff) <- this_ix, toUpper (head n) == c] - - - index :: [(String, Map GHC.Name [(Module,Bool)])] - index = sortBy cmp (Map.toAscList full_index) - where cmp (n1,_) (n2,_) = map toUpper n1 `compare` map toUpper n2 - - -- for each name (a plain string), we have a number of original HsNames that - -- it can refer to, and for each of those we have a list of modules - -- that export that entity. Each of the modules exports the entity - -- in a visible or invisible way (hence the Bool). - full_index :: Map String (Map GHC.Name [(Module,Bool)]) - full_index = Map.fromListWith (flip (Map.unionWith (++))) - (concat (map getIfaceIndex ifaces)) - - getIfaceIndex iface = - [ (getOccString name - , Map.fromList [(name, [(mdl, name `elem` instVisibleExports iface)])]) - | name <- instExports iface ] - where mdl = instMod iface - - indexElt :: (String, Map GHC.Name [(Module,Bool)]) -> HtmlTable - indexElt (str, entities) = - case Map.toAscList entities of - [(nm,entries)] -> - tda [ theclass "indexentry" ] << toHtml str <-> - indexLinks nm entries - many_entities -> - tda [ theclass "indexentry" ] << toHtml str - aboves (map doAnnotatedEntity (zip [1..] many_entities)) - - doAnnotatedEntity :: (Integer, (Name, [(Module, Bool)])) -> HtmlTable - doAnnotatedEntity (j,(nm,entries)) - = tda [ theclass "indexannot" ] << - toHtml (show j) <+> parens (ppAnnot (nameOccName nm)) <-> - indexLinks nm entries - - ppAnnot n | not (isValOcc n) = toHtml "Type/Class" - | isDataOcc n = toHtml "Data Constructor" - | otherwise = toHtml "Function" - - indexLinks nm entries = - tda [ theclass "indexlinks" ] << - hsep (punctuate comma - [ if visible then - linkId mdl (Just nm) << toHtml (moduleString mdl) - else - toHtml (moduleString mdl) - | (mdl, visible) <- entries ]) - --- --------------------------------------------------------------------------- --- Generate the HTML page for a module - -ppHtmlModule - :: FilePath -> String - -> SourceURLs -> WikiURLs - -> Maybe String -> Maybe String -> Bool - -> Interface -> IO () -ppHtmlModule odir doctitle - maybe_source_url maybe_wiki_url - maybe_contents_url maybe_index_url unicode iface = do - let - mdl = ifaceMod iface - mdl_str = moduleString mdl - html = - header (documentCharacterEncoding +++ - thetitle (toHtml mdl_str) +++ - styleSheet +++ - (script ! [src jsFile, thetype "text/javascript"] $ noHtml) +++ - (script ! [thetype "text/javascript"] - -- XXX: quoting errors possible? - << Html [HtmlString ("window.onload = function () {setSynopsis(\"mini_" - ++ moduleHtmlFile mdl ++ "\")};")]) - ) +++ - body << vanillaTable << ( - pageHeader mdl_str iface doctitle - maybe_source_url maybe_wiki_url - maybe_contents_url maybe_index_url s15 - ifaceToHtml maybe_source_url maybe_wiki_url iface unicode s15 - footer - ) - createDirectoryIfMissing True odir - writeFile (joinPath [odir, moduleHtmlFile mdl]) (renderHtml html) - ppHtmlModuleMiniSynopsis odir doctitle iface unicode - -ppHtmlModuleMiniSynopsis :: FilePath -> String -> Interface -> Bool -> IO () -ppHtmlModuleMiniSynopsis odir _doctitle iface unicode = do - let mdl = ifaceMod iface - html = - header - (documentCharacterEncoding +++ - thetitle (toHtml $ moduleString mdl) +++ - styleSheet +++ - (script ! [src jsFile, thetype "text/javascript"] $ noHtml)) +++ - body << thediv ! [ theclass "outer" ] << ( - (thediv ! [theclass "mini-topbar"] - << toHtml (moduleString mdl)) +++ - miniSynopsis mdl iface unicode) - createDirectoryIfMissing True odir - writeFile (joinPath [odir, "mini_" ++ moduleHtmlFile mdl]) (renderHtml html) - -ifaceToHtml :: SourceURLs -> WikiURLs -> Interface -> Bool -> HtmlTable -ifaceToHtml maybe_source_url maybe_wiki_url iface unicode - = abovesSep s15 (contents ++ description: synopsis: maybe_doc_hdr: bdy) - where - exports = numberSectionHeadings (ifaceRnExportItems iface) - - -- todo: if something has only sub-docs, or fn-args-docs, should - -- it be measured here and thus prevent omitting the synopsis? - has_doc (ExportDecl _ doc _ _) = isJust (fst doc) - has_doc (ExportNoDecl _ _) = False - has_doc (ExportModule _) = False - has_doc _ = True - - no_doc_at_all = not (any has_doc exports) - - contents = case ppModuleContents exports of - Nothing -> [] - Just x -> [td << vanillaTable << x] - - description - = case ifaceRnDoc iface of - Nothing -> Html.emptyTable - Just doc -> (tda [theclass "section1"] << toHtml "Description") - docBox (docToHtml doc) - - -- omit the synopsis if there are no documentation annotations at all - synopsis - | no_doc_at_all = Html.emptyTable - | otherwise - = (tda [theclass "section1"] << toHtml "Synopsis") - s15 - (tda [theclass "body"] << vanillaTable << - abovesSep s8 (map (processExport True linksInfo unicode) - (filter forSummary exports)) - ) - - -- if the documentation doesn't begin with a section header, then - -- add one ("Documentation"). - maybe_doc_hdr - = case exports of - [] -> Html.emptyTable - ExportGroup _ _ _ : _ -> Html.emptyTable - _ -> tda [ theclass "section1" ] << toHtml "Documentation" - - bdy = map (processExport False linksInfo unicode) exports - linksInfo = (maybe_source_url, maybe_wiki_url) - -miniSynopsis :: Module -> Interface -> Bool -> Html -miniSynopsis mdl iface unicode = - thediv ! [ theclass "mini-synopsis" ] - << hsep (map (processForMiniSynopsis mdl unicode) $ exports) - where - exports = numberSectionHeadings (ifaceRnExportItems iface) - -processForMiniSynopsis :: Module -> Bool -> ExportItem DocName -> Html -processForMiniSynopsis mdl unicode (ExportDecl (L _loc decl0) _doc _ _insts) = - thediv ! [theclass "decl" ] << - case decl0 of - TyClD d@(TyFamily{}) -> ppTyFamHeader True False d unicode - TyClD d@(TyData{tcdTyPats = ps}) - | Nothing <- ps -> keyword "data" <++> ppTyClBinderWithVarsMini mdl d - | Just _ <- ps -> keyword "data" <++> keyword "instance" - <++> ppTyClBinderWithVarsMini mdl d - TyClD d@(TySynonym{tcdTyPats = ps}) - | Nothing <- ps -> keyword "type" <++> ppTyClBinderWithVarsMini mdl d - | Just _ <- ps -> keyword "type" <++> keyword "instance" - <++> ppTyClBinderWithVarsMini mdl d - TyClD d@(ClassDecl {}) -> - keyword "class" <++> ppTyClBinderWithVarsMini mdl d - SigD (TypeSig (L _ n) (L _ _)) -> - let nm = docNameOcc n - in ppNameMini mdl nm - _ -> noHtml -processForMiniSynopsis _ _ (ExportGroup lvl _id txt) = - let heading - | lvl == 1 = h1 - | lvl == 2 = h2 - | lvl >= 3 = h3 - | otherwise = error "bad group level" - in heading << docToHtml txt -processForMiniSynopsis _ _ _ = noHtml - -ppNameMini :: Module -> OccName -> Html -ppNameMini mdl nm = - anchor ! [ href (moduleNameUrl mdl nm) - , target mainFrameName ] - << ppBinder' nm - -ppTyClBinderWithVarsMini :: Module -> TyClDecl DocName -> Html -ppTyClBinderWithVarsMini mdl decl = - let n = unLoc $ tcdLName decl - ns = tyvarNames $ tcdTyVars decl - in ppTypeApp n ns (ppNameMini mdl . docNameOcc) ppTyName - -ppModuleContents :: [ExportItem DocName] -> Maybe HtmlTable -ppModuleContents exports - | length sections == 0 = Nothing - | otherwise = Just (tda [theclass "section4"] << bold << toHtml "Contents" - td << dlist << concatHtml sections) - where - (sections, _leftovers{-should be []-}) = process 0 exports - - process :: Int -> [ExportItem DocName] -> ([Html],[ExportItem DocName]) - process _ [] = ([], []) - process n items@(ExportGroup lev id0 doc : rest) - | lev <= n = ( [], items ) - | otherwise = ( html:secs, rest2 ) - where - html = (dterm << linkedAnchor id0 << docToHtml doc) - +++ mk_subsections ssecs - (ssecs, rest1) = process lev rest - (secs, rest2) = process n rest1 - process n (_ : rest) = process n rest - - mk_subsections [] = noHtml - mk_subsections ss = ddef << dlist << concatHtml ss - --- we need to assign a unique id to each section heading so we can hyperlink --- them from the contents: -numberSectionHeadings :: [ExportItem DocName] -> [ExportItem DocName] -numberSectionHeadings exports = go 1 exports - where go :: Int -> [ExportItem DocName] -> [ExportItem DocName] - go _ [] = [] - go n (ExportGroup lev _ doc : es) - = ExportGroup lev (show n) doc : go (n+1) es - go n (other:es) - = other : go n es - -processExport :: Bool -> LinksInfo -> Bool -> (ExportItem DocName) -> HtmlTable -processExport _ _ _ (ExportGroup lev id0 doc) - = ppDocGroup lev (namedAnchor id0 << docToHtml doc) -processExport summary links unicode (ExportDecl decl doc subdocs insts) - = ppDecl summary links decl doc insts subdocs unicode -processExport _ _ _ (ExportNoDecl y []) - = declBox (ppDocName y) -processExport _ _ _ (ExportNoDecl y subs) - = declBox (ppDocName y <+> parenList (map ppDocName subs)) -processExport _ _ _ (ExportDoc doc) - = docBox (docToHtml doc) -processExport _ _ _ (ExportModule mdl) - = declBox (toHtml "module" <+> ppModule mdl "") - -forSummary :: (ExportItem DocName) -> Bool -forSummary (ExportGroup _ _ _) = False -forSummary (ExportDoc _) = False -forSummary _ = True - -ppDocGroup :: Int -> Html -> HtmlTable -ppDocGroup lev doc - | lev == 1 = tda [ theclass "section1" ] << doc - | lev == 2 = tda [ theclass "section2" ] << doc - | lev == 3 = tda [ theclass "section3" ] << doc - | otherwise = tda [ theclass "section4" ] << doc - -declWithDoc :: Bool -> LinksInfo -> SrcSpan -> DocName -> Maybe (Doc DocName) -> Html -> HtmlTable -declWithDoc True _ _ _ _ html_decl = declBox html_decl -declWithDoc False links loc nm Nothing html_decl = topDeclBox links loc nm html_decl -declWithDoc False links loc nm (Just doc) html_decl = - topDeclBox links loc nm html_decl docBox (docToHtml doc) - - --- TODO: use DeclInfo DocName or something -ppDecl :: Bool -> LinksInfo -> LHsDecl DocName -> - DocForDecl DocName -> [DocInstance DocName] -> [(DocName, DocForDecl DocName)] -> Bool -> HtmlTable -ppDecl summ links (L loc decl) (mbDoc, fnArgsDoc) instances subdocs unicode = case decl of - TyClD d@(TyFamily {}) -> ppTyFam summ False links loc mbDoc d unicode - TyClD d@(TyData {}) - | Nothing <- tcdTyPats d -> ppDataDecl summ links instances subdocs loc mbDoc d unicode - | Just _ <- tcdTyPats d -> ppDataInst summ links loc mbDoc d - TyClD d@(TySynonym {}) - | Nothing <- tcdTyPats d -> ppTySyn summ links loc (mbDoc, fnArgsDoc) d unicode - | Just _ <- tcdTyPats d -> ppTyInst summ False links loc mbDoc d unicode - TyClD d@(ClassDecl {}) -> ppClassDecl summ links instances loc mbDoc subdocs d unicode - SigD (TypeSig (L _ n) (L _ t)) -> ppFunSig summ links loc (mbDoc, fnArgsDoc) n t unicode - ForD d -> ppFor summ links loc (mbDoc, fnArgsDoc) d unicode - InstD _ -> Html.emptyTable - _ -> error "declaration not supported by ppDecl" - -ppFunSig :: Bool -> LinksInfo -> SrcSpan -> DocForDecl DocName -> - DocName -> HsType DocName -> Bool -> HtmlTable -ppFunSig summary links loc doc docname typ unicode = - ppTypeOrFunSig summary links loc docname typ doc - (ppTypeSig summary occname typ unicode, ppBinder False occname, dcolon unicode) unicode - where - occname = docNameOcc docname - -ppTypeOrFunSig :: Bool -> LinksInfo -> SrcSpan -> DocName -> HsType DocName -> - DocForDecl DocName -> (Html, Html, Html) -> Bool -> HtmlTable -ppTypeOrFunSig summary links loc docname typ (doc, argDocs) (pref1, pref2, sep) unicode - | summary || Map.null argDocs = declWithDoc summary links loc docname doc pref1 - | otherwise = topDeclBox links loc docname pref2 - (tda [theclass "body"] << vanillaTable << ( - do_args 0 sep typ - (case doc of - Just d -> ndocBox (docToHtml d) - Nothing -> Html.emptyTable) - )) - where - argDocHtml n = case Map.lookup n argDocs of - Just adoc -> docToHtml adoc - Nothing -> noHtml - - do_largs n leader (L _ t) = do_args n leader t - do_args :: Int -> Html -> (HsType DocName) -> HtmlTable - do_args n leader (HsForAllTy Explicit tvs lctxt ltype) - = (argBox ( - leader <+> - hsep (forallSymbol unicode : ppTyVars tvs ++ [dot]) <+> - ppLContextNoArrow lctxt unicode) - <-> rdocBox noHtml) - do_largs n (darrow unicode) ltype - do_args n leader (HsForAllTy Implicit _ lctxt ltype) - | not (null (unLoc lctxt)) - = (argBox (leader <+> ppLContextNoArrow lctxt unicode) - <-> rdocBox noHtml) - do_largs n (darrow unicode) ltype - -- if we're not showing any 'forall' or class constraints or - -- anything, skip having an empty line for the context. - | otherwise - = do_largs n leader ltype - do_args n leader (HsFunTy lt r) - = (argBox (leader <+> ppLFunLhType unicode lt) <-> rdocBox (argDocHtml n)) - do_largs (n+1) (arrow unicode) r - do_args n leader t - = argBox (leader <+> ppType unicode t) <-> rdocBox (argDocHtml n) - - -ppTyVars :: [LHsTyVarBndr DocName] -> [Html] -ppTyVars tvs = map ppTyName (tyvarNames tvs) - - -tyvarNames :: [LHsTyVarBndr DocName] -> [Name] -tyvarNames = map (getName . hsTyVarName . unLoc) - - -ppFor :: Bool -> LinksInfo -> SrcSpan -> DocForDecl DocName -> ForeignDecl DocName -> Bool -> HtmlTable -ppFor summary links loc doc (ForeignImport (L _ name) (L _ typ) _) unicode - = ppFunSig summary links loc doc name typ unicode -ppFor _ _ _ _ _ _ = error "ppFor" - - --- we skip type patterns for now -ppTySyn :: Bool -> LinksInfo -> SrcSpan -> DocForDecl DocName -> TyClDecl DocName -> Bool -> HtmlTable -ppTySyn summary links loc doc (TySynonym (L _ name) ltyvars _ ltype) unicode - = ppTypeOrFunSig summary links loc name (unLoc ltype) doc - (full, hdr, spaceHtml +++ equals) unicode - where - hdr = hsep ([keyword "type", ppBinder summary occ] ++ ppTyVars ltyvars) - full = hdr <+> equals <+> ppLType unicode ltype - occ = docNameOcc name -ppTySyn _ _ _ _ _ _ = error "declaration not supported by ppTySyn" - - -ppTypeSig :: Bool -> OccName -> HsType DocName -> Bool -> Html -ppTypeSig summary nm ty unicode = ppBinder summary nm <+> dcolon unicode <+> ppType unicode ty - - -ppTyName :: Name -> Html -ppTyName name - | isNameSym name = parens (ppName name) - | otherwise = ppName name - - --------------------------------------------------------------------------------- --- Type families --------------------------------------------------------------------------------- - - -ppTyFamHeader :: Bool -> Bool -> TyClDecl DocName -> Bool -> Html -ppTyFamHeader summary associated decl unicode = - - (case tcdFlavour decl of - TypeFamily - | associated -> keyword "type" - | otherwise -> keyword "type family" - DataFamily - | associated -> keyword "data" - | otherwise -> keyword "data family" - ) <+> - - ppTyClBinderWithVars summary decl <+> - - case tcdKind decl of - Just kind -> dcolon unicode <+> ppKind kind - Nothing -> empty - - -ppTyFam :: Bool -> Bool -> LinksInfo -> SrcSpan -> Maybe (Doc DocName) -> - TyClDecl DocName -> Bool -> HtmlTable -ppTyFam summary associated links loc mbDoc decl unicode - - | summary = declWithDoc summary links loc docname mbDoc - (ppTyFamHeader True associated decl unicode) - - | associated, isJust mbDoc = header_ bodyBox << doc - | associated = header_ - | null instances, isJust mbDoc = header_ bodyBox << doc - | null instances = header_ - | isJust mbDoc = header_ bodyBox << (doc instancesBit) - | otherwise = header_ bodyBox << instancesBit - - where - docname = tcdName decl - - header_ = topDeclBox links loc docname (ppTyFamHeader summary associated decl unicode) - - doc = ndocBox . docToHtml . fromJust $ mbDoc - - instId = collapseId (getName docname) - - instancesBit = instHdr instId - tda [theclass "body"] << - collapsed thediv instId ( - spacedTable1 << ( - aboves (map (ppDocInstance unicode) instances) - ) - ) - - -- TODO: get the instances - instances = [] - - --------------------------------------------------------------------------------- --- Indexed data types --------------------------------------------------------------------------------- - - -ppDataInst :: a -ppDataInst = undefined - - --------------------------------------------------------------------------------- --- Indexed newtypes --------------------------------------------------------------------------------- - --- TODO --- ppNewTyInst = undefined - - --------------------------------------------------------------------------------- --- Indexed types --------------------------------------------------------------------------------- - - -ppTyInst :: Bool -> Bool -> LinksInfo -> SrcSpan -> Maybe (Doc DocName) -> - TyClDecl DocName -> Bool -> HtmlTable -ppTyInst summary associated links loc mbDoc decl unicode - - | summary = declWithDoc summary links loc docname mbDoc - (ppTyInstHeader True associated decl unicode) - - | isJust mbDoc = header_ bodyBox << doc - | otherwise = header_ - - where - docname = tcdName decl - - header_ = topDeclBox links loc docname (ppTyInstHeader summary associated decl unicode) - - doc = case mbDoc of - Just d -> ndocBox (docToHtml d) - Nothing -> Html.emptyTable - - -ppTyInstHeader :: Bool -> Bool -> TyClDecl DocName -> Bool -> Html -ppTyInstHeader _ _ decl unicode = - keyword "type instance" <+> - ppAppNameTypes (tcdName decl) typeArgs unicode - where - typeArgs = map unLoc . fromJust . tcdTyPats $ decl - - --------------------------------------------------------------------------------- --- Associated Types --------------------------------------------------------------------------------- - - -ppAssocType :: Bool -> LinksInfo -> DocForDecl DocName -> LTyClDecl DocName -> Bool -> HtmlTable -ppAssocType summ links doc (L loc decl) unicode = - case decl of - TyFamily {} -> ppTyFam summ True links loc (fst doc) decl unicode - TySynonym {} -> ppTySyn summ links loc doc decl unicode - _ -> error "declaration type not supported by ppAssocType" - - --------------------------------------------------------------------------------- --- TyClDecl helpers --------------------------------------------------------------------------------- - - --- | Print a type family / newtype / data / class binder and its variables -ppTyClBinderWithVars :: Bool -> TyClDecl DocName -> Html -ppTyClBinderWithVars summ decl = - ppAppDocNameNames summ (unLoc $ tcdLName decl) (tyvarNames $ tcdTyVars decl) - - --------------------------------------------------------------------------------- --- Type applications --------------------------------------------------------------------------------- - - --- | Print an application of a DocName and a list of HsTypes -ppAppNameTypes :: DocName -> [HsType DocName] -> Bool -> Html -ppAppNameTypes n ts unicode = ppTypeApp n ts ppDocName (ppParendType unicode) - - --- | Print an application of a DocName and a list of Names -ppAppDocNameNames :: Bool -> DocName -> [Name] -> Html -ppAppDocNameNames summ n ns = - ppTypeApp n ns (ppBinder summ . docNameOcc) ppTyName - - --- | General printing of type applications -ppTypeApp :: DocName -> [a] -> (DocName -> Html) -> (a -> Html) -> Html -ppTypeApp n (t1:t2:rest) ppDN ppT - | operator, not . null $ rest = parens opApp <+> hsep (map ppT rest) - | operator = opApp - where - operator = isNameSym . getName $ n - opApp = ppT t1 <+> ppDN n <+> ppT t2 - -ppTypeApp n ts ppDN ppT = ppDN n <+> hsep (map ppT ts) - - -------------------------------------------------------------------------------- --- Contexts -------------------------------------------------------------------------------- - - -ppLContext, ppLContextNoArrow :: Located (HsContext DocName) -> Bool -> Html -ppLContext = ppContext . unLoc -ppLContextNoArrow = ppContextNoArrow . unLoc - - -ppContextNoArrow :: HsContext DocName -> Bool -> Html -ppContextNoArrow [] _ = empty -ppContextNoArrow cxt unicode = pp_hs_context (map unLoc cxt) unicode - - -ppContextNoLocs :: [HsPred DocName] -> Bool -> Html -ppContextNoLocs [] _ = empty -ppContextNoLocs cxt unicode = pp_hs_context cxt unicode <+> darrow unicode - - -ppContext :: HsContext DocName -> Bool -> Html -ppContext cxt unicode = ppContextNoLocs (map unLoc cxt) unicode - - -pp_hs_context :: [HsPred DocName] -> Bool -> Html -pp_hs_context [] _ = empty -pp_hs_context [p] unicode = ppPred unicode p -pp_hs_context cxt unicode = parenList (map (ppPred unicode) cxt) - - -ppPred :: Bool -> HsPred DocName -> Html -ppPred unicode (HsClassP n ts) = ppAppNameTypes n (map unLoc ts) unicode -ppPred unicode (HsEqualP t1 t2) = ppLType unicode t1 <+> toHtml "~" <+> ppLType unicode t2 -ppPred unicode (HsIParam (IPName n) t) - = toHtml "?" +++ ppDocName n <+> dcolon unicode <+> ppLType unicode t - - -------------------------------------------------------------------------------- --- Class declarations -------------------------------------------------------------------------------- - - -ppClassHdr :: Bool -> Located [LHsPred DocName] -> DocName - -> [Located (HsTyVarBndr DocName)] -> [Located ([DocName], [DocName])] - -> Bool -> Html -ppClassHdr summ lctxt n tvs fds unicode = - keyword "class" - <+> (if not . null . unLoc $ lctxt then ppLContext lctxt unicode else empty) - <+> ppAppDocNameNames summ n (tyvarNames $ tvs) - <+> ppFds fds unicode - - -ppFds :: [Located ([DocName], [DocName])] -> Bool -> Html -ppFds fds unicode = - if null fds then noHtml else - char '|' <+> hsep (punctuate comma (map (fundep . unLoc) fds)) - where - fundep (vars1,vars2) = hsep (map ppDocName vars1) <+> arrow unicode <+> - hsep (map ppDocName vars2) - -ppShortClassDecl :: Bool -> LinksInfo -> TyClDecl DocName -> SrcSpan -> [(DocName, DocForDecl DocName)] -> Bool -> HtmlTable -ppShortClassDecl summary links (ClassDecl lctxt lname tvs fds sigs _ ats _) loc subdocs unicode = - if null sigs && null ats - then (if summary then declBox else topDeclBox links loc nm) hdr - else (if summary then declBox else topDeclBox links loc nm) (hdr <+> keyword "where") - - ( - bodyBox << - aboves - ( - [ ppAssocType summary links doc at unicode | at <- ats - , let doc = lookupAnySubdoc (tcdName $ unL at) subdocs ] ++ - - [ ppFunSig summary links loc doc n typ unicode - | L _ (TypeSig (L _ n) (L _ typ)) <- sigs - , let doc = lookupAnySubdoc n subdocs ] - ) - ) - where - hdr = ppClassHdr summary lctxt (unLoc lname) tvs fds unicode - nm = unLoc lname -ppShortClassDecl _ _ _ _ _ _ = error "declaration type not supported by ppShortClassDecl" - - - -ppClassDecl :: Bool -> LinksInfo -> [DocInstance DocName] -> SrcSpan - -> Maybe (Doc DocName) -> [(DocName, DocForDecl DocName)] - -> TyClDecl DocName -> Bool -> HtmlTable -ppClassDecl summary links instances loc mbDoc subdocs - decl@(ClassDecl lctxt lname ltyvars lfds lsigs _ ats _) unicode - | summary = ppShortClassDecl summary links decl loc subdocs unicode - | otherwise = classheader bodyBox << (classdoc body_ instancesBit) - where - classheader - | null lsigs = topDeclBox links loc nm (hdr unicode) - | otherwise = topDeclBox links loc nm (hdr unicode <+> keyword "where") - - nm = unLoc $ tcdLName decl - - hdr = ppClassHdr summary lctxt (unLoc lname) ltyvars lfds - - classdoc = case mbDoc of - Nothing -> Html.emptyTable - Just d -> ndocBox (docToHtml d) - - body_ - | null lsigs, null ats = Html.emptyTable - | null ats = s8 methHdr bodyBox << methodTable - | otherwise = s8 atHdr bodyBox << atTable - s8 methHdr bodyBox << methodTable - - methodTable = - abovesSep s8 [ ppFunSig summary links loc doc n typ unicode - | L _ (TypeSig (L _ n) (L _ typ)) <- lsigs - , let doc = lookupAnySubdoc n subdocs ] - - atTable = abovesSep s8 $ [ ppAssocType summary links doc at unicode | at <- ats - , let doc = lookupAnySubdoc (tcdName $ unL at) subdocs ] - - instId = collapseId (getName nm) - instancesBit - | null instances = Html.emptyTable - | otherwise - = s8 instHdr instId - tda [theclass "body"] << - collapsed thediv instId ( - spacedTable1 << aboves (map (ppDocInstance unicode) instances) - ) -ppClassDecl _ _ _ _ _ _ _ _ = error "declaration type not supported by ppShortClassDecl" - - --- | Print a possibly commented instance. The instance header is printed inside --- an 'argBox'. The comment is printed to the right of the box in normal comment --- style. -ppDocInstance :: Bool -> DocInstance DocName -> HtmlTable -ppDocInstance unicode (instHead, maybeDoc) = - argBox (ppInstHead unicode instHead) <-> maybeRDocBox maybeDoc - - -ppInstHead :: Bool -> InstHead DocName -> Html -ppInstHead unicode ([], n, ts) = ppAppNameTypes n ts unicode -ppInstHead unicode (ctxt, n, ts) = ppContextNoLocs ctxt unicode <+> ppAppNameTypes n ts unicode - - -lookupAnySubdoc :: (Eq name1) => - name1 -> [(name1, DocForDecl name2)] -> DocForDecl name2 -lookupAnySubdoc n subdocs = case lookup n subdocs of - Nothing -> noDocForDecl - Just docs -> docs - - - --- ----------------------------------------------------------------------------- --- Data & newtype declarations - - --- TODO: print contexts -ppShortDataDecl :: Bool -> LinksInfo -> SrcSpan -> TyClDecl DocName -> Bool -> Html -ppShortDataDecl summary links loc dataDecl unicode - - | [lcon] <- cons, ResTyH98 <- resTy = - ppDataHeader summary dataDecl unicode - <+> equals <+> ppShortConstr summary (unLoc lcon) unicode - - | [] <- cons = ppDataHeader summary dataDecl unicode - - | otherwise = vanillaTable << ( - case resTy of - ResTyH98 -> dataHeader - tda [theclass "body"] << vanillaTable << ( - aboves (zipWith doConstr ('=':repeat '|') cons) - ) - ResTyGADT _ -> dataHeader - tda [theclass "body"] << vanillaTable << ( - aboves (map doGADTConstr cons) - ) - ) - - where - dataHeader = - (if summary then declBox else topDeclBox links loc docname) - ((ppDataHeader summary dataDecl unicode) <+> - case resTy of ResTyGADT _ -> keyword "where"; _ -> empty) - - doConstr c con = declBox (toHtml [c] <+> ppShortConstr summary (unLoc con) unicode) - doGADTConstr con = declBox (ppShortConstr summary (unLoc con) unicode) - - docname = unLoc . tcdLName $ dataDecl - cons = tcdCons dataDecl - resTy = (con_res . unLoc . head) cons - -ppDataDecl :: Bool -> LinksInfo -> [DocInstance DocName] -> - [(DocName, DocForDecl DocName)] -> - SrcSpan -> Maybe (Doc DocName) -> TyClDecl DocName -> Bool -> HtmlTable -ppDataDecl summary links instances subdocs loc mbDoc dataDecl unicode - - | summary = declWithDoc summary links loc docname mbDoc - (ppShortDataDecl summary links loc dataDecl unicode) - - | otherwise - = (if validTable then () else const) header_ $ - tda [theclass "body"] << vanillaTable << ( - datadoc - constrBit - instancesBit - ) - - - where - docname = unLoc . tcdLName $ dataDecl - cons = tcdCons dataDecl - resTy = (con_res . unLoc . head) cons - - header_ = topDeclBox links loc docname (ppDataHeader summary dataDecl unicode - <+> whereBit) - - whereBit - | null cons = empty - | otherwise = case resTy of - ResTyGADT _ -> keyword "where" - _ -> empty - - constrTable - | any isRecCon cons = spacedTable5 - | otherwise = spacedTable1 - - datadoc = case mbDoc of - Just doc -> ndocBox (docToHtml doc) - Nothing -> Html.emptyTable - - constrBit - | null cons = Html.emptyTable - | otherwise = constrHdr ( - tda [theclass "body"] << constrTable << - aboves (map (ppSideBySideConstr subdocs unicode) cons) - ) - - instId = collapseId (getName docname) - - instancesBit - | null instances = Html.emptyTable - | otherwise - = instHdr instId - tda [theclass "body"] << - collapsed thediv instId ( - spacedTable1 << aboves (map (ppDocInstance unicode) instances - ) - ) - - validTable = isJust mbDoc || not (null cons) || not (null instances) - - -isRecCon :: Located (ConDecl a) -> Bool -isRecCon lcon = case con_details (unLoc lcon) of - RecCon _ -> True - _ -> False - - -ppShortConstr :: Bool -> ConDecl DocName -> Bool -> Html -ppShortConstr summary con unicode = case con_res con of - ResTyH98 -> case con_details con of - PrefixCon args -> header_ unicode +++ hsep (ppBinder summary occ : map (ppLParendType unicode) args) - RecCon fields -> header_ unicode +++ ppBinder summary occ <+> - doRecordFields fields - InfixCon arg1 arg2 -> header_ unicode +++ - hsep [ppLParendType unicode arg1, ppBinder summary occ, ppLParendType unicode arg2] - - ResTyGADT resTy -> case con_details con of - -- prefix & infix could use hsConDeclArgTys if it seemed to - -- simplify the code. - PrefixCon args -> doGADTCon args resTy - -- display GADT records with the new syntax, - -- Constr :: (Context) => { field :: a, field2 :: b } -> Ty (a, b) - -- (except each field gets its own line in docs, to match - -- non-GADT records) - RecCon fields -> ppBinder summary occ <+> dcolon unicode <+> hsep [ - ppForAll forall ltvs lcontext unicode, - doRecordFields fields, - arrow unicode <+> ppLType unicode resTy ] - InfixCon arg1 arg2 -> doGADTCon [arg1, arg2] resTy - - where - doRecordFields fields = braces (vanillaTable << - aboves (map (ppShortField summary unicode) fields)) - doGADTCon args resTy = ppBinder summary occ <+> dcolon unicode <+> hsep [ - ppForAll forall ltvs lcontext unicode, - ppLType unicode (foldr mkFunTy resTy args) ] - - header_ = ppConstrHdr forall tyVars context - occ = docNameOcc . unLoc . con_name $ con - ltvs = con_qvars con - tyVars = tyvarNames ltvs - lcontext = con_cxt con - context = unLoc (con_cxt con) - forall = con_explicit con - mkFunTy a b = noLoc (HsFunTy a b) - --- ppConstrHdr is for (non-GADT) existentials constructors' syntax -#if __GLASGOW_HASKELL__ == 612 -ppConstrHdr :: HsExplicitForAll -> [Name] -> HsContext DocName -> Bool -> Html -#else -ppConstrHdr :: HsExplicitFlag -> [Name] -> HsContext DocName -> Bool -> Html -#endif -ppConstrHdr forall tvs ctxt unicode - = (if null tvs then noHtml else ppForall) - +++ - (if null ctxt then noHtml else ppContextNoArrow ctxt unicode <+> darrow unicode +++ toHtml " ") - where - ppForall = case forall of - Explicit -> forallSymbol unicode <+> hsep (map ppName tvs) <+> toHtml ". " - Implicit -> empty - -ppSideBySideConstr :: [(DocName, DocForDecl DocName)] -> Bool -> LConDecl DocName -> HtmlTable -ppSideBySideConstr subdocs unicode (L _ con) = case con_res con of - - ResTyH98 -> case con_details con of - - PrefixCon args -> - argBox (hsep ((header_ unicode +++ ppBinder False occ) : map (ppLParendType unicode) args)) - <-> maybeRDocBox mbDoc - - RecCon fields -> - argBox (header_ unicode +++ ppBinder False occ) <-> - maybeRDocBox mbDoc - - doRecordFields fields - - InfixCon arg1 arg2 -> - argBox (hsep [header_ unicode+++ppLParendType unicode arg1, ppBinder False occ, ppLParendType unicode arg2]) - <-> maybeRDocBox mbDoc - - ResTyGADT resTy -> case con_details con of - -- prefix & infix could also use hsConDeclArgTys if it seemed to - -- simplify the code. - PrefixCon args -> doGADTCon args resTy - cd@(RecCon fields) -> doGADTCon (hsConDeclArgTys cd) resTy - doRecordFields fields - InfixCon arg1 arg2 -> doGADTCon [arg1, arg2] resTy - - where - doRecordFields fields = - (tda [theclass "body"] << spacedTable1 << - aboves (map (ppSideBySideField subdocs unicode) fields)) - doGADTCon args resTy = argBox (ppBinder False occ <+> dcolon unicode <+> hsep [ - ppForAll forall ltvs (con_cxt con) unicode, - ppLType unicode (foldr mkFunTy resTy args) ] - ) <-> maybeRDocBox mbDoc - - - header_ = ppConstrHdr forall tyVars context - occ = docNameOcc . unLoc . con_name $ con - ltvs = con_qvars con - tyVars = tyvarNames (con_qvars con) - context = unLoc (con_cxt con) - forall = con_explicit con - -- don't use "con_doc con", in case it's reconstructed from a .hi file, - -- or also because we want Haddock to do the doc-parsing, not GHC. - -- 'join' is in Maybe. - mbDoc = join $ fmap fst $ lookup (unLoc $ con_name con) subdocs - mkFunTy a b = noLoc (HsFunTy a b) - -ppSideBySideField :: [(DocName, DocForDecl DocName)] -> Bool -> ConDeclField DocName -> HtmlTable -ppSideBySideField subdocs unicode (ConDeclField (L _ name) ltype _) = - argBox (ppBinder False (docNameOcc name) - <+> dcolon unicode <+> ppLType unicode ltype) <-> maybeRDocBox mbDoc - where - -- don't use cd_fld_doc for same reason we don't use con_doc above - mbDoc = join $ fmap fst $ lookup name subdocs - -{- -ppHsFullConstr :: HsConDecl -> Html -ppHsFullConstr (HsConDecl _ nm tvs ctxt typeList doc) = - declWithDoc False doc ( - hsep ((ppHsConstrHdr tvs ctxt +++ - ppHsBinder False nm) : map ppHsBangType typeList) - ) -ppHsFullConstr (HsRecDecl _ nm tvs ctxt fields doc) = - td << vanillaTable << ( - case doc of - Nothing -> aboves [hdr, fields_html] - Just _ -> aboves [hdr, constr_doc, fields_html] - ) - - where hdr = declBox (ppHsConstrHdr tvs ctxt +++ ppHsBinder False nm) - - constr_doc - | isJust doc = docBox (docToHtml (fromJust doc)) - | otherwise = Html.emptyTable - - fields_html = - td << - table ! [width "100%", cellpadding 0, cellspacing 8] << ( - aboves (map ppFullField (concat (map expandField fields))) - ) --} - -ppShortField :: Bool -> Bool -> ConDeclField DocName -> HtmlTable -ppShortField summary unicode (ConDeclField (L _ name) ltype _) - = tda [theclass "recfield"] << ( - ppBinder summary (docNameOcc name) - <+> dcolon unicode <+> ppLType unicode ltype - ) - -{- -ppFullField :: HsFieldDecl -> Html -ppFullField (HsFieldDecl [n] ty doc) - = declWithDoc False doc ( - ppHsBinder False n <+> dcolon <+> ppHsBangType ty - ) -ppFullField _ = error "ppFullField" - -expandField :: HsFieldDecl -> [HsFieldDecl] -expandField (HsFieldDecl ns ty doc) = [ HsFieldDecl [n] ty doc | n <- ns ] --} - --- | Print the LHS of a data\/newtype declaration. --- Currently doesn't handle 'data instance' decls or kind signatures -ppDataHeader :: Bool -> TyClDecl DocName -> Bool -> Html -ppDataHeader summary decl unicode - | not (isDataDecl decl) = error "ppDataHeader: illegal argument" - | otherwise = - -- newtype or data - (if tcdND decl == NewType then keyword "newtype" else keyword "data") <+> - -- context - ppLContext (tcdCtxt decl) unicode <+> - -- T a b c ..., or a :+: b - ppTyClBinderWithVars summary decl - - --- ---------------------------------------------------------------------------- --- Types and contexts - - -ppKind :: Outputable a => a -> Html -ppKind k = toHtml $ showSDoc (ppr k) - - -{- -ppForAll Implicit _ lctxt = ppCtxtPart lctxt -ppForAll Explicit ltvs lctxt = - hsep (keyword "forall" : ppTyVars ltvs ++ [dot]) <+> ppCtxtPart lctxt --} - - -ppBang :: HsBang -> Html -ppBang HsNoBang = empty -ppBang _ = toHtml "!" -- Unpacked args is an implementation detail, - -tupleParens :: Boxity -> [Html] -> Html -tupleParens Boxed = parenList -tupleParens Unboxed = ubxParenList -{- -ppType :: HsType DocName -> Html -ppType t = case t of - t@(HsForAllTy expl ltvs lcontext ltype) -> ppForAllTy t <+> ppLType ltype - HsTyVar n -> ppDocName n - HsBangTy HsStrict lt -> toHtml "!" <+> ppLType lt - HsBangTy HsUnbox lt -> toHtml "!!" <+> ppLType lt - HsAppTy a b -> ppLType a <+> ppLType b - HsFunTy a b -> hsep [ppLType a, toHtml "->", ppLType b] - HsListTy t -> brackets $ ppLType t - HsPArrTy t -> toHtml "[:" +++ ppLType t +++ toHtml ":]" - HsTupleTy Boxed ts -> parenList $ map ppLType ts - HsTupleTy Unboxed ts -> ubxParenList $ map ppLType ts - HsOpTy a n b -> ppLType a <+> ppLDocName n <+> ppLType b - HsParTy t -> parens $ ppLType t - HsNumTy n -> toHtml (show n) - HsPredTy p -> ppPred p - HsKindSig t k -> hsep [ppLType t, dcolon, ppKind k] - HsSpliceTy _ -> error "ppType" - HsDocTy t _ -> ppLType t --} - - --------------------------------------------------------------------------------- --- Rendering of HsType --------------------------------------------------------------------------------- - - -pREC_TOP, pREC_FUN, pREC_OP, pREC_CON :: Int - -pREC_TOP = (0 :: Int) -- type in ParseIface.y in GHC -pREC_FUN = (1 :: Int) -- btype in ParseIface.y in GHC - -- Used for LH arg of (->) -pREC_OP = (2 :: Int) -- Used for arg of any infix operator - -- (we don't keep their fixities around) -pREC_CON = (3 :: Int) -- Used for arg of type applicn: - -- always parenthesise unless atomic - -maybeParen :: Int -- Precedence of context - -> Int -- Precedence of top-level operator - -> Html -> Html -- Wrap in parens if (ctxt >= op) -maybeParen ctxt_prec op_prec p | ctxt_prec >= op_prec = parens p - | otherwise = p - - -ppLType, ppLParendType, ppLFunLhType :: Bool -> Located (HsType DocName) -> Html -ppLType unicode y = ppType unicode (unLoc y) -ppLParendType unicode y = ppParendType unicode (unLoc y) -ppLFunLhType unicode y = ppFunLhType unicode (unLoc y) - - -ppType, ppParendType, ppFunLhType :: Bool -> HsType DocName -> Html -ppType unicode ty = ppr_mono_ty pREC_TOP ty unicode -ppParendType unicode ty = ppr_mono_ty pREC_CON ty unicode -ppFunLhType unicode ty = ppr_mono_ty pREC_FUN ty unicode - - --- Drop top-level for-all type variables in user style --- since they are implicit in Haskell - -#if __GLASGOW_HASKELL__ == 612 -ppForAll :: HsExplicitForAll -> [Located (HsTyVarBndr DocName)] -#else -ppForAll :: HsExplicitFlag -> [Located (HsTyVarBndr DocName)] -#endif - -> Located (HsContext DocName) -> Bool -> Html -ppForAll expl tvs cxt unicode - | show_forall = forall_part <+> ppLContext cxt unicode - | otherwise = ppLContext cxt unicode - where - show_forall = not (null tvs) && is_explicit - is_explicit = case expl of {Explicit -> True; Implicit -> False} - forall_part = hsep (forallSymbol unicode : ppTyVars tvs) +++ dot - - -ppr_mono_lty :: Int -> LHsType DocName -> Bool -> Html -ppr_mono_lty ctxt_prec ty unicode = ppr_mono_ty ctxt_prec (unLoc ty) unicode - - -ppr_mono_ty :: Int -> HsType DocName -> Bool -> Html -ppr_mono_ty ctxt_prec (HsForAllTy expl tvs ctxt ty) unicode - = maybeParen ctxt_prec pREC_FUN $ - hsep [ppForAll expl tvs ctxt unicode, ppr_mono_lty pREC_TOP ty unicode] - -ppr_mono_ty _ (HsBangTy b ty) u = ppBang b +++ ppLParendType u ty -ppr_mono_ty _ (HsTyVar name) _ = ppDocName name -ppr_mono_ty ctxt_prec (HsFunTy ty1 ty2) u = ppr_fun_ty ctxt_prec ty1 ty2 u -ppr_mono_ty _ (HsTupleTy con tys) u = tupleParens con (map (ppLType u) tys) -ppr_mono_ty _ (HsKindSig ty kind) u = parens (ppr_mono_lty pREC_TOP ty u <+> dcolon u <+> ppKind kind) -ppr_mono_ty _ (HsListTy ty) u = brackets (ppr_mono_lty pREC_TOP ty u) -ppr_mono_ty _ (HsPArrTy ty) u = pabrackets (ppr_mono_lty pREC_TOP ty u) -ppr_mono_ty _ (HsPredTy p) u = parens (ppPred u p) -ppr_mono_ty _ (HsNumTy n) _ = toHtml (show n) -- generics only -ppr_mono_ty _ (HsSpliceTy {}) _ = error "ppr_mono_ty HsSpliceTy" -#if __GLASGOW_HASKELL__ == 612 -ppr_mono_ty _ (HsSpliceTyOut {}) _ = error "ppr_mono_ty HsQuasiQuoteTy" -#else -ppr_mono_ty _ (HsQuasiQuoteTy {}) _ = error "ppr_mono_ty HsQuasiQuoteTy" -#endif -ppr_mono_ty _ (HsRecTy {}) _ = error "ppr_mono_ty HsRecTy" - -ppr_mono_ty ctxt_prec (HsAppTy fun_ty arg_ty) unicode - = maybeParen ctxt_prec pREC_CON $ - hsep [ppr_mono_lty pREC_FUN fun_ty unicode, ppr_mono_lty pREC_CON arg_ty unicode] - -ppr_mono_ty ctxt_prec (HsOpTy ty1 op ty2) unicode - = maybeParen ctxt_prec pREC_FUN $ - ppr_mono_lty pREC_OP ty1 unicode <+> ppr_op <+> ppr_mono_lty pREC_OP ty2 unicode - where - ppr_op = if not (isSymOcc occName) then quote (ppLDocName op) else ppLDocName op - occName = docNameOcc . unLoc $ op - -ppr_mono_ty ctxt_prec (HsParTy ty) unicode --- = parens (ppr_mono_lty pREC_TOP ty) - = ppr_mono_lty ctxt_prec ty unicode - -ppr_mono_ty ctxt_prec (HsDocTy ty _) unicode - = ppr_mono_lty ctxt_prec ty unicode - - -ppr_fun_ty :: Int -> LHsType DocName -> LHsType DocName -> Bool -> Html -ppr_fun_ty ctxt_prec ty1 ty2 unicode - = let p1 = ppr_mono_lty pREC_FUN ty1 unicode - p2 = ppr_mono_lty pREC_TOP ty2 unicode - in - maybeParen ctxt_prec pREC_FUN $ - hsep [p1, arrow unicode <+> p2] - - --- ---------------------------------------------------------------------------- --- Names - -ppOccName :: OccName -> Html -ppOccName = toHtml . occNameString - -ppRdrName :: RdrName -> Html -ppRdrName = ppOccName . rdrNameOcc - -ppLDocName :: Located DocName -> Html -ppLDocName (L _ d) = ppDocName d - -ppDocName :: DocName -> Html -ppDocName (Documented name mdl) = - linkIdOcc mdl (Just occName) << ppOccName occName - where occName = nameOccName name -ppDocName (Undocumented name) = toHtml (getOccString name) - -linkTarget :: OccName -> Html -linkTarget n = namedAnchor (nameAnchorId n) << toHtml "" - -ppName :: Name -> Html -ppName name = toHtml (getOccString name) - - -ppBinder :: Bool -> OccName -> Html --- The Bool indicates whether we are generating the summary, in which case --- the binder will be a link to the full definition. -ppBinder True n = linkedAnchor (nameAnchorId n) << ppBinder' n -ppBinder False n = linkTarget n +++ bold << ppBinder' n - - -ppBinder' :: OccName -> Html -ppBinder' n - | isVarSym n = parens $ ppOccName n - | otherwise = ppOccName n - - -linkId :: Module -> Maybe Name -> Html -> Html -linkId mdl mbName = linkIdOcc mdl (fmap nameOccName mbName) - - -linkIdOcc :: Module -> Maybe OccName -> Html -> Html -linkIdOcc mdl mbName = anchor ! [href uri] - where - uri = case mbName of - Nothing -> moduleUrl mdl - Just name -> moduleNameUrl mdl name - -ppModule :: Module -> String -> Html -ppModule mdl ref = anchor ! [href ((moduleHtmlFile mdl) ++ ref)] - << toHtml (moduleString mdl) - --- ----------------------------------------------------------------------------- --- * Doc Markup - -parHtmlMarkup :: (a -> Html) -> (a -> Bool) -> DocMarkup a Html -parHtmlMarkup ppId isTyCon = Markup { - markupParagraph = paragraph, - markupEmpty = toHtml "", - markupString = toHtml, - markupAppend = (+++), - markupIdentifier = tt . ppId . choose, - markupModule = \m -> let (mdl,ref) = break (=='#') m in ppModule (mkModuleNoPackage mdl) ref, - markupEmphasis = emphasize . toHtml, - markupMonospaced = tt . toHtml, - markupUnorderedList = ulist . concatHtml . map (li <<), - markupPic = \path -> image ! [src path], - markupOrderedList = olist . concatHtml . map (li <<), - markupDefList = dlist . concatHtml . map markupDef, - markupCodeBlock = pre, - markupURL = \url -> anchor ! [href url] << toHtml url, - markupAName = \aname -> namedAnchor aname << toHtml "", - markupExample = examplesToHtml - } - where - -- If an id can refer to multiple things, we give precedence to type - -- constructors. This should ideally be done during renaming from RdrName - -- to Name, but since we will move this process from GHC into Haddock in - -- the future, we fix it here in the meantime. - -- TODO: mention this rule in the documentation. - choose [] = error "empty identifier list in HsDoc" - choose [x] = x - choose (x:y:_) - | isTyCon x = x - | otherwise = y - - examplesToHtml l = (pre $ concatHtml $ map exampleToHtml l) ! [theclass "screen"] - - exampleToHtml (Example expression result) = htmlExample - where - htmlExample = htmlPrompt +++ htmlExpression +++ (toHtml $ unlines result) - htmlPrompt = (thecode . toHtml $ "ghci> ") ! [theclass "prompt"] - htmlExpression = (strong . thecode . toHtml $ expression ++ "\n") ! [theclass "userinput"] - - -markupDef :: (HTML a, HTML b) => (a, b) -> Html -markupDef (a,b) = dterm << a +++ ddef << b - - -htmlMarkup :: DocMarkup DocName Html -htmlMarkup = parHtmlMarkup ppDocName (isTyConName . getName) - -htmlOrigMarkup :: DocMarkup Name Html -htmlOrigMarkup = parHtmlMarkup ppName isTyConName - -htmlRdrMarkup :: DocMarkup RdrName Html -htmlRdrMarkup = parHtmlMarkup ppRdrName isRdrTc - --- If the doc is a single paragraph, don't surround it with

(this causes --- ugly extra whitespace with some browsers). -docToHtml :: Doc DocName -> Html -docToHtml doc = markup htmlMarkup (unParagraph (markup htmlCleanup doc)) - -origDocToHtml :: Doc Name -> Html -origDocToHtml doc = markup htmlOrigMarkup (unParagraph (markup htmlCleanup doc)) - -rdrDocToHtml :: Doc RdrName -> Html -rdrDocToHtml doc = markup htmlRdrMarkup (unParagraph (markup htmlCleanup doc)) - --- If there is a single paragraph, then surrounding it with

..

--- can add too much whitespace in some browsers (eg. IE). However if --- we have multiple paragraphs, then we want the extra whitespace to --- separate them. So we catch the single paragraph case and transform it --- here. -unParagraph :: Doc a -> Doc a -unParagraph (DocParagraph d) = d ---NO: This eliminates line breaks in the code block: (SDM, 6/5/2003) ---unParagraph (DocCodeBlock d) = (DocMonospaced d) -unParagraph doc = doc - -htmlCleanup :: DocMarkup a (Doc a) -htmlCleanup = idMarkup { - markupUnorderedList = DocUnorderedList . map unParagraph, - markupOrderedList = DocOrderedList . map unParagraph - } - --- ----------------------------------------------------------------------------- --- * Misc - - -hsep :: [Html] -> Html -hsep [] = noHtml -hsep htmls = foldr1 (\a b -> a+++" "+++b) htmls - -infixr 8 <+>, <++> -(<+>) :: Html -> Html -> Html -a <+> b = Html (getHtmlElements (toHtml a) ++ HtmlString " ": getHtmlElements (toHtml b)) - -(<++>) :: Html -> Html -> Html -a <++> b = a +++ spaceHtml +++ b - -keyword :: String -> Html -keyword s = thespan ! [theclass "keyword"] << toHtml s - -equals, comma :: Html -equals = char '=' -comma = char ',' - -char :: Char -> Html -char c = toHtml [c] - -empty :: Html -empty = noHtml - - -quote :: Html -> Html -quote h = char '`' +++ h +++ '`' - - -parens, brackets, pabrackets, braces :: Html -> Html -parens h = char '(' +++ h +++ char ')' -brackets h = char '[' +++ h +++ char ']' -pabrackets h = toHtml "[:" +++ h +++ toHtml ":]" -braces h = char '{' +++ h +++ char '}' - -punctuate :: Html -> [Html] -> [Html] -punctuate _ [] = [] -punctuate h (d0:ds) = go d0 ds - where - go d [] = [d] - go d (e:es) = (d +++ h) : go e es - -abovesSep :: HtmlTable -> [HtmlTable] -> HtmlTable -abovesSep _ [] = Html.emptyTable -abovesSep h (d0:ds) = go d0 ds - where - go d [] = d - go d (e:es) = d h go e es - -parenList :: [Html] -> Html -parenList = parens . hsep . punctuate comma - -ubxParenList :: [Html] -> Html -ubxParenList = ubxparens . hsep . punctuate comma - -ubxparens :: Html -> Html -ubxparens h = toHtml "(#" +++ h +++ toHtml "#)" - -{- -text :: Html -text = strAttr "TEXT" --} - --- a box for displaying code -declBox :: Html -> HtmlTable -declBox html = tda [theclass "decl"] << html - --- a box for top level documented names --- it adds a source and wiki link at the right hand side of the box -topDeclBox :: LinksInfo -> SrcSpan -> DocName -> Html -> HtmlTable -topDeclBox ((_,_,Nothing), (_,_,Nothing)) _ _ html = declBox html -topDeclBox ((_,_,maybe_source_url), (_,_,maybe_wiki_url)) - loc name html = - tda [theclass "topdecl"] << - ( table ! [theclass "declbar"] << - ((tda [theclass "declname"] << html) - <-> srcLink - <-> wikiLink) - ) - where srcLink = - case maybe_source_url of - Nothing -> Html.emptyTable - Just url -> tda [theclass "declbut"] << - let url' = spliceURL (Just fname) (Just origMod) - (Just n) (Just loc) url - in anchor ! [href url'] << toHtml "Source" - - wikiLink = - case maybe_wiki_url of - Nothing -> Html.emptyTable - Just url -> tda [theclass "declbut"] << - let url' = spliceURL (Just fname) (Just mdl) - (Just n) (Just loc) url - in anchor ! [href url'] << toHtml "Comments" - - -- For source links, we want to point to the original module, - -- because only that will have the source. - -- TODO: do something about type instances. They will point to - -- the module defining the type family, which is wrong. - origMod = nameModule n - - -- Name must be documented, otherwise we wouldn't get here - Documented n mdl = name - - fname = unpackFS (srcSpanFile loc) - - --- a box for displaying an 'argument' (some code which has text to the --- right of it). Wrapping is not allowed in these boxes, whereas it is --- in a declBox. -argBox :: Html -> HtmlTable -argBox html = tda [theclass "arg"] << html - --- a box for displaying documentation, --- indented and with a little padding at the top -docBox :: Html -> HtmlTable -docBox html = tda [theclass "doc"] << html - --- a box for displaying documentation, not indented. -ndocBox :: Html -> HtmlTable -ndocBox html = tda [theclass "ndoc"] << html - --- a box for displaying documentation, padded on the left a little -rdocBox :: Html -> HtmlTable -rdocBox html = tda [theclass "rdoc"] << html - -maybeRDocBox :: Maybe (Doc DocName) -> HtmlTable -maybeRDocBox Nothing = rdocBox (noHtml) -maybeRDocBox (Just doc) = rdocBox (docToHtml doc) - --- a box for the buttons at the top of the page -topButBox :: Html -> HtmlTable -topButBox html = tda [theclass "topbut"] << html - -bodyBox :: Html -> HtmlTable -bodyBox html = tda [theclass "body"] << vanillaTable << html - --- a vanilla table has width 100%, no border, no padding, no spacing --- a narrow table is the same but without width 100%. -vanillaTable, vanillaTable2, narrowTable :: Html -> Html -vanillaTable = table ! [theclass "vanilla", cellspacing 0, cellpadding 0] -vanillaTable2 = table ! [theclass "vanilla2", cellspacing 0, cellpadding 0] -narrowTable = table ! [theclass "narrow", cellspacing 0, cellpadding 0] - -spacedTable1, spacedTable5 :: Html -> Html -spacedTable1 = table ! [theclass "vanilla", cellspacing 1, cellpadding 0] -spacedTable5 = table ! [theclass "vanilla", cellspacing 5, cellpadding 0] - -constrHdr, methHdr, atHdr :: HtmlTable -constrHdr = tda [ theclass "section4" ] << toHtml "Constructors" -methHdr = tda [ theclass "section4" ] << toHtml "Methods" -atHdr = tda [ theclass "section4" ] << toHtml "Associated Types" - -instHdr :: String -> HtmlTable -instHdr id_ = - tda [ theclass "section4" ] << (collapsebutton id_ +++ toHtml " Instances") - -dcolon, arrow, darrow, forallSymbol :: Bool -> Html -dcolon unicode = toHtml (if unicode then "∷" else "::") -arrow unicode = toHtml (if unicode then "→" else "->") -darrow unicode = toHtml (if unicode then "⇒" else "=>") -forallSymbol unicode = if unicode then toHtml "∀" else keyword "forall" - - -dot :: Html -dot = toHtml "." - - -s8, s15 :: HtmlTable -s8 = tda [ theclass "s8" ] << noHtml -s15 = tda [ theclass "s15" ] << noHtml - - --- | Generate a named anchor --- --- This actually generates two anchor tags, one with the name unescaped, and one --- with the name URI-escaped. This is needed because Opera 9.52 (and later --- versions) needs the name to be unescaped, while IE 7 needs it to be escaped. --- -namedAnchor :: String -> Html -> Html -namedAnchor n = (anchor ! [Html.name n]) . (anchor ! [Html.name (escapeStr n)]) - - --- --- A section of HTML which is collapsible via a +/- button. --- - --- TODO: Currently the initial state is non-collapsed. Change the 'minusFile' --- below to a 'plusFile' and the 'display:block;' to a 'display:none;' when we --- use cookies from JavaScript to have a more persistent state. - -collapsebutton :: String -> Html -collapsebutton id_ = - image ! [ src minusFile, theclass "coll", onclick ("toggle(this,'" ++ id_ ++ "')"), alt "show/hide" ] - -collapsed :: (HTML a) => (Html -> Html) -> String -> a -> Html -collapsed fn id_ html = - fn ! [identifier id_, thestyle "display:block;"] << html - --- A quote is a valid part of a Haskell identifier, but it would interfere with --- the ECMA script string delimiter used in collapsebutton above. -collapseId :: Name -> String -collapseId nm = "i:" ++ escapeStr (getOccString nm) - -linkedAnchor :: String -> Html -> Html -linkedAnchor frag = anchor ! [href hr_] - where hr_ | null frag = "" - | otherwise = '#': escapeStr frag - -documentCharacterEncoding :: Html -documentCharacterEncoding = - meta ! [httpequiv "Content-Type", content "text/html; charset=UTF-8"] - -styleSheet :: Html -styleSheet = - thelink ! [href cssFile, rel "stylesheet", thetype "text/css"] rmfile ./src/Haddock/Backends/Html.hs hunk ./src/Haddock/Options.hs 60 - | Flag_Xhtml hunk ./src/Haddock/Options.hs 96 - Option ['h'] ["html"] (NoArg Flag_Html) - "output in HTML", - Option [] ["xhtml"] (NoArg Flag_Xhtml) "use experimental XHTML rendering", + Option ['h'] ["html", "xhtml"] (NoArg Flag_Html) + "output in HTML (XHTML 1.0)", hunk ./src/Haddock/Utils/BlockTable.hs 1 -{- | - - Module : Text.Html.BlockTable - Copyright : (c) Andy Gill, and the Oregon Graduate Institute of - Science and Technology, 1999-2001 - License : BSD-style (see the file libraries/core/LICENSE) - - Maintainer : Andy Gill - Stability : experimental - Portability : portable - - $Id: BlockTable.hs,v 1.2 2002/07/24 09:42:18 simonmar Exp $ - - An Html combinator library - --} - -module Haddock.Utils.BlockTable ( - --- Datatypes: - - BlockTable, -- abstract - --- Contruction Functions: - - single, - empty, - above, - beside, - --- Investigation Functions: - - getMatrix, - showsTable, - showTable, - - ) where - -import Prelude - -infixr 4 `beside` -infixr 3 `above` - --- These combinators can be used to build formated 2D tables. --- The specific target useage is for HTML table generation. - -{- - Examples of use: - - > table1 :: BlockTable String - > table1 = single "Hello" +-----+ - |Hello| - This is a 1x1 cell +-----+ - Note: single has type - - single :: a -> BlockTable a - - So the cells can contain anything. - - > table2 :: BlockTable String - > table2 = single "World" +-----+ - |World| - +-----+ - - - > table3 :: BlockTable String - > table3 = table1 %-% table2 +-----%-----+ - |Hello%World| - % is used to indicate +-----%-----+ - the join edge between - the two Tables. - - > table4 :: BlockTable String - > table4 = table3 %/% table2 +-----+-----+ - |Hello|World| - Notice the padding on the %%%%%%%%%%%%% - smaller (bottom) cell to |World | - force the table to be a +-----------+ - rectangle. - - > table5 :: BlockTable String - > table5 = table1 %-% table4 +-----%-----+-----+ - |Hello%Hello|World| - Notice the padding on the | %-----+-----+ - leftmost cell, again to | %World | - force the table to be a +-----%-----------+ - rectangle. - - Now the table can be rendered with processTable, for example: - Main> processTable table5 - [[("Hello",(1,2)), - ("Hello",(1,1)), - ("World",(1,1))], - [("World",(2,1))]] :: [[([Char],(Int,Int))]] - Main> --} - --- --------------------------------------------------------------------------- --- Contruction Functions - --- Perhaps one day I'll write the Show instance --- to show boxes aka the above ascii renditions. - -instance (Show a) => Show (BlockTable a) where - showsPrec _ = showsTable - -type TableI a = [[(a,(Int,Int))]] -> [[(a,(Int,Int))]] - -data BlockTable a = Table (Int -> Int -> TableI a) Int Int - - --- You can create a (1x1) table entry - -single :: a -> BlockTable a -single a = Table (\ x y r -> [(a,(x+1,y+1))] : r) 1 1 - -empty :: BlockTable a -empty = Table (\ _ _ r -> r) 0 0 - - --- You can compose tables, horizonally and vertically - -above :: BlockTable a -> BlockTable a -> BlockTable a -beside :: BlockTable a -> BlockTable a -> BlockTable a - -t1 `above` t2 = trans (combine (trans t1) (trans t2) (.)) - -t1 `beside` t2 = combine t1 t2 (\ lst1 lst2 r -> - let - -- Note this depends on the fact that - -- that the result has the same number - -- of lines as the y dimention; one list - -- per line. This is not true in general - -- but is always true for these combinators. - -- I should assert this! - -- I should even prove this. - beside' (x:xs) (y:ys) = (x ++ y) : beside' xs ys - beside' (x:xs) [] = x : xs ++ r - beside' [] (y:ys) = y : ys ++ r - beside' [] [] = r - in - beside' (lst1 []) (lst2 [])) - --- trans flips (transposes) over the x and y axis of --- the table. It is only used internally, and typically --- in pairs, ie. (flip ... munge ... (un)flip). - -trans :: BlockTable a -> BlockTable a -trans (Table f1 x1 y1) = Table (flip f1) y1 x1 - -combine :: BlockTable a - -> BlockTable b - -> (TableI a -> TableI b -> TableI c) - -> BlockTable c -combine (Table f1 x1 y1) (Table f2 x2 y2) comb = Table new_fn (x1+x2) max_y - where - max_y = max y1 y2 - new_fn x y = - case compare y1 y2 of - EQ -> comb (f1 0 y) (f2 x y) - GT -> comb (f1 0 y) (f2 x (y + y1 - y2)) - LT -> comb (f1 0 (y + y2 - y1)) (f2 x y) - --- --------------------------------------------------------------------------- --- Investigation Functions - --- This is the other thing you can do with a Table; --- turn it into a 2D list, tagged with the (x,y) --- sizes of each cell in the table. - -getMatrix :: BlockTable a -> [[(a,(Int,Int))]] -getMatrix (Table r _ _) = r 0 0 [] - --- You can also look at a table - -showsTable :: (Show a) => BlockTable a -> ShowS -showsTable table = shows (getMatrix table) - -showTable :: (Show a) => BlockTable a -> String -showTable table = showsTable table "" rmfile ./src/Haddock/Utils/BlockTable.hs hunk ./src/Haddock/Utils/Html.hs 1 ------------------------------------------------------------------------------ --- --- Module : Text.Html --- Copyright : (c) Andy Gill, and the Oregon Graduate Institute of --- Science and Technology, 1999-2001 --- License : BSD-style (see the file libraries/core/LICENSE) --- --- Maintainer : Andy Gill --- Stability : experimental --- Portability : portable --- --- An Html combinator library --- ------------------------------------------------------------------------------ - -module Haddock.Utils.Html ( - module Haddock.Utils.Html, - ) where - -import qualified Haddock.Utils.BlockTable as BT - -import Data.Char (isAscii, ord) -import Numeric (showHex) - -infixr 2 +++ -- combining Html -infixr 7 << -- nesting Html -infixl 8 ! -- adding optional arguments - - --- A important property of Html is that all strings inside the --- structure are already in Html friendly format. --- For example, use of >,etc. - -data HtmlElement -{- - - ..just..plain..normal..text... but using © and &amb;, etc. - -} - = HtmlString String -{- - - ..content.. - -} - | HtmlTag { -- tag with internal markup - markupTag :: String, - markupAttrs :: [HtmlAttr], - markupContent :: Html - } - -{- These are the index-value pairs. - - The empty string is a synonym for tags with no arguments. - - (not strictly HTML, but anyway). - -} - - -data HtmlAttr = HtmlAttr String String - - -newtype Html = Html { getHtmlElements :: [HtmlElement] } - --- Read MARKUP as the class of things that can be validly rendered --- inside MARKUP tag brackets. So this can be one or more Html's, --- or a String, for example. - -class HTML a where - toHtml :: a -> Html - toHtmlFromList :: [a] -> Html - - toHtmlFromList xs = Html (concat [ x | (Html x) <- map toHtml xs]) - -instance HTML Html where - toHtml a = a - -instance HTML Char where - toHtml a = toHtml [a] - toHtmlFromList [] = Html [] - toHtmlFromList str = Html [HtmlString (stringToHtmlString str)] - -instance (HTML a) => HTML [a] where - toHtml xs = toHtmlFromList xs - -class ADDATTRS a where - (!) :: a -> [HtmlAttr] -> a - -instance (ADDATTRS b) => ADDATTRS (a -> b) where - (!) fn attr = \ arg -> fn arg ! attr - -instance ADDATTRS Html where - (!) (Html htmls) attr = Html (map addAttrs htmls) - where - addAttrs html = - case html of - HtmlTag { markupAttrs = markupAttrs0 - , markupTag = markupTag0 - , markupContent = markupContent0 } -> - HtmlTag { markupAttrs = markupAttrs0 ++ attr - , markupTag = markupTag0 - , markupContent = markupContent0 } - _ -> html - - -(<<) :: (HTML a) => (Html -> b) -> a -> b -fn << arg = fn (toHtml arg) - - -concatHtml :: (HTML a) => [a] -> Html -concatHtml as = Html (concat (map (getHtmlElements.toHtml) as)) - -(+++) :: (HTML a,HTML b) => a -> b -> Html -a +++ b = Html (getHtmlElements (toHtml a) ++ getHtmlElements (toHtml b)) - -noHtml :: Html -noHtml = Html [] - - -isNoHtml :: Html -> Bool -isNoHtml (Html xs) = null xs - - -tag :: String -> Html -> Html -tag str htmls = - Html [ HtmlTag { markupTag = str, - markupAttrs = [], - markupContent = htmls } - ] - -itag :: String -> Html -itag str = tag str noHtml - -emptyAttr :: String -> HtmlAttr -emptyAttr s = HtmlAttr s "" - -intAttr :: String -> Int -> HtmlAttr -intAttr s i = HtmlAttr s (show i) - -strAttr :: String -> String -> HtmlAttr -strAttr s t = HtmlAttr s t - - -{- -foldHtml :: (String -> [HtmlAttr] -> [a] -> a) - -> (String -> a) - -> Html - -> a -foldHtml f g (HtmlTag str attr fmls) - = f str attr (map (foldHtml f g) fmls) -foldHtml f g (HtmlString str) - = g str - --} --- Processing Strings into Html friendly things. --- This converts a String to a Html String. -stringToHtmlString :: String -> String -stringToHtmlString = concatMap fixChar - where - fixChar '<' = "<" - fixChar '>' = ">" - fixChar '&' = "&" - fixChar '"' = """ - fixChar c - | isAscii c = [c] - | otherwise = "&#x" ++ showHex (ord c) ";" - --- --------------------------------------------------------------------------- --- Classes - -instance Show Html where - showsPrec _ html = showString (prettyHtml html) - showList htmls = showString (concat (map show htmls)) - -instance Show HtmlAttr where - showsPrec _ (HtmlAttr str val) = - showString str . - showString "=" . - shows val - - --- --------------------------------------------------------------------------- --- Data types - -type URL = String - --- --------------------------------------------------------------------------- --- Basic primitives - --- This is not processed for special chars. --- use stringToHtml or lineToHtml instead, for user strings, --- because they understand special chars, like '<'. - -primHtml :: String -> Html -primHtml x = Html [HtmlString x] - --- --------------------------------------------------------------------------- --- Basic Combinators - -stringToHtml :: String -> Html -stringToHtml = primHtml . stringToHtmlString - --- This converts a string, but keeps spaces as non-line-breakable - -lineToHtml :: String -> Html -lineToHtml = primHtml . concatMap htmlizeChar2 . stringToHtmlString - where - htmlizeChar2 ' ' = " " - htmlizeChar2 c = [c] - --- --------------------------------------------------------------------------- --- Html Constructors - --- (automatically generated) - -address :: Html -> Html -anchor :: Html -> Html -applet :: Html -> Html -area :: Html -basefont :: Html -big :: Html -> Html -blockquote :: Html -> Html -body :: Html -> Html -bold :: Html -> Html -br :: Html -button :: Html -> Html -caption :: Html -> Html -center :: Html -> Html -cite :: Html -> Html -ddef :: Html -> Html -define :: Html -> Html -dlist :: Html -> Html -dterm :: Html -> Html -emphasize :: Html -> Html -fieldset :: Html -> Html -font :: Html -> Html -form :: Html -> Html -frame :: Html -> Html -frameset :: Html -> Html -h1 :: Html -> Html -h2 :: Html -> Html -h3 :: Html -> Html -h4 :: Html -> Html -h5 :: Html -> Html -h6 :: Html -> Html -header :: Html -> Html -hr :: Html -image :: Html -input :: Html -italics :: Html -> Html -keyboard :: Html -> Html -legend :: Html -> Html -li :: Html -> Html -meta :: Html -noframes :: Html -> Html -olist :: Html -> Html -option :: Html -> Html -paragraph :: Html -> Html -param :: Html -pre :: Html -> Html -sample :: Html -> Html -script :: Html -> Html -select :: Html -> Html -small :: Html -> Html -strong :: Html -> Html -style :: Html -> Html -sub :: Html -> Html -sup :: Html -> Html -table :: Html -> Html -thetd :: Html -> Html -textarea :: Html -> Html -th :: Html -> Html -thebase :: Html -thecode :: Html -> Html -thediv :: Html -> Html -thehtml :: Html -> Html -thelink :: Html -themap :: Html -> Html -thespan :: Html -> Html -thetitle :: Html -> Html -tr :: Html -> Html -tt :: Html -> Html -ulist :: Html -> Html -underline :: Html -> Html -variable :: Html -> Html - -address = tag "ADDRESS" -anchor = tag "A" -applet = tag "APPLET" -area = itag "AREA" -basefont = itag "BASEFONT" -big = tag "BIG" -blockquote = tag "BLOCKQUOTE" -body = tag "BODY" -bold = tag "B" -br = itag "BR" -button = tag "BUTTON" -caption = tag "CAPTION" -center = tag "CENTER" -cite = tag "CITE" -ddef = tag "DD" -define = tag "DFN" -dlist = tag "DL" -dterm = tag "DT" -emphasize = tag "EM" -fieldset = tag "FIELDSET" -font = tag "FONT" -form = tag "FORM" -frame = tag "FRAME" -frameset = tag "FRAMESET" -h1 = tag "H1" -h2 = tag "H2" -h3 = tag "H3" -h4 = tag "H4" -h5 = tag "H5" -h6 = tag "H6" -header = tag "HEAD" -hr = itag "HR" -image = itag "IMG" -input = itag "INPUT" -italics = tag "I" -keyboard = tag "KBD" -legend = tag "LEGEND" -li = tag "LI" -meta = itag "META" -noframes = tag "NOFRAMES" -olist = tag "OL" -option = tag "OPTION" -paragraph = tag "P" -param = itag "PARAM" -pre = tag "PRE" -sample = tag "SAMP" -script = tag "SCRIPT" -select = tag "SELECT" -small = tag "SMALL" -strong = tag "STRONG" -style = tag "STYLE" -sub = tag "SUB" -sup = tag "SUP" -table = tag "TABLE" -thetd = tag "TD" -textarea = tag "TEXTAREA" -th = tag "TH" -thebase = itag "BASE" -thecode = tag "CODE" -thediv = tag "DIV" -thehtml = tag "HTML" -thelink = itag "LINK" -themap = tag "MAP" -thespan = tag "SPAN" -thetitle = tag "TITLE" -tr = tag "TR" -tt = tag "TT" -ulist = tag "UL" -underline = tag "U" -variable = tag "VAR" - --- --------------------------------------------------------------------------- --- Html Attributes - --- (automatically generated) - -action :: String -> HtmlAttr -align :: String -> HtmlAttr -alink :: String -> HtmlAttr -alt :: String -> HtmlAttr -altcode :: String -> HtmlAttr -archive :: String -> HtmlAttr -background :: String -> HtmlAttr -base :: String -> HtmlAttr -bgcolor :: String -> HtmlAttr -border :: Int -> HtmlAttr -bordercolor :: String -> HtmlAttr -cellpadding :: Int -> HtmlAttr -cellspacing :: Int -> HtmlAttr -checked :: HtmlAttr -clear :: String -> HtmlAttr -code :: String -> HtmlAttr -codebase :: String -> HtmlAttr -color :: String -> HtmlAttr -cols :: String -> HtmlAttr -colspan :: Int -> HtmlAttr -compact :: HtmlAttr -content :: String -> HtmlAttr -coords :: String -> HtmlAttr -enctype :: String -> HtmlAttr -face :: String -> HtmlAttr -frameborder :: Int -> HtmlAttr -height :: Int -> HtmlAttr -href :: String -> HtmlAttr -hspace :: Int -> HtmlAttr -httpequiv :: String -> HtmlAttr -identifier :: String -> HtmlAttr -ismap :: HtmlAttr -lang :: String -> HtmlAttr -link :: String -> HtmlAttr -marginheight :: Int -> HtmlAttr -marginwidth :: Int -> HtmlAttr -maxlength :: Int -> HtmlAttr -method :: String -> HtmlAttr -multiple :: HtmlAttr -name :: String -> HtmlAttr -nohref :: HtmlAttr -noresize :: HtmlAttr -noshade :: HtmlAttr -nowrap :: HtmlAttr -onclick :: String -> HtmlAttr -rel :: String -> HtmlAttr -rev :: String -> HtmlAttr -rows :: String -> HtmlAttr -rowspan :: Int -> HtmlAttr -rules :: String -> HtmlAttr -scrolling :: String -> HtmlAttr -selected :: HtmlAttr -shape :: String -> HtmlAttr -size :: String -> HtmlAttr -src :: String -> HtmlAttr -start :: Int -> HtmlAttr -target :: String -> HtmlAttr -text :: String -> HtmlAttr -theclass :: String -> HtmlAttr -thestyle :: String -> HtmlAttr -thetype :: String -> HtmlAttr -title :: String -> HtmlAttr -usemap :: String -> HtmlAttr -valign :: String -> HtmlAttr -value :: String -> HtmlAttr -version :: String -> HtmlAttr -vlink :: String -> HtmlAttr -vspace :: Int -> HtmlAttr -width :: String -> HtmlAttr - -action = strAttr "ACTION" -align = strAttr "ALIGN" -alink = strAttr "ALINK" -alt = strAttr "ALT" -altcode = strAttr "ALTCODE" -archive = strAttr "ARCHIVE" -background = strAttr "BACKGROUND" -base = strAttr "BASE" -bgcolor = strAttr "BGCOLOR" -border = intAttr "BORDER" -bordercolor = strAttr "BORDERCOLOR" -cellpadding = intAttr "CELLPADDING" -cellspacing = intAttr "CELLSPACING" -checked = emptyAttr "CHECKED" -clear = strAttr "CLEAR" -code = strAttr "CODE" -codebase = strAttr "CODEBASE" -color = strAttr "COLOR" -cols = strAttr "COLS" -colspan = intAttr "COLSPAN" -compact = emptyAttr "COMPACT" -content = strAttr "CONTENT" -coords = strAttr "COORDS" -enctype = strAttr "ENCTYPE" -face = strAttr "FACE" -frameborder = intAttr "FRAMEBORDER" -height = intAttr "HEIGHT" -href = strAttr "HREF" -hspace = intAttr "HSPACE" -httpequiv = strAttr "HTTP-EQUIV" -identifier = strAttr "ID" -ismap = emptyAttr "ISMAP" -lang = strAttr "LANG" -link = strAttr "LINK" -marginheight = intAttr "MARGINHEIGHT" -marginwidth = intAttr "MARGINWIDTH" -maxlength = intAttr "MAXLENGTH" -method = strAttr "METHOD" -multiple = emptyAttr "MULTIPLE" -name = strAttr "NAME" -nohref = emptyAttr "NOHREF" -noresize = emptyAttr "NORESIZE" -noshade = emptyAttr "NOSHADE" -nowrap = emptyAttr "NOWRAP" -onclick = strAttr "ONCLICK" -rel = strAttr "REL" -rev = strAttr "REV" -rows = strAttr "ROWS" -rowspan = intAttr "ROWSPAN" -rules = strAttr "RULES" -scrolling = strAttr "SCROLLING" -selected = emptyAttr "SELECTED" -shape = strAttr "SHAPE" -size = strAttr "SIZE" -src = strAttr "SRC" -start = intAttr "START" -target = strAttr "TARGET" -text = strAttr "TEXT" -theclass = strAttr "CLASS" -thestyle = strAttr "STYLE" -thetype = strAttr "TYPE" -title = strAttr "TITLE" -usemap = strAttr "USEMAP" -valign = strAttr "VALIGN" -value = strAttr "VALUE" -version = strAttr "VERSION" -vlink = strAttr "VLINK" -vspace = intAttr "VSPACE" -width = strAttr "WIDTH" - --- --------------------------------------------------------------------------- --- Html Constructors - --- (automatically generated) - -validHtmlTags :: [String] -validHtmlTags = [ - "ADDRESS", - "A", - "APPLET", - "BIG", - "BLOCKQUOTE", - "BODY", - "B", - "CAPTION", - "CENTER", - "CITE", - "DD", - "DFN", - "DL", - "DT", - "EM", - "FIELDSET", - "FONT", - "FORM", - "FRAME", - "FRAMESET", - "H1", - "H2", - "H3", - "H4", - "H5", - "H6", - "HEAD", - "I", - "KBD", - "LEGEND", - "LI", - "NOFRAMES", - "OL", - "OPTION", - "P", - "PRE", - "SAMP", - "SELECT", - "SMALL", - "STRONG", - "STYLE", - "SUB", - "SUP", - "TABLE", - "TD", - "TEXTAREA", - "TH", - "CODE", - "DIV", - "HTML", - "LINK", - "MAP", - "TITLE", - "TR", - "TT", - "UL", - "U", - "VAR"] - -validHtmlITags :: [String] -validHtmlITags = [ - "AREA", - "BASEFONT", - "BR", - "HR", - "IMG", - "INPUT", - "LINK", - "META", - "PARAM", - "BASE"] - -validHtmlAttrs :: [String] -validHtmlAttrs = [ - "ACTION", - "ALIGN", - "ALINK", - "ALT", - "ALTCODE", - "ARCHIVE", - "BACKGROUND", - "BASE", - "BGCOLOR", - "BORDER", - "BORDERCOLOR", - "CELLPADDING", - "CELLSPACING", - "CHECKED", - "CLEAR", - "CODE", - "CODEBASE", - "COLOR", - "COLS", - "COLSPAN", - "COMPACT", - "CONTENT", - "COORDS", - "ENCTYPE", - "FACE", - "FRAMEBORDER", - "HEIGHT", - "HREF", - "HSPACE", - "HTTP-EQUIV", - "ID", - "ISMAP", - "LANG", - "LINK", - "MARGINHEIGHT", - "MARGINWIDTH", - "MAXLENGTH", - "METHOD", - "MULTIPLE", - "NAME", - "NOHREF", - "NORESIZE", - "NOSHADE", - "NOWRAP", - "REL", - "REV", - "ROWS", - "ROWSPAN", - "RULES", - "SCROLLING", - "SELECTED", - "SHAPE", - "SIZE", - "SRC", - "START", - "TARGET", - "TEXT", - "CLASS", - "STYLE", - "TYPE", - "TITLE", - "USEMAP", - "VALIGN", - "VALUE", - "VERSION", - "VLINK", - "VSPACE", - "WIDTH"] - --- --------------------------------------------------------------------------- --- Html colors - -aqua :: String -black :: String -blue :: String -fuchsia :: String -gray :: String -green :: String -lime :: String -maroon :: String -navy :: String -olive :: String -purple :: String -red :: String -silver :: String -teal :: String -yellow :: String -white :: String - -aqua = "aqua" -black = "black" -blue = "blue" -fuchsia = "fuchsia" -gray = "gray" -green = "green" -lime = "lime" -maroon = "maroon" -navy = "navy" -olive = "olive" -purple = "purple" -red = "red" -silver = "silver" -teal = "teal" -yellow = "yellow" -white = "white" - --- --------------------------------------------------------------------------- --- Basic Combinators - -linesToHtml :: [String] -> Html - -linesToHtml [] = noHtml -linesToHtml (x:[]) = lineToHtml x -linesToHtml (x:xs) = lineToHtml x +++ br +++ linesToHtml xs - - --- --------------------------------------------------------------------------- --- Html abbriviations - -primHtmlChar :: String -> Html -copyright :: Html -spaceHtml :: Html -bullet :: Html -p :: Html -> Html - -primHtmlChar = \ x -> primHtml ("&" ++ x ++ ";") -copyright = primHtmlChar "copy" -spaceHtml = primHtmlChar "nbsp" -bullet = primHtmlChar "#149" - -p = paragraph - --- --------------------------------------------------------------------------- --- Html tables - -cell :: Html -> HtmlTable -cell h = let - cellFn x y = h ! (add x colspan $ add y rowspan $ []) - add 1 _ rest = rest - add n fn rest = fn n : rest - r = BT.single cellFn - in - mkHtmlTable r - --- We internally represent the Cell inside a Table with an --- object of the type --- \pre{ --- Int -> Int -> Html --- } --- When we render it later, we find out how many columns --- or rows this cell will span over, and can --- include the correct colspan/rowspan command. - -newtype HtmlTable - = HtmlTable (BT.BlockTable (Int -> Int -> Html)) - -td :: Html -> HtmlTable -td = cell . thetd - -tda :: [HtmlAttr] -> Html -> HtmlTable -tda as = cell . (thetd ! as) - -above, beside :: HtmlTable -> HtmlTable -> HtmlTable -above a b = combine BT.above a b -beside a b = combine BT.beside a b - -infixr 3 -- combining table cells -infixr 4 <-> -- combining table cells -(), (<->) :: HtmlTable -> HtmlTable -> HtmlTable -() = above -(<->) = beside - -emptyTable :: HtmlTable -emptyTable = HtmlTable BT.empty - -aboves, besides :: [HtmlTable] -> HtmlTable -aboves = foldr above emptyTable -besides = foldr beside emptyTable - -mkHtmlTable :: BT.BlockTable (Int -> Int -> Html) -> HtmlTable -mkHtmlTable r = HtmlTable r - -combine :: (BT.BlockTable (Int -> Int -> Html) - -> BT.BlockTable (Int -> Int -> Html) - -> BT.BlockTable (Int -> Int -> Html)) - -> HtmlTable -> HtmlTable -> HtmlTable -combine fn (HtmlTable a) (HtmlTable b) = mkHtmlTable (a `fn` b) - --- renderTable takes the HtmlTable, and renders it back into --- and Html object. - -renderTable :: BT.BlockTable (Int -> Int -> Html) -> Html -renderTable theTable - = concatHtml - [tr << [theCell x y | (theCell,(x,y)) <- theRow ] - | theRow <- BT.getMatrix theTable] - -instance HTML HtmlTable where - toHtml (HtmlTable tab) = renderTable tab - -instance Show HtmlTable where - showsPrec _ (HtmlTable tab) = shows (renderTable tab) - - --- If you can't be bothered with the above, then you --- can build simple tables with simpleTable. --- Just provide the attributes for the whole table, --- attributes for the cells (same for every cell), --- and a list of lists of cell contents, --- and this function will build the table for you. --- It does presume that all the lists are non-empty, --- and there is at least one list. --- --- Different length lists means that the last cell --- gets padded. If you want more power, then --- use the system above, or build tables explicitly. - -simpleTable :: HTML a => [HtmlAttr] -> [HtmlAttr] -> [[a]] -> Html -simpleTable attr cellAttr lst - = table ! attr - << (aboves - . map (besides . map (cell . (thetd ! cellAttr) . toHtml)) - ) lst - - --- --------------------------------------------------------------------------- --- Tree Displaying Combinators - --- The basic idea is you render your structure in the form --- of this tree, and then use treeHtml to turn it into a Html --- object with the structure explicit. - -data HtmlTree - = HtmlLeaf Html - | HtmlNode Html [HtmlTree] Html - -treeHtml :: [String] -> HtmlTree -> Html -treeHtml colors h = table ! [ - border 0, - cellpadding 0, - cellspacing 2] << treeHtml' colors h - where - manycolors = scanr (:) [] - - treeHtmls :: [[String]] -> [HtmlTree] -> HtmlTable - treeHtmls c ts = aboves (zipWith treeHtml' c ts) - - treeHtml' :: [String] -> HtmlTree -> HtmlTable - treeHtml' (_:_) (HtmlLeaf leaf) = cell - (thetd ! [width "100%"] - << bold - << leaf) - treeHtml' (c:cs@(c2:_)) (HtmlNode hopen ts hclose) = - if null ts && isNoHtml hclose - then - hd - else if null ts - then - hd bar `beside` (cell . (thetd ! [bgcolor c2]) << spaceHtml) - tl - else - hd (bar `beside` treeHtmls morecolors ts) - tl - where - -- This stops a column of colors being the same - -- color as the immeduately outside nesting bar. - morecolors = filter ((/= c).head) (manycolors cs) - bar = cell (thetd ! [bgcolor c,width "10"] << spaceHtml) - hd = cell (thetd ! [bgcolor c] << hopen) - tl = cell (thetd ! [bgcolor c] << hclose) - treeHtml' _ _ = error "The imposible happens" - -instance HTML HtmlTree where - toHtml x = treeHtml treeColors x - --- type "length treeColors" to see how many colors are here. -treeColors :: [String] -treeColors = ["#88ccff","#ffffaa","#ffaaff","#ccffff"] ++ treeColors - - --- --------------------------------------------------------------------------- --- Html Debugging Combinators - --- This uses the above tree rendering function, and displays the --- Html as a tree structure, allowing debugging of what is --- actually getting produced. - -debugHtml :: (HTML a) => a -> Html -debugHtml obj = table ! [border 0] << ( - cell (th ! [bgcolor "#008888"] - << underline - << "Debugging Output") - td << (toHtml (debug' (toHtml obj))) - ) - where - - debug' :: Html -> [HtmlTree] - debug' (Html markups) = map debug markups - - debug :: HtmlElement -> HtmlTree - debug (HtmlString str) = HtmlLeaf (spaceHtml +++ - linesToHtml (lines str)) - debug (HtmlTag { - markupTag = markupTag0, - markupContent = markupContent0, - markupAttrs = markupAttrs0 - }) = - case markupContent0 of - Html [] -> HtmlNode hd [] noHtml - Html xs -> HtmlNode hd (map debug xs) tl - where - args = if null markupAttrs0 - then "" - else " " ++ unwords (map show markupAttrs0) - hd = font ! [size "1"] << ("<" ++ markupTag0 ++ args ++ ">") - tl = font ! [size "1"] << ("") - --- --------------------------------------------------------------------------- --- Hotlink datatype - -data HotLink = HotLink { - hotLinkURL :: URL, - hotLinkContents :: [Html], - hotLinkAttributes :: [HtmlAttr] - } deriving Show - -instance HTML HotLink where - toHtml hl = anchor ! (href (hotLinkURL hl) : hotLinkAttributes hl) - << hotLinkContents hl - -hotlink :: URL -> [Html] -> HotLink -hotlink url h = HotLink { - hotLinkURL = url, - hotLinkContents = h, - hotLinkAttributes = [] } - - --- --------------------------------------------------------------------------- --- More Combinators - --- (Abridged from Erik Meijer's Original Html library) - -ordList :: (HTML a) => [a] -> Html -ordList items = olist << map (li <<) items - -unordList :: (HTML a) => [a] -> Html -unordList items = ulist << map (li <<) items - -defList :: (HTML a,HTML b) => [(a,b)] -> Html -defList items - = dlist << [ [ dterm << bold << dt, ddef << dd ] | (dt,dd) <- items ] - - -widget :: String -> String -> [HtmlAttr] -> Html -widget w n markupAttrs0 = input ! ([thetype w,name n] ++ markupAttrs0) - -checkbox :: String -> String -> Html -hidden :: String -> String -> Html -radio :: String -> String -> Html -reset :: String -> String -> Html -submit :: String -> String -> Html -password :: String -> Html -textfield :: String -> Html -afile :: String -> Html -clickmap :: String -> Html - -checkbox n v = widget "CHECKBOX" n [value v] -hidden n v = widget "HIDDEN" n [value v] -radio n v = widget "RADIO" n [value v] -reset n v = widget "RESET" n [value v] -submit n v = widget "SUBMIT" n [value v] -password n = widget "PASSWORD" n [] -textfield n = widget "TEXT" n [] -afile n = widget "FILE" n [] -clickmap n = widget "IMAGE" n [] - -menu :: String -> [Html] -> Html -menu n choices - = select ! [name n] << [ option << p << choice | choice <- choices ] - -gui :: String -> Html -> Html -gui act = form ! [action act,method "POST"] - --- --------------------------------------------------------------------------- --- Html Rendering - --- Uses the append trick to optimize appending. --- The output is quite messy, because space matters in --- HTML, so we must not generate needless spaces. - -renderHtml :: (HTML html) => html -> String -renderHtml theHtml = - renderMessage ++ - foldr (.) id (map unprettyHtml - (getHtmlElements (tag "HTML" << theHtml))) "\n" - -renderMessage :: String -renderMessage = - "\n" ++ - "\n" - -unprettyHtml :: HtmlElement -> ShowS -unprettyHtml (HtmlString str) = (++) str -unprettyHtml (HtmlTag - { markupTag = name0, - markupContent = html, - markupAttrs = markupAttrs0 }) - = if isNoHtml html && elem name0 validHtmlITags - then renderTag True name0 markupAttrs0 0 - else (renderTag True name0 markupAttrs0 0 - . foldr (.) id (map unprettyHtml (getHtmlElements html)) - . renderTag False name0 [] 0) - --- Local Utilities -prettyHtml :: (HTML html) => html -> String -prettyHtml theHtml = - unlines - $ concat - $ map prettyHtml' - $ getHtmlElements - $ toHtml theHtml - -prettyHtml' :: HtmlElement -> [String] -prettyHtml' (HtmlString str) = [str] -prettyHtml' (HtmlTag - { markupTag = name0, - markupContent = html, - markupAttrs = markupAttrs0 }) - = if isNoHtml html && elem name0 validHtmlITags - then - [rmNL (renderTag True name0 markupAttrs0 0 "")] - else - [rmNL (renderTag True name0 markupAttrs0 0 "")] ++ - shift (concat (map prettyHtml' (getHtmlElements html))) ++ - [rmNL (renderTag False name0 [] 0 "")] - where - shift = map (\x -> " " ++ x) - -rmNL :: [Char] -> [Char] -rmNL = filter (/= '\n') - --- This prints the Tags The lack of spaces in intentunal, because Html is --- actually space dependant. - -renderTag :: Bool -> String -> [HtmlAttr] -> Int -> ShowS -renderTag x name0 markupAttrs0 n r - = open ++ name0 ++ rest markupAttrs0 ++ ">" ++ r - where - open = if x then "<" else " String - showPair (HtmlAttr tag0 val) - = tag0 ++ "=\"" ++ val ++ "\"" - rmfile ./src/Haddock/Utils/Html.hs rmdir ./src/Haddock/Utils hunk ./src/Main.hs 21 -import qualified Haddock.Backends.Html as Html -import qualified Haddock.Backends.Xhtml as Xhtml -import qualified Haddock.Backends.LaTeX as LaTeX +import Haddock.Backends.Xhtml +import Haddock.Backends.LaTeX hunk ./src/Main.hs 197 - -- Which HTML rendering to use. - pick htmlF xhtmlF = if Flag_Xhtml `elem` flags then xhtmlF else htmlF - ppHtmlIndex = pick Html.ppHtmlIndex Xhtml.ppHtmlIndex - ppHtmlHelpFiles = pick Html.ppHtmlHelpFiles Xhtml.ppHtmlHelpFiles - ppHtmlContents = pick Html.ppHtmlContents Xhtml.ppHtmlContents - ppHtml = pick Html.ppHtml Xhtml.ppHtml - copyHtmlBits = pick Html.copyHtmlBits Xhtml.copyHtmlBits - hunk ./src/Main.hs 227 - LaTeX.ppLaTeX title packageStr visibleIfaces odir prologue opt_latex_style + ppLaTeX title packageStr visibleIfaces odir prologue opt_latex_style hunk ./tests/golden-tests/README 28 - runhaskell runtests.hs --xhtml all + runhaskell runtests.hs --title="All Tests" all hunk ./tests/golden-tests/runtests.hs 66 - (["-w", "-o", outdir, "-h", "--xhtml", "--optghc=-fglasgow-exts" + (["-w", "-o", outdir, "-h", "--optghc=-fglasgow-exts" hunk ./haddock.cabal 120 - Haddock.Backends.DevHelp - Haddock.Backends.HH - Haddock.Backends.HH2 hunk ./haddock.cabal 181 - Haddock.Backends.DevHelp - Haddock.Backends.HH - Haddock.Backends.HH2 hunk ./src/Haddock/Backends/DevHelp.hs 1 ------------------------------------------------------------------------------ --- | --- Module : Haddock.Backends.DevHelp --- Copyright : (c) Simon Marlow 2003-2006, --- David Waern 2006 --- License : BSD-like --- --- Maintainer : haddock@projects.haskell.org --- Stability : experimental --- Portability : portable ------------------------------------------------------------------------------ -module Haddock.Backends.DevHelp (ppDevHelpFile) where - -import Haddock.ModuleTree -import Haddock.Types hiding (Doc) -import Haddock.Utils - -import Module -import Name ( Name, nameModule, getOccString, nameOccName ) - -import Data.Maybe ( fromMaybe ) -import qualified Data.Map as Map -import System.FilePath -import Text.PrettyPrint - -ppDevHelpFile :: FilePath -> String -> Maybe String -> [Interface] -> IO () -ppDevHelpFile odir doctitle maybe_package ifaces = do - let devHelpFile = package++".devhelp" - tree = mkModuleTree True [ (ifaceMod iface, toDescription iface) | iface <- ifaces ] - doc = - text "" $$ - (text "text doctitle<> - text "\" link=\""<>text contentsHtmlFile<>text"\" author=\"\" name=\""<>text package<>text "\">") $$ - text "" $$ - nest 4 (ppModuleTree [] tree) $+$ - text "" $$ - text "" $$ - nest 4 (ppList index) $+$ - text "" $$ - text "" - writeFile (joinPath [odir, devHelpFile]) (render doc) - where - package = fromMaybe "pkg" maybe_package - - ppModuleTree :: [String] -> [ModuleTree] -> Doc - ppModuleTree ss [x] = ppNode ss x - ppModuleTree ss (x:xs) = ppNode ss x $$ ppModuleTree ss xs - ppModuleTree _ [] = error "HaddockHH.ppHHContents.fn: no module trees given" - - ppNode :: [String] -> ModuleTree -> Doc - ppNode ss (Node s leaf _ _short ts) = - case ts of - [] -> text "ppAttribs<>text "/>" - _ -> - text "ppAttribs<>text ">" $$ - nest 4 (ppModuleTree (s:ss) ts) $+$ - text "" - where - ppLink | leaf = text (moduleHtmlFile (mkModule (stringToPackageId "") - (mkModuleName mdl))) - | otherwise = empty - - ppAttribs = text "name="<>doubleQuotes (text s)<+>text "link="<>doubleQuotes ppLink - - mdl = foldr (++) "" (s' : map ('.':) ss') - (s':ss') = reverse (s:ss) - -- reconstruct the module name - - index :: [(Name, [Module])] - index = Map.toAscList (foldr getModuleIndex Map.empty ifaces) - - getModuleIndex iface fm = - Map.unionWith (++) (Map.fromListWith (flip (++)) [(name, [mdl]) | name <- ifaceExports iface, nameModule name == mdl]) fm - where mdl = ifaceMod iface - - ppList :: [(Name, [Module])] -> Doc - ppList [] = empty - ppList ((name,refs):mdls) = - ppReference name refs $$ - ppList mdls - - ppReference :: Name -> [Module] -> Doc - ppReference _ [] = empty - ppReference name (mdl:refs) = - text "text (escapeStr (getOccString name))<>text"\" link=\""<>text (moduleNameUrl mdl (nameOccName name))<>text"\"/>" $$ - ppReference name refs rmfile ./src/Haddock/Backends/DevHelp.hs hunk ./src/Haddock/Backends/HH.hs 1 ------------------------------------------------------------------------------ --- | --- Module : Haddock.Backends.HH --- Copyright : (c) Simon Marlow 2003 --- License : BSD-like --- --- Maintainer : haddock@projects.haskell.org --- Stability : experimental --- Portability : portable ------------------------------------------------------------------------------ -module Haddock.Backends.HH (ppHHContents, ppHHIndex, ppHHProject) where - -ppHHContents, ppHHIndex, ppHHProject :: a -ppHHContents = error "not yet" -ppHHIndex = error "not yet" -ppHHProject = error "not yet" - -{- -import HaddockModuleTree -import HaddockTypes -import HaddockUtil -import HsSyn2 hiding(Doc) -import qualified Map - -import Data.Char ( toUpper ) -import Data.Maybe ( fromMaybe ) -import Text.PrettyPrint - -ppHHContents :: FilePath -> String -> Maybe String -> [ModuleTree] -> IO () -ppHHContents odir doctitle maybe_package tree = do - let contentsHHFile = package++".hhc" - - html = - text "" $$ - text "" $$ - text "" $$ - text "" $$ - text "" $$ - text "" $$ - ppModuleTree tree $$ - text "" - writeFile (joinPath [odir, contentsHHFile]) (render html) - where - package = fromMaybe "pkg" maybe_package - - ppModuleTree :: [ModuleTree] -> Doc - ppModuleTree ts = - text "" $$ - text "" $$ - text "" $$ - text "
    " $+$ - nest 4 (text "
  • " <> nest 4 - (text "" $$ - nest 4 (text "text doctitle<>text "\">" $$ - text "") $$ - text "") $+$ - text "
  • " $$ - text "
      " $+$ - nest 4 (fn [] ts) $+$ - text "
    ") $+$ - text "
" - - fn :: [String] -> [ModuleTree] -> Doc - fn ss [x] = ppNode ss x - fn ss (x:xs) = ppNode ss x $$ fn ss xs - fn _ [] = error "HaddockHH.ppHHContents.fn: no module trees given" - - ppNode :: [String] -> ModuleTree -> Doc - ppNode ss (Node s leaf _pkg _ []) = - ppLeaf s ss leaf - ppNode ss (Node s leaf _pkg _ ts) = - ppLeaf s ss leaf $$ - text "
    " $+$ - nest 4 (fn (s:ss) ts) $+$ - text "
" - - ppLeaf s ss isleaf = - text "
  • " <> nest 4 - (text "" $$ - text " text s <> text "\">" $$ - (if isleaf then text " text (moduleHtmlFile mdl) <> text "\">" else empty) $$ - text "") $+$ - text "
  • " - where - mdl = foldr (++) "" (s' : map ('.':) ss') - (s':ss') = reverse (s:ss) - -- reconstruct the module name - -------------------------------- -ppHHIndex :: FilePath -> Maybe String -> [Interface] -> IO () -ppHHIndex odir maybe_package ifaces = do - let indexHHFile = package++".hhk" - - html = - text "" $$ - text "" $$ - text "" $$ - text "" $$ - text "" $$ - text "" $$ - text "
      " $+$ - nest 4 (ppList index) $+$ - text "
    " $$ - text "" - writeFile (joinPath [odir, indexHHFile]) (render html) - where - package = fromMaybe "pkg" maybe_package - - index :: [(HsName, [Module])] - index = Map.toAscList (foldr getIfaceIndex Map.empty ifaces) - - getIfaceIndex iface fm = - foldl (\m (k,e) -> Map.insertWith (++) k e m) fm [(name, [mdl]) | (name, Qual mdl' _) <- Map.toAscList (iface_env iface), mdl == mdl'] - where mdl = iface_module iface - - ppList [] = empty - ppList ((name,refs):mdls) = - text "
  • " <> nest 4 - (text "" $$ - text " text (show name) <> text "\">" $$ - ppReference name refs $$ - text "") $+$ - text "
  • " $$ - ppList mdls - - ppReference name [] = empty - ppReference name (Module mdl:refs) = - text " text (moduleNameURL mdl name) <> text "\">" $$ - ppReference name refs - - -ppHHProject :: FilePath -> String -> Maybe String -> [Interface] -> [FilePath] -> IO () -ppHHProject odir doctitle maybe_package ifaces pkg_paths = do - let projectHHFile = package++".hhp" - doc = - text "[OPTIONS]" $$ - text "Compatibility=1.1 or later" $$ - text "Compiled file=" <> text package <> text ".chm" $$ - text "Contents file=" <> text package <> text ".hhc" $$ - text "Default topic=" <> text contentsHtmlFile $$ - text "Display compile progress=No" $$ - text "Index file=" <> text package <> text ".hhk" $$ - text "Title=" <> text doctitle $$ - space $$ - text "[FILES]" $$ - ppMods ifaces $$ - text contentsHtmlFile $$ - text indexHtmlFile $$ - ppIndexFiles chars $$ - ppLibFiles ("":pkg_paths) - writeFile (joinPath [odir, projectHHFile]) (render doc) - where - package = fromMaybe "pkg" maybe_package - - ppMods [] = empty - ppMods (iface:ifaces) = - let Module mdl = iface_module iface in - text (moduleHtmlFile mdl) $$ - ppMods ifaces - - ppIndexFiles [] = empty - ppIndexFiles (c:cs) = - text (subIndexHtmlFile c) $$ - ppIndexFiles cs - - ppLibFiles [] = empty - ppLibFiles (path:paths) = - ppLibFile cssFile $$ - ppLibFile iconFile $$ - ppLibFile jsFile $$ - ppLibFile plusFile $$ - ppLibFile minusFile $$ - ppLibFiles paths - where - toPath fname | null path = fname - | otherwise = joinPath [path, fname] - ppLibFile fname = text (toPath fname) - - chars :: [Char] - chars = map fst (Map.toAscList (foldr getIfaceIndex Map.empty ifaces)) - - getIfaceIndex iface fm = - Map.union (Map.fromList [(toUpper (head (show name)),()) | (name, Qual mdl' _) <- Map.toAscList (iface_env iface), mdl == mdl']) fm - where mdl = iface_module iface --} rmfile ./src/Haddock/Backends/HH.hs hunk ./src/Haddock/Backends/HH2.hs 1 ------------------------------------------------------------------------------ --- | --- Module : Haddock.Backends.HH2 --- Copyright : (c) Simon Marlow 2003 --- License : BSD-like --- --- Maintainer : haddock@projects.haskell.org --- Stability : experimental --- Portability : portable ------------------------------------------------------------------------------ -module Haddock.Backends.HH2 (ppHH2Contents, ppHH2Index, ppHH2Files, ppHH2Collection) where - -import Haddock.Types - -ppHH2Files :: FilePath -> Maybe String -> [Interface] -> [FilePath] -> IO () -ppHH2Files = error "not yet" - -ppHH2Contents, ppHH2Index, ppHH2Collection :: a -ppHH2Contents = error "not yet" -ppHH2Index = error "not yet" -ppHH2Collection = error "not yet" - -{- -import HaddockModuleTree -import HaddockUtil -import HsSyn2 hiding(Doc) -import qualified Map - -import Data.Char ( toUpper ) -import Data.Maybe ( fromMaybe ) -import Text.PrettyPrint - -ppHH2Contents :: FilePath -> String -> Maybe String -> [ModuleTree] -> IO () -ppHH2Contents odir doctitle maybe_package tree = do - let - contentsHH2File = package++".HxT" - - doc = - text "" $$ - text "" $$ - text "" $$ - nest 4 (text "text doctitle<>text"\" Url=\"index.html\">" $$ - nest 4 (ppModuleTree [] tree) $+$ - text "") $$ - text "" - writeFile (joinPath [odir, contentsHH2File]) (render doc) - where - package = fromMaybe "pkg" maybe_package - - ppModuleTree :: [String] -> [ModuleTree] -> Doc - ppModuleTree ss [x] = ppNode ss x - ppModuleTree ss (x:xs) = ppNode ss x $$ ppModuleTree ss xs - ppModuleTree _ [] = error "HaddockHH2.ppHH2Contents.ppModuleTree: no module trees given" - - ppNode :: [String] -> ModuleTree -> Doc - ppNode ss (Node s leaf _pkg _short []) = - text " ppAttributes leaf (s:ss) <> text "/>" - ppNode ss (Node s leaf _pkg _short ts) = - text " ppAttributes leaf (s:ss) <> text ">" $$ - nest 4 (ppModuleTree (s:ss) ts) $+$ - text "" - - ppAttributes :: Bool -> [String] -> Doc - ppAttributes isleaf ss = hsep [ppId,ppTitle,ppUrl] - where - mdl = foldr (++) "" (s' : map ('.':) ss') - (s':ss') = reverse ss - -- reconstruct the module name - - ppId = text "Id=" <> doubleQuotes (text mdl) - - ppTitle = text "Title=" <> doubleQuotes (text (head ss)) - - ppUrl | isleaf = text " Url=" <> doubleQuotes (text (moduleHtmlFile mdl)) - | otherwise = empty - ------------------------------------------------------------------------------------ - -ppHH2Index :: FilePath -> Maybe String -> [Interface] -> IO () -ppHH2Index odir maybe_package ifaces = do - let - indexKHH2File = package++"K.HxK" - indexNHH2File = package++"N.HxK" - docK = - text "" $$ - text "" $$ - text "" $$ - nest 4 (ppList index) $+$ - text "" - docN = - text "" $$ - text "" $$ - text "" $$ - text "" $$ - nest 4 (text "text contentsHtmlFile<>text "\"/>") $$ - text "" $$ - text "" - writeFile (joinPath [odir, indexKHH2File]) (render docK) - writeFile (joinPath [odir, indexNHH2File]) (render docN) - where - package = fromMaybe "pkg" maybe_package - - index :: [(HsName, [Module])] - index = Map.toAscList (foldr getIfaceIndex Map.empty ifaces) - - getIfaceIndex iface fm = - Map.unionWith (++) (Map.fromListWith (flip (++)) [(name, [mdl]) | (name, Qual mdl' _) <- Map.toAscList (iface_env iface), mdl == mdl']) fm - where mdl = iface_module iface - - ppList [] = empty - ppList ((name,mdls):vs) = - text " text (escapeStr (show name)) <> text "\">" $$ - nest 4 (vcat (map (ppJump name) mdls)) $$ - text "" $$ - ppList vs - - ppJump name (Module mdl) = text " text (moduleNameUrl mdl name) <> text "\"/>" - - ------------------------------------------------------------------------------------ - -ppHH2Files :: FilePath -> Maybe String -> [Interface] -> [FilePath] -> IO () -ppHH2Files odir maybe_package ifaces pkg_paths = do - let filesHH2File = package++".HxF" - doc = - text "" $$ - text "" $$ - text "" $$ - nest 4 (ppMods ifaces $$ - text "text contentsHtmlFile<>text "\"/>" $$ - text "text indexHtmlFile<>text "\"/>" $$ - ppIndexFiles chars $$ - ppLibFiles ("":pkg_paths)) $$ - text "" - writeFile (joinPath [odir, filesHH2File]) (render doc) - where - package = fromMaybe "pkg" maybe_package - - ppMods [] = empty - ppMods (iface:ifaces) = - text " text (moduleHtmlFile mdl) <> text "\"/>" $$ - ppMods ifaces - where Module mdl = iface_module iface - - ppIndexFiles [] = empty - ppIndexFiles (c:cs) = - text "text (subIndexHtmlFile c)<>text "\"/>" $$ - ppIndexFiles cs - - ppLibFiles [] = empty - ppLibFiles (path:paths) = - ppLibFile cssFile $$ - ppLibFile iconFile $$ - ppLibFile jsFile $$ - ppLibFile plusFile $$ - ppLibFile minusFile $$ - ppLibFiles paths - where - toPath fname | null path = fname - | otherwise = joinPath [path, fname] - ppLibFile fname = text "text (toPath fname)<>text "\"/>" - - chars :: [Char] - chars = map fst (Map.toAscList (foldr getIfaceIndex Map.empty ifaces)) - - getIfaceIndex iface fm = - Map.union (Map.fromList [(toUpper (head (show name)),()) | (name, Qual mdl' _) <- Map.toAscList (iface_env iface), mdl == mdl']) fm - where mdl = iface_module iface - ------------------------------------------------------------------------------------ - -ppHH2Collection :: FilePath -> String -> Maybe String -> IO () -ppHH2Collection odir doctitle maybe_package = do - let - package = fromMaybe "pkg" maybe_package - collectionHH2File = package++".HxC" - - doc = - text "" $$ - text "" $$ - text " text doctitle <> text "\">" $$ - nest 4 (text "" $$ - nest 4 (text " text package <> text ".HxF\"/>") $$ - text "" $$ - text " text package <> text ".HxT\"/>" $$ - text " text package <> text "K.HxK\"/>" $$ - text " text package <> text "N.HxK\"/>" $$ - text "" $$ - text "" $$ - text "" $$ - text "" $$ - text "" $$ - text "") $$ - text "" - writeFile (joinPath [odir, collectionHH2File]) (render doc) --} rmfile ./src/Haddock/Backends/HH2.hs hunk ./src/Haddock/Backends/Xhtml.hs 16 - ppHtmlHelpFiles hunk ./src/Haddock/Backends/Xhtml.hs 21 -import Haddock.Backends.DevHelp -import Haddock.Backends.HH -import Haddock.Backends.HH2 hunk ./src/Haddock/Backends/Xhtml.hs 66 - -> Maybe String -- the Html Help format (--html-help) hunk ./src/Haddock/Backends/Xhtml.hs 73 -ppHtml doctitle maybe_package ifaces odir prologue maybe_html_help_format +ppHtml doctitle maybe_package ifaces odir prologue hunk ./src/Haddock/Backends/Xhtml.hs 81 - maybe_html_help_format maybe_index_url maybe_source_url maybe_wiki_url + maybe_index_url maybe_source_url maybe_wiki_url hunk ./src/Haddock/Backends/Xhtml.hs 87 - ppHtmlIndex odir doctitle maybe_package maybe_html_help_format + ppHtmlIndex odir doctitle maybe_package hunk ./src/Haddock/Backends/Xhtml.hs 91 - when (not (isJust maybe_contents_url && isJust maybe_index_url)) $ - ppHtmlHelpFiles doctitle maybe_package ifaces odir maybe_html_help_format [] - hunk ./src/Haddock/Backends/Xhtml.hs 96 -ppHtmlHelpFiles - :: String -- doctitle - -> Maybe String -- package - -> [Interface] - -> FilePath -- destination directory - -> Maybe String -- the Html Help format (--html-help) - -> [FilePath] -- external packages paths - -> IO () -ppHtmlHelpFiles doctitle maybe_package ifaces odir maybe_html_help_format pkg_paths = do - let - visible_ifaces = filter visible ifaces - visible i = OptHide `notElem` ifaceOptions i - - -- Generate index and contents page for Html Help if requested - case maybe_html_help_format of - Nothing -> return () - Just "mshelp" -> ppHHProject odir doctitle maybe_package visible_ifaces pkg_paths - Just "mshelp2" -> do - ppHH2Files odir maybe_package visible_ifaces pkg_paths - ppHH2Collection odir doctitle maybe_package - Just "devhelp" -> ppDevHelpFile odir doctitle maybe_package visible_ifaces - Just format -> fail ("The "++format++" format is not implemented") - - hunk ./src/Haddock/Backends/Xhtml.hs 240 - -> Maybe String hunk ./src/Haddock/Backends/Xhtml.hs 245 - maybe_package maybe_html_help_format maybe_index_url + _maybe_package maybe_index_url hunk ./src/Haddock/Backends/Xhtml.hs 263 - -- Generate contents page for Html Help if requested - case maybe_html_help_format of - Nothing -> return () - Just "mshelp" -> ppHHContents odir doctitle maybe_package tree - Just "mshelp2" -> ppHH2Contents odir doctitle maybe_package tree - Just "devhelp" -> return () - Just format -> fail ("The "++format++" format is not implemented") - hunk ./src/Haddock/Backends/Xhtml.hs 348 - -> Maybe String hunk ./src/Haddock/Backends/Xhtml.hs 352 -ppHtmlIndex odir doctitle maybe_package maybe_html_help_format +ppHtmlIndex odir doctitle _maybe_package hunk ./src/Haddock/Backends/Xhtml.hs 364 - -- Generate index and contents page for Html Help if requested - case maybe_html_help_format of - Nothing -> return () - Just "mshelp" -> ppHHIndex odir maybe_package ifaces - Just "mshelp2" -> ppHH2Index odir maybe_package ifaces - Just "devhelp" -> return () - Just format -> fail ("The "++format++" format is not implemented") - hunk ./src/Haddock/Options.hs 22 - optHtmlHelpFormat, hunk ./src/Haddock/Options.hs 49 - | Flag_HtmlHelp String hunk ./src/Haddock/Options.hs 101 - Option [] ["html-help"] (ReqArg Flag_HtmlHelp "format") - "produce index and table of contents in\nmshelp, mshelp2 or devhelp format (with -h)", hunk ./src/Haddock/Options.hs 192 -optHtmlHelpFormat :: [Flag] -> Maybe String -optHtmlHelpFormat flags = optLast [ hhformat | Flag_HtmlHelp hhformat <- flags ] - - hunk ./src/Main.hs 182 - opt_html_help_format = optHtmlHelpFormat flags hunk ./src/Main.hs 200 - ppHtmlIndex odir title packageStr opt_html_help_format + ppHtmlIndex odir title packageStr hunk ./src/Main.hs 205 - when (Flag_GenContents `elem` flags && Flag_GenIndex `elem` flags) $ - ppHtmlHelpFiles title packageStr visibleIfaces odir opt_html_help_format [] - hunk ./src/Main.hs 206 - ppHtmlContents odir title packageStr opt_html_help_format + ppHtmlContents odir title packageStr hunk ./src/Main.hs 213 - prologue opt_html_help_format + prologue hunk ./html/nhaddock.css 47 - margin: 0.8em 0 0.5em 0; + margin: 0.8em 0 0.5em; +} + +* + h1, * + h2, * + h3, * + h4, * + h5, * + h6 { + margin-top: 4em; hunk ./html/nhaddock.css 72 -/* -ul.links { - list-style: none; - text-align: left; - position: absolute; - right: 5px; - top: 5px; - display: inline-table; - margin: 0; -} -*/ -/* -ul.links li { - display: inline; - white-space: nowrap; -} -*/ - hunk ./html/nhaddock.css 77 - margin: 0.5em 0; -/* border-top: 1px solid rgb(78,98,114); */ -/* border-bottom: 1px solid rgb(78,98,114); */ -/* background: rgb(226,235,243); */ + margin: 0.5em 5em 0.5em 3em; hunk ./html/nhaddock.css 79 - margin-left: 1em; - margin-right: 1em; hunk ./html/nhaddock.css 91 +.doc p, .doc pre { + margin-top: 1em; +} + hunk ./html/nhaddock.css 98 +img.coll { + width : 0.75em; + height: 0.75em; + margin: 0 0.5em 0 0; +} + + hunk ./html/nhaddock.css 197 - font-size: 70%; + font-size: 75%; hunk ./html/nhaddock.css 200 - top: -5em; + top: 0em; /* use -5em to pull up into title area */ hunk ./html/nhaddock.css 246 +/* @group Left Margin */ + hunk ./html/nhaddock.css 249 - padding-left: 2em; + /* use this selector for one level of indent */ + padding-left: 2em; hunk ./html/nhaddock.css 253 +/* use these two for two levels of indent */ +/* +#description .doc, #interface div.top { + padding-left: 1.25em; +} + +div.top .subs, div.top .doc { + padding-left: 1.875em; +} +*/ +/* @end */ + hunk ./html/nhaddock.css 343 + hunk ./src/Haddock/Backends/Xhtml.hs 66 + -> Themes -- themes hunk ./src/Haddock/Backends/Xhtml.hs 75 - maybe_source_url maybe_wiki_url + themes maybe_source_url maybe_wiki_url hunk ./src/Haddock/Backends/Xhtml.hs 82 - maybe_index_url maybe_source_url maybe_wiki_url + themes maybe_index_url maybe_source_url maybe_wiki_url hunk ./src/Haddock/Backends/Xhtml.hs 89 - maybe_contents_url maybe_source_url maybe_wiki_url + themes maybe_contents_url maybe_source_url maybe_wiki_url hunk ./src/Haddock/Backends/Xhtml.hs 92 - mapM_ (ppHtmlModule odir doctitle + mapM_ (ppHtmlModule odir doctitle themes hunk ./src/Haddock/Backends/Xhtml.hs 113 -copyHtmlBits :: FilePath -> FilePath -> Maybe FilePath -> IO () -copyHtmlBits odir libdir _maybe_css = do +copyHtmlBits :: FilePath -> FilePath -> Themes -> IO () +copyHtmlBits odir libdir themes = do hunk ./src/Haddock/Backends/Xhtml.hs 117 - {- - css_file = case maybe_css of - Nothing -> joinPath [libhtmldir, 'x':cssFile] - Just f -> f - css_destination = joinPath [odir, cssFile] - -} + copyCssFile f = do + copyFile f (combine odir (takeFileName f)) hunk ./src/Haddock/Backends/Xhtml.hs 121 - --copyFile css_file css_destination - mapM_ copyLibFile cssFiles + mapM_ copyCssFile (cssFiles themes) hunk ./src/Haddock/Backends/Xhtml.hs 125 -headHtml :: String -> Maybe String -> Html -headHtml docTitle miniPage = +headHtml :: String -> Maybe String -> Themes -> Html +headHtml docTitle miniPage themes = hunk ./src/Haddock/Backends/Xhtml.hs 130 - styleSheet, + styleSheet themes, hunk ./src/Haddock/Backends/Xhtml.hs 179 -bodyHtml :: String -> Maybe Interface +bodyHtml :: String -> Maybe Interface -> Themes hunk ./src/Haddock/Backends/Xhtml.hs 183 -bodyHtml doctitle iface +bodyHtml doctitle iface themes hunk ./src/Haddock/Backends/Xhtml.hs 195 - ] ++ [styleMenu]) ! [theclass "links"] + ] ++ [styleMenu themes]) ! [theclass "links"] hunk ./src/Haddock/Backends/Xhtml.hs 235 + -> Themes hunk ./src/Haddock/Backends/Xhtml.hs 241 -ppHtmlContents odir doctitle - _maybe_package maybe_index_url +ppHtmlContents odir doctitle _maybe_package + themes maybe_index_url hunk ./src/Haddock/Backends/Xhtml.hs 247 - headHtml doctitle Nothing +++ - bodyHtml doctitle Nothing + headHtml doctitle Nothing themes +++ + bodyHtml doctitle Nothing themes hunk ./src/Haddock/Backends/Xhtml.hs 258 - ppHtmlContentsFrame odir doctitle ifaces + ppHtmlContentsFrame odir doctitle themes ifaces hunk ./src/Haddock/Backends/Xhtml.hs 324 -ppHtmlContentsFrame :: FilePath -> String -> [InstalledInterface] -> IO () -ppHtmlContentsFrame odir doctitle ifaces = do +ppHtmlContentsFrame :: FilePath -> String -> Themes + -> [InstalledInterface] -> IO () +ppHtmlContentsFrame odir doctitle themes ifaces = do hunk ./src/Haddock/Backends/Xhtml.hs 329 - headHtml doctitle Nothing +++ + headHtml doctitle Nothing themes +++ hunk ./src/Haddock/Backends/Xhtml.hs 345 + -> Themes hunk ./src/Haddock/Backends/Xhtml.hs 351 -ppHtmlIndex odir doctitle _maybe_package +ppHtmlIndex odir doctitle _maybe_package themes hunk ./src/Haddock/Backends/Xhtml.hs 365 - headHtml (doctitle ++ " (" ++ indexName ch ++ ")") Nothing +++ - bodyHtml doctitle Nothing + headHtml (doctitle ++ " (" ++ indexName ch ++ ")") Nothing themes +++ + bodyHtml doctitle Nothing themes hunk ./src/Haddock/Backends/Xhtml.hs 460 - :: FilePath -> String + :: FilePath -> String -> Themes hunk ./src/Haddock/Backends/Xhtml.hs 464 -ppHtmlModule odir doctitle +ppHtmlModule odir doctitle themes hunk ./src/Haddock/Backends/Xhtml.hs 471 - headHtml mdl_str (Just $ "mini_" ++ moduleHtmlFile mdl) +++ - bodyHtml doctitle (Just iface) + headHtml mdl_str (Just $ "mini_" ++ moduleHtmlFile mdl) themes +++ + bodyHtml doctitle (Just iface) themes hunk ./src/Haddock/Backends/Xhtml.hs 481 - ppHtmlModuleMiniSynopsis odir doctitle iface unicode + ppHtmlModuleMiniSynopsis odir doctitle themes iface unicode hunk ./src/Haddock/Backends/Xhtml.hs 484 -ppHtmlModuleMiniSynopsis :: FilePath -> String -> Interface -> Bool -> IO () -ppHtmlModuleMiniSynopsis odir _doctitle iface unicode = do +ppHtmlModuleMiniSynopsis :: FilePath -> String -> Themes + -> Interface -> Bool -> IO () +ppHtmlModuleMiniSynopsis odir _doctitle themes iface unicode = do hunk ./src/Haddock/Backends/Xhtml.hs 489 - headHtml (moduleString mdl) Nothing +++ + headHtml (moduleString mdl) Nothing themes +++ hunk ./src/Haddock/Backends/Xhtml/Themes.hs 12 - CssTheme(..), - + Themes, + getThemes, + hunk ./src/Haddock/Backends/Xhtml/Themes.hs 20 -import Haddock.Utils (iconFile) +import Haddock.Options hunk ./src/Haddock/Backends/Xhtml/Themes.hs 22 +import Control.Monad (liftM) +import Data.Either (lefts, rights) hunk ./src/Haddock/Backends/Xhtml/Themes.hs 25 +import Data.Maybe (listToMaybe) hunk ./src/Haddock/Backends/Xhtml/Themes.hs 27 +import System.Directory +import System.FilePath hunk ./src/Haddock/Backends/Xhtml/Themes.hs 33 --- Standard set of style sheets, first is the preferred +-------------------------------------------------------------------------------- +-- * CSS Themes +-------------------------------------------------------------------------------- hunk ./src/Haddock/Backends/Xhtml/Themes.hs 43 +type Themes = [CssTheme] + + +-- | Standard theme used by default +standardTheme :: FilePath -> CssTheme +standardTheme libDir = locateIn libDir $ + CssTheme "Ocean" "nhaddock.css" ["nhaddock.css", "hslogo-16.png"] hunk ./src/Haddock/Backends/Xhtml/Themes.hs 51 -themes :: [CssTheme] -themes = [ - CssTheme "Classic" "xhaddock.css" ["xhaddock.css", iconFile], - CssTheme "Tibbe" "thaddock.css" ["thaddock.css", iconFile], - CssTheme "Snappy" "shaddock.css" ["shaddock.css", "s_haskell_icon.gif"], - CssTheme "Nomi" "nhaddock.css" ["nhaddock.css", "hslogo-16.png"] + +-- | Default themes that are part of Haddock; added with --default-themes +defaultThemes :: FilePath -> Themes +defaultThemes libDir = standardTheme libDir : + (map (locateIn libDir) $ [ + CssTheme "Classic" "xhaddock.css" ["xhaddock.css", "haskell_icon.gif"], + CssTheme "Tibbe" "thaddock.css" ["thaddock.css", "haskell_icon.gif"], + CssTheme "Snappy" "shaddock.css" ["shaddock.css", "s_haskell_icon.gif"] hunk ./src/Haddock/Backends/Xhtml/Themes.hs 60 + ) + +locateIn :: FilePath -> CssTheme -> CssTheme +locateIn libDir t = t { themeFiles = map loc (themeFiles t) } + where loc = combine libDir . combine "html" hunk ./src/Haddock/Backends/Xhtml/Themes.hs 66 -cssFiles :: [String] -cssFiles = nub (concatMap themeFiles themes) +-------------------------------------------------------------------------------- +-- * CSS Theme Arguments +-------------------------------------------------------------------------------- hunk ./src/Haddock/Backends/Xhtml/Themes.hs 70 -styleSheet :: Html -styleSheet = toHtml $ zipWith mkLink themes rels +-- | Process input flags for CSS Theme arguments +getThemes :: FilePath -> [Flag] -> IO (Either String Themes) +getThemes libDir flags = + liftM (someTheme . concatEither) (mapM themeFlag flags) + where + themeFlag :: Flag -> IO (Either String Themes) + + themeFlag (Flag_CSS path) = (liftM . liftEither) (:[]) (theme path) + + themeFlag (Flag_Themes path) = do + itsADirectory <- doesDirectoryExist path + if itsADirectory + then do + items <- getDirectoryItems path + themes <- mapM theme items + case rights themes of + [] -> errMessage "no themes found in" path + ts -> retRight ts + else errMessage "not a valid theme directory" path + + themeFlag (Flag_DefaultThemes) = retRight (defaultThemes libDir) + themeFlag _ = retRight [] + + theme :: FilePath -> IO (Either String CssTheme) + theme path = do + itsAFile <- doesFileExist path + if itsAFile + then singleFileTheme path + else do + itsADirectory <- doesDirectoryExist path + if itsADirectory + then directoryTheme path + else errMessage "css path doesn't exist" path + + someTheme :: Either String Themes -> Either String Themes + someTheme (Right []) = Right [standardTheme libDir] + someTheme est = est + +errMessage :: String -> FilePath -> IO (Either String a) +errMessage msg path = return (Left (msg ++ ": \"" ++ path ++ "\"")) + + +retRight :: a -> IO (Either String a) +retRight = return . Right + + +singleFileTheme :: FilePath -> IO (Either String CssTheme) +singleFileTheme path = + if isCssFilePath path + then retRight $ CssTheme name file [path] + else errMessage "file extension isn't .css" path + where + name = takeBaseName path + file = takeFileName path + + +directoryTheme :: FilePath -> IO (Either String CssTheme) +directoryTheme path = do + items <- getDirectoryItems path + case filter isCssFilePath items of + [] -> errMessage "no .css file in theme directory" path + [cf] -> retRight $ CssTheme (takeBaseName path) (takeFileName cf) items + _ -> errMessage "more than one .css file in theme directory" path + + +getDirectoryItems :: FilePath -> IO [FilePath] +getDirectoryItems path = + getDirectoryContents path >>= return . map (combine path) + + +isCssFilePath :: FilePath -> Bool +isCssFilePath path = takeExtension path == ".css" + + +-------------------------------------------------------------------------------- +-- * Style Sheet Utilities +-------------------------------------------------------------------------------- + +cssFiles :: Themes -> [String] +cssFiles ts = nub $ concatMap themeFiles ts + + +styleSheet :: Themes -> Html +styleSheet ts = toHtml $ zipWith mkLink rels ts hunk ./src/Haddock/Backends/Xhtml/Themes.hs 156 - mkLink (CssTheme aTitle aRef _) aRel = - (thelink ! [href aRef, rel aRel, thetype "text/css", XHtml.title aTitle]) noHtml + mkLink aRel t = + thelink + ! [ href (themeHref t), rel aRel, thetype "text/css", + XHtml.title (themeName t) + ] + << noHtml hunk ./src/Haddock/Backends/Xhtml/Themes.hs 163 -stylePickers :: [Html] -stylePickers = map mkPicker themes + +stylePickers :: Themes -> [Html] +stylePickers ts = map mkPicker ts hunk ./src/Haddock/Backends/Xhtml/Themes.hs 167 - mkPicker (CssTheme aTitle aRef _) = - let js = "setActiveStyleSheet('" ++ aRef ++ "'); return false;" in - anchor ! [href "#", onclick js] << aTitle + mkPicker t = + let js = "setActiveStyleSheet('" ++ themeHref t ++ "'); return false;" in + anchor ! [href "#", onclick js] << themeName t + hunk ./src/Haddock/Backends/Xhtml/Themes.hs 172 -styleMenu :: Html -styleMenu = thediv ! [identifier "style-menu-holder"] << [ +styleMenu :: Themes -> Html +styleMenu [] = noHtml +styleMenu [_] = noHtml +styleMenu ts = thediv ! [identifier "style-menu-holder"] << [ hunk ./src/Haddock/Backends/Xhtml/Themes.hs 177 - unordList stylePickers ! [ identifier "style-menu", theclass "hide" ] + unordList (stylePickers ts) ! [ identifier "style-menu", theclass "hide" ] hunk ./src/Haddock/Backends/Xhtml/Themes.hs 181 + + +-------------------------------------------------------------------------------- +-- * Either Utilities +-------------------------------------------------------------------------------- + +-- These three routines are here because Haddock does not have access to the +-- Control.Monad.Error module which supplies the Functor and Monad instances +-- for Either String. + +sequenceEither :: [Either a b] -> Either a [b] +sequenceEither es = maybe (Right $ rights es) Left (listToMaybe (lefts es)) + +liftEither :: (b -> c) -> Either a b -> Either a c +liftEither f = either Left (Right . f) + +concatEither :: [Either a [b]] -> Either a [b] +concatEither = liftEither concat . sequenceEither + hunk ./src/Haddock/Options.hs 45 + | Flag_DefaultThemes hunk ./src/Haddock/Options.hs 56 + | Flag_Themes String hunk ./src/Haddock/Options.hs 116 - Option ['c'] ["css"] (ReqArg Flag_CSS "FILE") - "the CSS file to use for HTML output", + Option ['c'] ["css"] (ReqArg Flag_CSS "PATH") + "the CSS file or theme directory to use for HTML output", + Option [] ["themes"] (ReqArg Flag_Themes "DIR") + "a directory of CSS files or themes to use for HTML output", + Option [] ["default-themes"] (NoArg Flag_DefaultThemes) + "include all the available haddock themes", hunk ./src/Haddock/Utils.hs 25 - cssFile, iconFile, jsFile, plusFile, minusFile, framesFile, + jsFile, plusFile, minusFile, framesFile, hunk ./src/Haddock/Utils.hs 260 -cssFile, iconFile, jsFile, plusFile, minusFile, framesFile :: String -cssFile = "haddock.css" -iconFile = "haskell_icon.gif" +jsFile, plusFile, minusFile, framesFile :: String hunk ./src/Main.hs 22 +import Haddock.Backends.Xhtml.Themes (getThemes) hunk ./src/Main.hs 183 - css_file = optCssFile flags hunk ./src/Main.hs 198 + themes <- getThemes libDir flags >>= either bye return hunk ./src/Main.hs 202 - opt_contents_url opt_source_urls opt_wiki_urls + themes opt_contents_url opt_source_urls opt_wiki_urls hunk ./src/Main.hs 204 - copyHtmlBits odir libDir css_file + copyHtmlBits odir libDir themes hunk ./src/Main.hs 208 - opt_index_url opt_source_urls opt_wiki_urls + themes opt_index_url opt_source_urls opt_wiki_urls hunk ./src/Main.hs 210 - copyHtmlBits odir libDir css_file + copyHtmlBits odir libDir themes hunk ./src/Main.hs 215 - opt_source_urls opt_wiki_urls + themes opt_source_urls opt_wiki_urls hunk ./src/Main.hs 217 - copyHtmlBits odir libDir css_file + copyHtmlBits odir libDir themes hunk ./src/Haddock/Backends/Xhtml/Themes.hs 23 +import Data.Char (toLower) hunk ./src/Haddock/Backends/Xhtml/Themes.hs 26 -import Data.Maybe (listToMaybe) +import Data.Maybe (isJust, listToMaybe) hunk ./src/Haddock/Backends/Xhtml/Themes.hs 63 + hunk ./src/Haddock/Backends/Xhtml/Themes.hs 68 + +findTheme :: Themes -> String -> Maybe CssTheme +findTheme ts s = listToMaybe $ filter ((== ls).lower.themeName) ts + where lower = map toLower + ls = lower s + + +isThemeName :: Themes -> String -> Bool +isThemeName ts = isJust . findTheme ts + + +builtInTheme :: Themes -> String -> Either String CssTheme +builtInTheme ts = maybe (Left "not found") Right . findTheme ts + + hunk ./src/Haddock/Backends/Xhtml/Themes.hs 87 +type PossibleTheme = Either String CssTheme + hunk ./src/Haddock/Backends/Xhtml/Themes.hs 95 - hunk ./src/Haddock/Backends/Xhtml/Themes.hs 96 - - themeFlag (Flag_Themes path) = do - itsADirectory <- doesDirectoryExist path - if itsADirectory - then do - items <- getDirectoryItems path - themes <- mapM theme items - case rights themes of - [] -> errMessage "no themes found in" path - ts -> retRight ts - else errMessage "not a valid theme directory" path - - themeFlag (Flag_DefaultThemes) = retRight (defaultThemes libDir) + themeFlag (Flag_DefaultThemes) = retRight builtIns hunk ./src/Haddock/Backends/Xhtml/Themes.hs 99 - theme :: FilePath -> IO (Either String CssTheme) - theme path = do - itsAFile <- doesFileExist path - if itsAFile - then singleFileTheme path - else do - itsADirectory <- doesDirectoryExist path - if itsADirectory - then directoryTheme path - else errMessage "css path doesn't exist" path + theme :: FilePath -> IO PossibleTheme + theme path = pick path + [(doesFileExist, singleFileTheme), + (doesDirectoryExist, directoryTheme), + (return . isThemeName builtIns, return . builtInTheme builtIns)] + "css theme path not found" + + pick :: FilePath + -> [(FilePath -> IO Bool, FilePath -> IO PossibleTheme)] -> String + -> IO PossibleTheme + pick path [] msg = errMessage msg path + pick path ((test,build):opts) msg = do + pass <- test path + if pass then build path else pick path opts msg hunk ./src/Haddock/Backends/Xhtml/Themes.hs 118 + builtIns = defaultThemes libDir + + hunk ./src/Haddock/Backends/Xhtml/Themes.hs 166 -styleSheet ts = toHtml $ zipWith mkLink rels ts +styleSheet ts = toHtml $ zipWith mkLink rels ts hunk ./src/Haddock/Options.hs 56 - | Flag_Themes String hunk ./src/Haddock/Options.hs 115 - Option ['c'] ["css"] (ReqArg Flag_CSS "PATH") + Option ['c'] ["css", "theme"] (ReqArg Flag_CSS "PATH") hunk ./src/Haddock/Options.hs 117 - Option [] ["themes"] (ReqArg Flag_Themes "DIR") - "a directory of CSS files or themes to use for HTML output", hunk ./src/Haddock/Options.hs 118 - "include all the available haddock themes", + "include all the built-in haddock themes", hunk ./src/Haddock/Backends/Xhtml/Themes.hs 96 - themeFlag (Flag_DefaultThemes) = retRight builtIns + themeFlag (Flag_BuiltInThemes) = retRight builtIns hunk ./src/Haddock/Options.hs 41 - = Flag_CSS String + = Flag_BuiltInThemes + | Flag_CSS String hunk ./src/Haddock/Options.hs 46 - | Flag_DefaultThemes hunk ./src/Haddock/Options.hs 117 - Option [] ["default-themes"] (NoArg Flag_DefaultThemes) + Option [] ["built-in-themes"] (NoArg Flag_BuiltInThemes) hunk ./html/nhaddock.css 54 +h1 + h2, h2 + h3, h3 + h4, h4 + h5, h5 + h6 { + margin-top: inherit; +} + hunk ./html/nhaddock.css 138 -.info { +dl.info { hunk ./html/nhaddock.css 140 - background: rgb(239,238,209); hunk ./html/nhaddock.css 141 - margin-right: 0.5em; - margin-top: 1.5em; - border: 1px solid rgba(196,69,29,0.2); + border: 1px solid #ddd; + font-size: 75%; + color: rgb(78,98,114); + background-color: #fff; + max-width: 20em; + margin-top: -6em; + margin-bottom: 1em; hunk ./html/nhaddock.css 150 -.info dd { margin-left: 2em; } +dl.info dt { + float: left; + width: 5em; + font-weight: bold; + display: block; +} + +dl.info dd { + display: block; + padding-left: 6em; +} hunk ./html/nhaddock.css 212 + clear: right; hunk ./html/nhaddock.css 220 + max-width: 20em; hunk ./html/nhaddock.css 252 -#interface td { vertical-align: top; } +#interface td { + vertical-align: top; + padding-left: 0.5em; +} hunk ./html/nhaddock.css 77 -.show { } +.show { display: inherit; } +.clear { clear: both; } hunk ./html/nhaddock.css 264 +#interface dt { + float: left; + clear: left; + display: block; + margin: 1px 0; +} + +#interface dd { + float: right; + width: 90%; + display: block; + margin: 1px 0; + padding-left: 0.5em; +} + +#interface dd p { + margin: 0; +} + hunk ./html/nhaddock.css 311 +/* this seems bulky to me hunk ./html/nhaddock.css 316 +*/ hunk ./src/Haddock/Backends/Xhtml/Layout.hs 117 -subDlist decls = Just $ dlist << map subEntry decls +subDlist decls = Just $ dlist << map subEntry decls +++ clearDiv hunk ./src/Haddock/Backends/Xhtml/Layout.hs 126 + + clearDiv = thediv ! [ theclass "clear" ] << noHtml hunk ./html/nhaddock.css 84 + overflow: auto; hunk ./html/nhaddock.css 92 - white-space: nowrap; hunk ./html/nhaddock.css 100 -.keyword { font-weight: bold; } +.keyword { font-weight: normal; } hunk ./html/nhaddock.css 257 +#interface td.src { + white-space: nowrap; +} hunk ./html/nhaddock.css 327 +#mini { + font-size: 75%; +} + +#mini #module-header .caption { + font-size: 160%; +} + hunk ./html/nhaddock.css 338 -#mini #interface h4 -{ - margin-bottom: 0; +#mini #interface h4 { + font-size: 130%; + margin: 1em 0 0; hunk ./html/nhaddock.css 342 + hunk ./html/nhaddock.css 348 +#mini #interface .src { + font-size: 120%; +} + hunk ./html/nhaddock.css 243 - display: none; + position: fixed; + right: -21.5em; + font-size: 90%; + width: 22em; + height: 80%; + top: 5em; + padding: 0; + background-color: #fcfcb0; +} + +#synopsis:hover { + right: 0; + background: none; +} + +#synopsis .caption, +#synopsis ul, +#synopsis ul li.src { + background-color: #fcfcb0; + white-space: nowrap; +} + +#synopsis > * { + margin: 0 0 0 8px; + border-left: 1px solid rgb(196,69,29); +} + +#synopsis .caption { + border-top: 1px solid rgb(196,69,29); + padding-top: 0.5em; + padding-bottom: 0.5em; + text-align: center; +} + +#synopsis ul { + list-style: none; + height: 100%; + overflow: auto; + border-bottom: 1px solid rgb(196,69,29); + padding-left: 0.5em; +} + +#synopsis ul ul { + border: none; + overflow: hidden; hunk ./html/nhaddock.css 16 - margin: 0 auto; - max-width: 50em; hunk ./html/nhaddock.css 18 - padding: 0 1em; hunk ./html/nhaddock.css 111 +#content { + max-width: 50em; + margin: 0 auto; + padding: 0 1em; +} + hunk ./html/nhaddock.css 118 - background: rgb(41,56,69) url(hslogo-16.png) no-repeat 5px; + background: rgb(41,56,69); hunk ./html/nhaddock.css 126 -#package-header a:link, #package-header a:visited { color: white; } -#package-header a:hover { background: rgb(78,98,114); } hunk ./html/nhaddock.css 127 + background: url(hslogo-16.png) no-repeat 0em; hunk ./html/nhaddock.css 129 - margin: 0 0 0 30px; + max-width: 48em; + margin: 0 auto; hunk ./html/nhaddock.css 133 + padding-left: 2em; hunk ./html/nhaddock.css 136 +#package-header a:link, #package-header a:visited { color: white; } +#package-header a:hover { background: rgb(78,98,114); } + hunk ./html/nhaddock.css 180 - background: rgb(41,56,69); -/* background-color: #eaeaea; */ + background: #374c5e; hunk ./html/nhaddock.css 182 - width: 6em; hunk ./html/nhaddock.css 184 - padding: 0 2px 1px; - border-left: 1px solid #919191; - border-right: 1px solid #919191; - border-bottom: 1px solid #919191; + padding: 0; + top: 1.25em; hunk ./html/nhaddock.css 192 - padding: 3px; + padding: 0; hunk ./html/nhaddock.css 201 +#style-menu a { + width: 6em; + padding: 3px; + display: block; +} + hunk ./html/nhaddock.css 225 - font-size: 75%; + font-size: 80%; hunk ./html/nhaddock.css 259 - background-color: #fcfcb0; + background-color: #fff2b2; hunk ./html/nhaddock.css 270 - background-color: #fcfcb0; + background-color: #fff2b2; hunk ./html/nhaddock.css 331 - margin: 1px 0; hunk ./html/nhaddock.css 332 + margin-bottom: 0.5em; hunk ./html/nhaddock.css 363 +.arguments { + margin-top: -0.4em; +} +.arguments .caption { + display: none; +} + +.fields { padding-left: 1em; } + hunk ./html/nhaddock.css 383 -.fields { padding-left: 1em; } - hunk ./html/nhaddock.css 389 + margin: 0 auto; + padding: 0 1em; hunk ./src/Haddock/Backends/Xhtml/Layout.hs 112 -{- - if we ever decide to style sub-declarations with dl lists, this code does it hunk ./src/Haddock/Backends/Xhtml/Layout.hs 126 --} hunk ./src/Haddock/Backends/Xhtml/Layout.hs 157 -subFields = divSubDecls "fields" "Fields" . subTable +subFields = divSubDecls "fields" "Fields" . subDlist hunk ./src/Haddock/Options.hs 95 - Option ['h'] ["html", "xhtml"] (NoArg Flag_Html) + Option ['h'] ["html"] (NoArg Flag_Html) hunk ./src/Main.hs 154 - when (any (`elem` [Flag_Html, Flag_Xhtml, Flag_Hoogle, Flag_LaTeX]) flags) $ + when (any (`elem` [Flag_Html, Flag_Hoogle, Flag_LaTeX]) flags) $ hunk ./src/Main.hs 346 - when ((Flag_GenIndex `elem` flags || Flag_GenContents `elem` flags) - && Flag_Xhtml `elem` flags) $ - throwE "--xhtml cannot be used with --gen-index or --gen-contents" - hunk ./html/haddock-util.js 2 -function toggle(button,id) + +function makeClassToggle(cOn, cOff) +{ + var rOn = new RegExp('\\b'+cOn+'\\b'); + var rOff = new RegExp('\\b'+cOff+'\\b'); + + return function(e, a) { + var c = e.className; + if (a == null) { a = rOff.test(c); } + if (a) { c = c.replace(rOff, cOn); } + else { c = c.replace(rOn, cOff); } + e.className = c; + } +} + +toggleClassShow = makeClassToggle("show", "hide"); +toggleClassCollapser = makeClassToggle("collapser", "expander"); + +function toggleSection(toggler,id) hunk ./html/haddock-util.js 22 - var n = document.getElementById(id).style; - if (n.display == "none") - { - button.src = "minus.gif"; - n.display = "block"; - } - else - { - button.src = "plus.gif"; - n.display = "none"; - } + toggleClassShow(document.getElementById(id)) + toggleClassCollapser(toggler); hunk ./html/haddock-util.js 184 - if (show == null) { show = m.className == "hide"; } - m.className = show ? "show" : "hide"; + toggleClassShow(m, show); hunk ./html/nhaddock.css 77 +.collapser { + background: url(minus.gif) no-repeat 0 0.4em; +} +.expander { + background: url(plus.gif) no-repeat 0 0.4em; +} +.collapser, .expander { + padding-left: 14px; + margin-left: -14px; + cursor: pointer; +} + hunk ./html/shaddock.css 145 +.collapser { + background: url(minus.gif) no-repeat 0 17px; +} +.expander { + background: url(plus.gif) no-repeat 0 17px; +} +.subs .collapser, .subs .expander { + padding-left: 14px; + margin-left: -14px; + cursor: pointer; +} hunk ./html/thaddock.css 230 +.collapser { + background: url(minus.gif) no-repeat 0 1.3em; +} +.expander { + background: url(plus.gif) no-repeat 0 1.3em; +} +.collapser, .expander { + padding-left: 14px; + margin-left: -14px; + cursor: pointer; +} hunk ./html/xhaddock.css 103 +.collapser { + background: url(minus.gif) no-repeat 0 0.3em; +} +.expander { + background: url(plus.gif) no-repeat 0 0.3em; +} +.collapser, .expander { + padding-left: 14px; + cursor: pointer; +} hunk ./src/Haddock/Backends/Xhtml/Layout.hs 161 -subInstances id_ = divSubDecls "instances" instCaption . instTable +subInstances id_ = maybe noHtml wrap . instTable hunk ./src/Haddock/Backends/Xhtml/Layout.hs 163 - instCaption = collapsebutton id_ +++ " Instances" - instTable = fmap (thediv ! [identifier id_] <<) . subTable + wrap = (subSection <<) . (subCaption +++) + instTable = fmap (thediv ! [identifier id_, theclass "show"] <<) . subTable + subSection = thediv ! [theclass $ "subs instances"] + subCaption = paragraph ! [theclass cs, onclick js] << "Instances" + cs = "caption collapser" + js = "toggleSection(this,'" ++ id_ ++ "')" adddir ./html/themes adddir ./html/themes/Classic move ./html/haskell_icon.gif ./html/themes/Classic/haskell_icon.gif adddir ./html/themes/Ocean move ./html/hslogo-16.png ./html/themes/Ocean/hslogo-16.png move ./html/minus.gif ./html/themes/Classic/minus.gif move ./html/nhaddock.css ./html/themes/Ocean/ocean.css move ./html/plus.gif ./html/themes/Classic/plus.gif adddir ./html/themes/Snappy move ./html/s_haskell_icon.gif ./html/themes/Snappy/s_haskell_icon.gif move ./html/shaddock.css ./html/themes/Snappy/snappy.css adddir ./html/themes/Tibbe move ./html/thaddock.css ./html/themes/Tibbe/tibbe.css move ./html/xhaddock.css ./html/themes/Classic/xhaddock.css hunk ./haddock.cabal 53 - html/haddock-DEBUG.css - html/haddock.css - html/haddock-util.js - html/haskell_icon.gif - html/minus.gif - html/plus.gif hunk ./haddock.cabal 54 + html/haddock-util.js + html/themes/Classic/haskell_icon.gif + html/themes/Classic/minus.gif + html/themes/Classic/plus.gif + html/themes/Classic/xhaddock.css + html/themes/Ocean/hslogo-16.png + html/themes/Ocean/minus.gif + html/themes/Ocean/ocean.css + html/themes/Ocean/plus.gif + html/themes/Snappy/minus.gif + html/themes/Snappy/plus.gif + html/themes/Snappy/s_haskell_icon.gif + html/themes/Snappy/snappy.css + html/themes/Tibbe/haskell_icon.gif + html/themes/Tibbe/minus.gif + html/themes/Tibbe/plus.gif + html/themes/Tibbe/tibbe.css hunk ./html/haddock-DEBUG.css 1 -/* -------- Global things --------- */ - -BODY { - background-color: #ffffff; - color: #000000; - font-family: sans-serif; - } - -A:link { color: #0000e0; text-decoration: none } -A:visited { color: #0000a0; text-decoration: none } -A:hover { background-color: #e0e0ff; text-decoration: none } - -TABLE.vanilla { - width: 100%; - border-width: 0px; - background-color: #ffe0e0; - /* I can't seem to specify cellspacing or cellpadding properly using CSS... */ -} - -TD { - border-width: 0px; -} - -TABLE.narrow { - border-width: 0px; -} - -/* --------- Documentation elements ---------- */ - -TD.children { - padding-left: 25px; - } - -TD.synopsis { - padding: 2px; - background-color: #f0f0f0; - font-family: monospace - } - -TD.decl { - padding: 2px; - background-color: #f0f0f0; - font-family: monospace; - white-space: nowrap; - vertical-align: top; - } - -TD.recfield { padding-left: 20px } - -TD.doc { - padding-top: 2px; - padding-left: 10px; - background-color: #e0ffe0; - } - -TD.ndoc { - padding: 2px; - background-color: #e0ffe0; - } - -TD.rdoc { - padding: 2px; - padding-left: 10px; - background-color: #e0ffe0; - width: 100%; - } - -TD.body { - padding-left: 10px - } - -/* ------- Section Headings ------- */ - -TD.section1 { - padding-top: 15px; - font-weight: bold; - font-size: 150% - } - -TD.section2 { - padding-top: 10px; - font-weight: bold; - font-size: 130% - } - -TD.section3 { - padding-top: 5px; - font-weight: bold; - font-size: 110% - } - -TD.section4 { - font-weight: bold; - font-size: 100% - } - -/* -------------- The title bar at the top of the page */ - -TD.infohead { - color: #ffffff; - font-weight: bold; - padding-right: 10px; - text-align: left; -} - -TD.infoval { - color: #ffffff; - padding-right: 10px; - text-align: left; -} - -TD.topbar { - background-color: #000099; - padding: 5px; -} - -TD.title { - color: #ffffff; - padding-left: 10px; - width: 100% - } - -TD.topbut { - padding-left: 5px; - padding-right: 5px; - border-left-width: 1px; - border-left-color: #ffffff; - border-left-style: solid; - white-space: nowrap; - } - -TD.topbut A:link { - color: #ffffff - } - -TD.topbut A:visited { - color: #ffff00 - } - -TD.topbut A:hover { - background-color: #6060ff; - } - -TD.topbut:hover { - background-color: #6060ff - } - -TD.modulebar { - background-color: #0077dd; - padding: 5px; - border-top-width: 1px; - border-top-color: #ffffff; - border-top-style: solid; - } - -/* --------- The page footer --------- */ - -TD.botbar { - background-color: #000099; - color: #ffffff; - padding: 5px - } -TD.botbar A:link { - color: #ffffff; - text-decoration: underline - } -TD.botbar A:visited { - color: #ffff00 - } -TD.botbar A:hover { - background-color: #6060ff - } - rmfile ./html/haddock-DEBUG.css hunk ./html/haddock.css 1 -/* -------- Global things --------- */ - -BODY { - background-color: #ffffff; - color: #000000; - font-family: sans-serif; - padding: 0 0; - } - -A:link { color: #0000e0; text-decoration: none } -A:visited { color: #0000a0; text-decoration: none } -A:hover { background-color: #e0e0ff; text-decoration: none } - -TABLE.vanilla { - width: 100%; - border-width: 0px; - /* I can't seem to specify cellspacing or cellpadding properly using CSS... */ -} - -TABLE.vanilla2 { - border-width: 0px; -} - -/* font is a little too small in MSIE */ -TT { font-size: 100%; } -PRE { font-size: 100%; } - -LI P { margin: 0pt } - -TD { - border-width: 0px; -} - -TABLE.narrow { - border-width: 0px; -} - -TD.s8 { height: 8px; } -TD.s15 { height: 15px; } - -SPAN.keyword { text-decoration: underline; } - -/* Resize the buttom image to match the text size */ -IMG.coll { width : 0.75em; height: 0.75em; margin-bottom: 0; margin-right: 0.5em } - -/* --------- Contents page ---------- */ - -DIV.node { - padding-left: 3em; -} - -DIV.cnode { - padding-left: 1.75em; -} - -SPAN.pkg { - position: absolute; - left: 50em; -} - -/* --------- Documentation elements ---------- */ - -TD.children { - padding-left: 25px; - } - -TD.synopsis { - padding: 2px; - background-color: #f0f0f0; - font-family: monospace - } - -TD.decl { - padding: 2px; - background-color: #f0f0f0; - font-family: monospace; - vertical-align: top; - } - -TD.topdecl { - padding: 2px; - background-color: #f0f0f0; - font-family: monospace; - vertical-align: top; -} - -TABLE.declbar { - border-spacing: 0px; - } - -TD.declname { - width: 100%; - } - -TD.declbut { - padding-left: 5px; - padding-right: 5px; - border-left-width: 1px; - border-left-color: #000099; - border-left-style: solid; - white-space: nowrap; - font-size: small; - } - -/* - arg is just like decl, except that wrapping is not allowed. It is - used for function and constructor arguments which have a text box - to the right, where if wrapping is allowed the text box squashes up - the declaration by wrapping it. -*/ -TD.arg { - padding: 2px; - background-color: #f0f0f0; - font-family: monospace; - vertical-align: top; - white-space: nowrap; - } - -TD.recfield { padding-left: 20px } - -TD.doc { - padding-top: 2px; - padding-left: 10px; - } - -TD.ndoc { - padding: 2px; - } - -TD.rdoc { - padding: 2px; - padding-left: 10px; - width: 100%; - } - -TD.body { - padding-left: 10px - } - -TD.pkg { - width: 100%; - padding-left: 10px -} - -TABLE.indexsearch TR.indexrow { - display: none; -} -TABLE.indexsearch TR.indexshow { - display: table-row; -} - -TD.indexentry { - vertical-align: top; - padding-right: 10px - } - -TD.indexannot { - vertical-align: top; - padding-left: 20px; - white-space: nowrap - } - -TD.indexlinks { - width: 100% - } - -/* ------- Section Headings ------- */ - -TD.section1 { - padding-top: 15px; - font-weight: bold; - font-size: 150% - } - -TD.section2 { - padding-top: 10px; - font-weight: bold; - font-size: 130% - } - -TD.section3 { - padding-top: 5px; - font-weight: bold; - font-size: 110% - } - -TD.section4 { - font-weight: bold; - font-size: 100% - } - -/* -------------- The title bar at the top of the page */ - -TD.infohead { - color: #ffffff; - font-weight: bold; - padding-right: 10px; - text-align: left; -} - -TD.infoval { - color: #ffffff; - padding-right: 10px; - text-align: left; -} - -TD.topbar { - background-color: #000099; - padding: 5px; -} - -TD.title { - color: #ffffff; - padding-left: 10px; - width: 100% - } - -TD.topbut { - padding-left: 5px; - padding-right: 5px; - border-left-width: 1px; - border-left-color: #ffffff; - border-left-style: solid; - white-space: nowrap; - } - -TD.topbut A:link { - color: #ffffff - } - -TD.topbut A:visited { - color: #ffff00 - } - -TD.topbut A:hover { - background-color: #6060ff; - } - -TD.topbut:hover { - background-color: #6060ff - } - -TD.modulebar { - background-color: #0077dd; - padding: 5px; - border-top-width: 1px; - border-top-color: #ffffff; - border-top-style: solid; - } - -/* --------- The page footer --------- */ - -TD.botbar { - background-color: #000099; - color: #ffffff; - padding: 5px - } -TD.botbar A:link { - color: #ffffff; - text-decoration: underline - } -TD.botbar A:visited { - color: #ffff00 - } -TD.botbar A:hover { - background-color: #6060ff - } - -/* --------- Mini Synopsis for Frame View --------- */ - -.outer { - margin: 0 0; - padding: 0 0; -} - -.mini-synopsis { - padding: 0.25em 0.25em; -} - -.mini-synopsis H1 { font-size: 130%; } -.mini-synopsis H2 { font-size: 110%; } -.mini-synopsis H3 { font-size: 100%; } -.mini-synopsis H1, .mini-synopsis H2, .mini-synopsis H3 { - margin-top: 0.5em; - margin-bottom: 0.25em; - padding: 0 0; -} - -.mini-synopsis H1 { border-bottom: 1px solid #ccc; } - -.mini-topbar { - font-size: 130%; - background: #0077dd; - padding: 0.25em; -} - - rmfile ./html/haddock.css addfile ./html/themes/Ocean/minus.gif binary ./html/themes/Ocean/minus.gif oldhex * newhex *47494638396109000900910000fefefe8282820202020000002c00000000090009000002118c8f *a00bc6eb5e0b40583b6596f1a11f14003b addfile ./html/themes/Ocean/plus.gif binary ./html/themes/Ocean/plus.gif oldhex * newhex *47494638396109000900910000fefefe8282820202020000002c00000000090009000002148c8f *a00bb6b29c82ca897b5b7871cfce74085200003b addfile ./html/themes/Snappy/minus.gif binary ./html/themes/Snappy/minus.gif oldhex * newhex *47494638396109000900910000fefefe8282820202020000002c00000000090009000002118c8f *a00bc6eb5e0b40583b6596f1a11f14003b addfile ./html/themes/Snappy/plus.gif binary ./html/themes/Snappy/plus.gif oldhex * newhex *47494638396109000900910000fefefe8282820202020000002c00000000090009000002148c8f *a00bb6b29c82ca897b5b7871cfce74085200003b addfile ./html/themes/Tibbe/haskell_icon.gif binary ./html/themes/Tibbe/haskell_icon.gif oldhex * newhex *47494638376110001000f70f00000000800000008000808000000080800080008080c0c0c08080 *80ff000000ff00ffff000000ffff00ff00ffffffffff0000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *0021f90401000000002c000000001000100007086c0001007840b0a0418202073e38b0b021c387 *07143e2440c0a143040e091cd0787021c686151f84347800e343901d4b12646870e44a930d0952 *3ca832a6cc990555b2bc2992e4c79d3847ea2c88b3a7c89a2c8b8aa43874e941a60810003840b5 *aa55aa511346ddca75abc080003b addfile ./html/themes/Tibbe/minus.gif binary ./html/themes/Tibbe/minus.gif oldhex * newhex *47494638396109000900910000fefefe8282820202020000002c00000000090009000002118c8f *a00bc6eb5e0b40583b6596f1a11f14003b addfile ./html/themes/Tibbe/plus.gif binary ./html/themes/Tibbe/plus.gif oldhex * newhex *47494638396109000900910000fefefe8282820202020000002c00000000090009000002148c8f *a00bb6b29c82ca897b5b7871cfce74085200003b hunk ./src/Haddock/Backends/Xhtml.hs 122 - mapM_ copyLibFile [ plusFile, minusFile, jsFile, framesFile ] + mapM_ copyLibFile [ jsFile, framesFile ] hunk ./src/Haddock/Backends/Xhtml/Themes.hs 25 -import Data.List (nub) +import Data.List (nub, partition) hunk ./src/Haddock/Backends/Xhtml/Themes.hs 30 -import Text.XHtml hiding ( name, title, p, quote ) +import Text.XHtml hiding ( name, title, p, quote, () ) hunk ./src/Haddock/Backends/Xhtml/Themes.hs 44 + hunk ./src/Haddock/Backends/Xhtml/Themes.hs 48 --- | Standard theme used by default -standardTheme :: FilePath -> CssTheme -standardTheme libDir = locateIn libDir $ - CssTheme "Ocean" "nhaddock.css" ["nhaddock.css", "hslogo-16.png"] +type PossibleTheme = Either String CssTheme +type PossibleThemes = Either String Themes hunk ./src/Haddock/Backends/Xhtml/Themes.hs 52 --- | Default themes that are part of Haddock; added with --default-themes -defaultThemes :: FilePath -> Themes -defaultThemes libDir = standardTheme libDir : - (map (locateIn libDir) $ [ - CssTheme "Classic" "xhaddock.css" ["xhaddock.css", "haskell_icon.gif"], - CssTheme "Tibbe" "thaddock.css" ["thaddock.css", "haskell_icon.gif"], - CssTheme "Snappy" "shaddock.css" ["shaddock.css", "s_haskell_icon.gif"] - ] - ) +-- | Standard theme used by default +standardTheme :: FilePath -> IO PossibleThemes +standardTheme libDir = liftM (liftEither (take 1)) (defaultThemes libDir) hunk ./src/Haddock/Backends/Xhtml/Themes.hs 57 -locateIn :: FilePath -> CssTheme -> CssTheme -locateIn libDir t = t { themeFiles = map loc (themeFiles t) } - where loc = combine libDir . combine "html" +-- | Default themes that are part of Haddock; added with --default-themes +defaultThemes :: FilePath -> IO PossibleThemes +defaultThemes libDir = do + themeDirs <- getDirectoryItems (libDir "html" "themes") + themes <- mapM directoryTheme themeDirs + return $ liftEither shuffle $ sequenceEither themes + where + shuffle ts = let (a,b) = partition isStd ts in a ++ b + isStd c = themeName c == "Ocean" hunk ./src/Haddock/Backends/Xhtml/Themes.hs 68 -findTheme :: Themes -> String -> Maybe CssTheme -findTheme ts s = listToMaybe $ filter ((== ls).lower.themeName) ts +findTheme :: String -> Themes -> Maybe CssTheme +findTheme s = listToMaybe . filter ((== ls).lower.themeName) hunk ./src/Haddock/Backends/Xhtml/Themes.hs 74 -isThemeName :: Themes -> String -> Bool -isThemeName ts = isJust . findTheme ts - - -builtInTheme :: Themes -> String -> Either String CssTheme -builtInTheme ts = maybe (Left "not found") Right . findTheme ts - - hunk ./src/Haddock/Backends/Xhtml/Themes.hs 78 -type PossibleTheme = Either String CssTheme hunk ./src/Haddock/Backends/Xhtml/Themes.hs 82 - liftM (someTheme . concatEither) (mapM themeFlag flags) + liftM concatEither (mapM themeFlag flags) >>= someTheme hunk ./src/Haddock/Backends/Xhtml/Themes.hs 86 - themeFlag (Flag_BuiltInThemes) = retRight builtIns + themeFlag (Flag_BuiltInThemes) = builtIns hunk ./src/Haddock/Backends/Xhtml/Themes.hs 93 - (return . isThemeName builtIns, return . builtInTheme builtIns)] - "css theme path not found" + (doesBuiltInExist builtIns, builtInTheme builtIns)] + "Theme not found" hunk ./src/Haddock/Backends/Xhtml/Themes.hs 104 - someTheme :: Either String Themes -> Either String Themes - someTheme (Right []) = Right [standardTheme libDir] - someTheme est = est + + someTheme :: Either String Themes -> IO (Either String Themes) + someTheme (Right []) = standardTheme libDir + someTheme est = return est hunk ./src/Haddock/Backends/Xhtml/Themes.hs 113 -errMessage msg path = return (Left (msg ++ ": \"" ++ path ++ "\"")) +errMessage msg path = return (Left msg') + where msg' = "Error: " ++ msg ++ ": \"" ++ path ++ "\"\n" hunk ./src/Haddock/Backends/Xhtml/Themes.hs 121 -singleFileTheme :: FilePath -> IO (Either String CssTheme) +singleFileTheme :: FilePath -> IO PossibleTheme hunk ./src/Haddock/Backends/Xhtml/Themes.hs 125 - else errMessage "file extension isn't .css" path + else errMessage "File extension isn't .css" path hunk ./src/Haddock/Backends/Xhtml/Themes.hs 131 -directoryTheme :: FilePath -> IO (Either String CssTheme) +directoryTheme :: FilePath -> IO PossibleTheme hunk ./src/Haddock/Backends/Xhtml/Themes.hs 135 - [] -> errMessage "no .css file in theme directory" path hunk ./src/Haddock/Backends/Xhtml/Themes.hs 136 - _ -> errMessage "more than one .css file in theme directory" path + [] -> errMessage "No .css file in theme directory" path + _ -> errMessage "More than one .css file in theme directory" path + + +doesBuiltInExist :: IO PossibleThemes -> String -> IO Bool +doesBuiltInExist pts s = pts >>= return . either (const False) test + where test = isJust . findTheme s + + +builtInTheme :: IO PossibleThemes -> String -> IO PossibleTheme +builtInTheme pts s = pts >>= return . either Left fetch + where fetch = maybe (Left ("Unknown theme: " ++ s)) Right . findTheme s hunk ./src/Haddock/Backends/Xhtml/Themes.hs 152 - getDirectoryContents path >>= return . map (combine path) + getDirectoryContents path >>= return . map (combine path) . filter notDot + where notDot s = s /= "." && s /= ".." hunk ./src/Haddock/Backends/Xhtml/Utils.hs 187 - image ! [ src minusFile, theclass "coll", onclick ("toggle(this,'" ++ id_ ++ "')"), alt "show/hide" ] + image ! [ src "minus.gif", theclass "coll", onclick ("toggle(this,'" ++ id_ ++ "')"), alt "show/hide" ] hunk ./src/Haddock/Utils.hs 25 - jsFile, plusFile, minusFile, framesFile, + jsFile, framesFile, hunk ./src/Haddock/Utils.hs 260 -jsFile, plusFile, minusFile, framesFile :: String +jsFile, framesFile :: String hunk ./src/Haddock/Utils.hs 262 -plusFile = "plus.gif" -minusFile = "minus.gif" hunk ./src/Haddock/Backends/Xhtml/Themes.hs 38 -data CssTheme = CssTheme { +data Theme = Theme { hunk ./src/Haddock/Backends/Xhtml/Themes.hs 44 +type Themes = [Theme] hunk ./src/Haddock/Backends/Xhtml/Themes.hs 46 -type Themes = [CssTheme] +type PossibleTheme = Either String Theme +type PossibleThemes = Either String Themes hunk ./src/Haddock/Backends/Xhtml/Themes.hs 50 -type PossibleTheme = Either String CssTheme -type PossibleThemes = Either String Themes +-- | Find a theme by name (case insensitive match) +findTheme :: String -> Themes -> Maybe Theme +findTheme s = listToMaybe . filter ((== ls).lower.themeName) + where lower = map toLower + ls = lower s hunk ./src/Haddock/Backends/Xhtml/Themes.hs 63 +-- First default theme is the standard theme. At present, hard coded to "Ocean" +-- if present. hunk ./src/Haddock/Backends/Xhtml/Themes.hs 75 -findTheme :: String -> Themes -> Maybe CssTheme -findTheme s = listToMaybe . filter ((== ls).lower.themeName) - where lower = map toLower - ls = lower s +-- | Build a theme from a single .css file +singleFileTheme :: FilePath -> IO PossibleTheme +singleFileTheme path = + if isCssFilePath path + then retRight $ Theme name file [path] + else errMessage "File extension isn't .css" path + where + name = takeBaseName path + file = takeFileName path + + +-- | Build a theme from a directory +directoryTheme :: FilePath -> IO PossibleTheme +directoryTheme path = do + items <- getDirectoryItems path + case filter isCssFilePath items of + [cf] -> retRight $ Theme (takeBaseName path) (takeFileName cf) items + [] -> errMessage "No .css file in theme directory" path + _ -> errMessage "More than one .css file in theme directory" path + + +-- | Check if we have a built in theme +doesBuiltInExist :: IO PossibleThemes -> String -> IO Bool +doesBuiltInExist pts s = pts >>= return . either (const False) test + where test = isJust . findTheme s + + +-- | Find a built in theme +builtInTheme :: IO PossibleThemes -> String -> IO PossibleTheme +builtInTheme pts s = pts >>= return . either Left fetch + where fetch = maybe (Left ("Unknown theme: " ++ s)) Right . findTheme s hunk ./src/Haddock/Backends/Xhtml/Themes.hs 112 - hunk ./src/Haddock/Backends/Xhtml/Themes.hs 113 -getThemes :: FilePath -> [Flag] -> IO (Either String Themes) +getThemes :: FilePath -> [Flag] -> IO PossibleThemes hunk ./src/Haddock/Backends/Xhtml/Themes.hs 124 - [(doesFileExist, singleFileTheme), - (doesDirectoryExist, directoryTheme), - (doesBuiltInExist builtIns, builtInTheme builtIns)] + [(doesFileExist, singleFileTheme), + (doesDirectoryExist, directoryTheme), + (doesBuiltInExist builtIns, builtInTheme builtIns)] hunk ./src/Haddock/Backends/Xhtml/Themes.hs 154 -singleFileTheme :: FilePath -> IO PossibleTheme -singleFileTheme path = - if isCssFilePath path - then retRight $ CssTheme name file [path] - else errMessage "File extension isn't .css" path - where - name = takeBaseName path - file = takeFileName path - - -directoryTheme :: FilePath -> IO PossibleTheme -directoryTheme path = do - items <- getDirectoryItems path - case filter isCssFilePath items of - [cf] -> retRight $ CssTheme (takeBaseName path) (takeFileName cf) items - [] -> errMessage "No .css file in theme directory" path - _ -> errMessage "More than one .css file in theme directory" path - - -doesBuiltInExist :: IO PossibleThemes -> String -> IO Bool -doesBuiltInExist pts s = pts >>= return . either (const False) test - where test = isJust . findTheme s - - -builtInTheme :: IO PossibleThemes -> String -> IO PossibleTheme -builtInTheme pts s = pts >>= return . either Left fetch - where fetch = maybe (Left ("Unknown theme: " ++ s)) Right . findTheme s - +-------------------------------------------------------------------------------- +-- * File Utilities +-------------------------------------------------------------------------------- hunk ./src/Haddock/Backends/Xhtml/Themes.hs 218 + hunk ./src/Haddock/Backends/Xhtml/Themes.hs 222 + hunk ./html/themes/Ocean/ocean.css 78 - background: url(minus.gif) no-repeat 0 0.4em; + background-image: url(minus.gif); + background-repeat: no-repeat; hunk ./html/themes/Ocean/ocean.css 82 - background: url(plus.gif) no-repeat 0 0.4em; + background-image: url(plus.gif); + background-repeat: no-repeat; +} +span.module.collapser, +span.module.expander { + background-position: 0 0.3em; +} +p.caption.collapser, +p.caption.expander { + background-position: 0 0.4em; hunk ./html/themes/Snappy/snappy.css 145 + hunk ./html/themes/Snappy/snappy.css 147 - background: url(minus.gif) no-repeat 0 17px; + background-image: url(minus.gif); + background-repeat: no-repeat; hunk ./html/themes/Snappy/snappy.css 151 - background: url(plus.gif) no-repeat 0 17px; + background-image: url(plus.gif); + background-repeat: no-repeat; +} + +span.module.collapser, +span.module.expander { + background-position: 0 6px; +} +p.caption.collapser, +p.caption.expander { + background-position: 0 17px; hunk ./html/themes/Snappy/snappy.css 163 -.subs .collapser, .subs .expander { +#module-list .collapser, +#module-list .expander, +.subs p.caption.collapser, +.subs p.caption.expander { hunk ./html/themes/Tibbe/tibbe.css 230 + hunk ./html/themes/Tibbe/tibbe.css 232 - background: url(minus.gif) no-repeat 0 1.3em; + background-image: url(minus.gif); + background-repeat: no-repeat; hunk ./html/themes/Tibbe/tibbe.css 236 - background: url(plus.gif) no-repeat 0 1.3em; + background-image: url(plus.gif); + background-repeat: no-repeat; +} +span.module.collapser, +span.module.expander { + background-position: 0 0.3em; +} +p.caption.collapser, +p.caption.expander { + background-position: 0 1.3em; hunk ./src/Haddock/Backends/Xhtml.hs 282 - collBtn +++ htmlModule +++ shortDescr +++ htmlPkg +++ subtree + htmlModule +++ shortDescr +++ htmlPkg +++ subtree hunk ./src/Haddock/Backends/Xhtml.hs 284 - collBtn = case ts of - [] -> noHtml - _ -> collapsebutton p + modAttrs = case ts of + [] -> [theclass "module"] + _ -> collapser p "module" hunk ./src/Haddock/Backends/Xhtml.hs 288 - htmlModule = thespan ! [theclass "module" ] << + htmlModule = thespan ! modAttrs << hunk ./src/Haddock/Backends/Xhtml.hs 300 - subtree = mkNodeList (s:ss) p ts ! [identifier p] + subtree = mkNodeList (s:ss) p ts ! [identifier p, theclass "show"] hunk ./src/Haddock/Backends/Xhtml/Layout.hs 166 - subCaption = paragraph ! [theclass cs, onclick js] << "Instances" - cs = "caption collapser" - js = "toggleSection(this,'" ++ id_ ++ "')" + subCaption = paragraph ! collapser id_ "caption" << "Instances" hunk ./src/Haddock/Backends/Xhtml/Utils.hs 28 - collapsebutton, collapseId, + collapser, collapseId, hunk ./src/Haddock/Backends/Xhtml/Utils.hs 185 -collapsebutton :: String -> Html -collapsebutton id_ = - image ! [ src "minus.gif", theclass "coll", onclick ("toggle(this,'" ++ id_ ++ "')"), alt "show/hide" ] +collapser :: String -> String -> [HtmlAttr] +collapser id_ classes = [ theclass cs, onclick js ] + where + cs = unwords (words classes ++ ["collapser"]) + js = "toggleSection(this,'" ++ id_ ++ "')" binary ./html/themes/Tibbe/haskell_icon.gif oldhex *47494638376110001000f70f00000000800000008000808000000080800080008080c0c0c08080 *80ff000000ff00ffff000000ffff00ff00ffffffffff0000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *0021f90401000000002c000000001000100007086c0001007840b0a0418202073e38b0b021c387 *07143e2440c0a143040e091cd0787021c686151f84347800e343901d4b12646870e44a930d0952 *3ca832a6cc990555b2bc2992e4c79d3847ea2c88b3a7c89a2c8b8aa43874e941a60810003840b5 *aa55aa511346ddca75abc080003b newhex * rmfile ./html/themes/Tibbe/haskell_icon.gif binary ./html/themes/Tibbe/minus.gif oldhex *47494638396109000900910000fefefe8282820202020000002c00000000090009000002118c8f *a00bc6eb5e0b40583b6596f1a11f14003b newhex * rmfile ./html/themes/Tibbe/minus.gif binary ./html/themes/Tibbe/plus.gif oldhex *47494638396109000900910000fefefe8282820202020000002c00000000090009000002148c8f *a00bb6b29c82ca897b5b7871cfce74085200003b newhex * rmfile ./html/themes/Tibbe/plus.gif hunk ./html/themes/Tibbe/tibbe.css 1 -html, body { - height:100%; - margin:0; - padding:0; -} - -body { - background-color:#FFFFFF; - color:#000000; - font-family:Helvetica,Arial,sans-serif; - font-size:small; - margin:3px 8px; - - max-width:956px; - padding-left:24px; -} - -#package-header { - background: #eaeaea url(haskell_icon.gif) no-repeat 5px 6px; - height: 2em; - margin: 0 0 0 -10px; - position: relative; -} - -#package-header .caption { - margin-left: 30px; - padding-top: 6px; -} - - - -div#style-menu-holder { - position: relative; - z-index: 2; - display: inline; -} - -#style-menu { - position: absolute; - z-index: 1; - overflow: visible; - background-color: #eaeaea; - margin: 0; - width: 6em; - text-align: center; - right: 0; - padding: 0 2px 1px; - border-left: 1px solid #919191; - border-right: 1px solid #919191; - border-bottom: 1px solid #919191; -} - -#style-menu li { - display: list-item; - border-style: none; - margin: 0; - padding: 3px; - color: #000; - list-style-type: none; -} - -#style-menu li + li { - border-top: 1px solid #919191; -} - -#module-header .caption { - background:transparent none repeat scroll 0 0; - border:medium none; - font-size: 170%; - line-height: 130%; - margin:0 0 0 -10px; - - background-color:#E5ECF9; - border-top:1px solid #3366CC; - padding:1px 3px; - font-weight: bold; - position: relative; -} - - -dl.info { - position: absolute; - display: block; - right: 1em; - top: 3em; - background-color:#FAFAFA; - border:1px solid #BBBBBB; - padding:0.99em; -} - -dl.info dt { - float: left; - clear: left; - width: 5em; - font-weight: bold; - margin: 0; - padding: 0; -} - -dl.info dd { - padding-left: 6em; - margin: 0; -} - -#description .caption, -#synopsis .caption, -h1 { - background-color:#E5ECF9; - border-top:1px solid #3366CC; - font-size:130%; - font-weight:bold; - margin:2em 0 0 -10px; - padding:1px 3px; - position:relative; -} - -#table-of-contents .caption, -h2 { - font-size:130%; - font-weight:bold; - margin:1.5em 0 0; - padding: 0; - top:0; -} - -#synopsis li.src * { - display: inline; -} - -#synopsis ul.subs, -#synopsis ul.subs li { - padding: 0 0 0 0.25em; - margin: 0; -} - -#footer { - color:#666666; - background-color: #eaeaea; - margin: 2em 0 0 -10px; - position: relative; -} - -#footer p { - margin: 0; - padding: 0.5em; - border-top: 1px solid #919191; -} - -ol, ul { - line-height:125%; - margin:0.5em 0 0 15px; - padding:0; -} - -li { - margin:0.3em 0 0 1.5em; - padding:0; -} - -p { - line-height:125%; - margin:0; - padding:1em 0 0; -} - -h1 + p, h2 + p, h3 + p, -pre + p, -p + p { - padding-top: 1em; -} - -code, pre { - color:#007000; - font-family:monospace; -} - -pre { - background-color:#FAFAFA; - border:1px solid #BBBBBB; - font-size:9pt; - line-height:125%; - margin:1em 0 0; - overflow:auto; - padding:0.99em; -} - -code { - font-size:10pt; -} - -a:link { - color:#0000CC; -} - -ul.links { - list-style: none; - position: absolute; - right: 1px; - top: 0; -} - -ul.links li { - display: inline; - white-space: nowrap; - padding: 0 10px; - border-left: 1px solid #919191; - margin: 0; -} - -dl { - line-height:125%; - margin:0; - padding:0; -} - -dt { - font-weight:normal; - margin:0.75em 0 0; - padding:0; -} - -dd { - font-weight:normal; - margin:0.4em 0 0 2em; - padding:0; -} - -.hide { display: none; } -.show { } - -.collapser { - background-image: url(minus.gif); - background-repeat: no-repeat; -} -.expander { - background-image: url(plus.gif); - background-repeat: no-repeat; -} -span.module.collapser, -span.module.expander { - background-position: 0 0.3em; -} -p.caption.collapser, -p.caption.expander { - background-position: 0 1.3em; -} -.collapser, .expander { - padding-left: 14px; - margin-left: -14px; - cursor: pointer; -} - -.top { - margin:0.4em 0 0 2em; - padding:0; -} - -.top .src { - margin:0.75em 0 0 -2em; - padding:0; -} - -.top .subs .src { - margin-left: 0; -} - -.arguments .caption, -.fields .caption { - display: none; -} - -.associated-types, -.constructors, -.methods { - background-color:#FAFAFA; - border:1px solid #BBBBBB; - padding:0.99em; -} - -.subs .caption { - font-weight: bold; -} - -.subs td { - padding-right: 1em; - padding-left: 1em; -} - -#index .caption, -#module-list .caption { - font-size:130%; - font-weight:bold; - padding: 0; - top:0; - margin: 0.5em 0; -} - -#index table { - border-spacing: 0; -} -#index td { - padding-right: 1em; - border-top: 1px solid #eaeaea; - padding-top: 2px; - padding-bottom: 2px; -} - -#index td.alt { - padding-left: 2em; - font-style: italic; - font-size: 80%; -} - -#alphabet ul { - list-style: none; - padding: 0; - margin: 0.5em 0 0; -} - -#alphabet li { - display: inline; - margin: 0 0.25em; -} - -#alphabet a { - text-decoration: none; - font-weight: bold; -} - -.module { -} - -#mini { - padding: 0; - margin: 0 0 0 10px; -} - -#mini h1, #mini h2, #mini h3, #mini h4 { - margin-top: 0.5em; - color: #a9a9a9; -} - -#mini h1 { - background-color: #eff2f9; -} - -#module-list ul { - list-style: none; - padding: 0; - margin: 0; -} - -#module-list li { - margin: 0; - border-top: 1px solid #eaeaea; - padding: 2px 0 2px 1.4em; -} - -#module-list li .package { - float: right; -} - -#mini #interface .top, -#mini #interface .src { - margin-top: 2px; - font-weight: normal; - font-style: normal; -} - -#mini #interface .src a { - font-weight: bold; -} - -.keyword { - font-weight: bold; - font-family: monospace; -} - -#synopsis { - display: none; -} - -td p { - padding-top: 0; -} - -.src { - font-family: monospace; - font-size: larger; -} - -.def { - font-weight: bold; -} rmfile ./html/themes/Tibbe/tibbe.css rmdir ./html/themes/Tibbe move ./html/themes/Classic ./html/Classic.theme move ./html/themes/Ocean ./html/Ocean.std-theme move ./html/themes/Snappy ./html/Snappy.theme rmdir ./html/themes hunk ./src/Haddock/Backends/Xhtml/Themes.hs 25 -import Data.List (nub, partition) +import Data.List (nub) hunk ./src/Haddock/Backends/Xhtml/Themes.hs 63 --- First default theme is the standard theme. At present, hard coded to "Ocean" --- if present. +-- The first theme in this list is considered the standard theme. +-- Themes are "discovered" by scanning the html sub-dir of the libDir, +-- and looking for directories with the extension .theme or .std-theme. +-- The later is, obviously, the standard theme. hunk ./src/Haddock/Backends/Xhtml/Themes.hs 69 - themeDirs <- getDirectoryItems (libDir "html" "themes") - themes <- mapM directoryTheme themeDirs - return $ liftEither shuffle $ sequenceEither themes + themeDirs <- getDirectoryItems (libDir "html") + themes <- mapM directoryTheme $ discoverThemes themeDirs + return $ sequenceEither themes hunk ./src/Haddock/Backends/Xhtml/Themes.hs 73 - shuffle ts = let (a,b) = partition isStd ts in a ++ b - isStd c = themeName c == "Ocean" + discoverThemes paths = + filterExt ".std-theme" paths ++ filterExt ".theme" paths + filterExt ext = filter ((== ext).takeExtension) hunk ./html/Ocean.std-theme/ocean.css 357 +#interface dd.empty { + display: none; +} + hunk ./src/Haddock/Backends/Xhtml.hs 189 - sectionName << nonEmpty doctitle, + nonEmpty sectionName << doctitle, hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 93 -docElement :: (ADDATTRS a) => a -> a -docElement = (! [theclass "doc"]) +docElement :: (Html -> Html) -> Html -> Html +docElement el content_ = + if isNoHtml content_ + then el ! [theclass "doc empty"] << spaceHtml + else el ! [theclass "doc"] << content_ hunk ./src/Haddock/Backends/Xhtml/Layout.hs 120 - docElement ddef << (fmap docToHtml mdoc `with` subs) - - Nothing `with` [] = spaceHtml - ma `with` bs = ma +++ bs - + docElement ddef << (fmap docToHtml mdoc +++ subs) hunk ./src/Haddock/Backends/Xhtml/Layout.hs 131 - docElement td << nonEmpty (fmap docToHtml mdoc)) + docElement td << fmap docToHtml mdoc) hunk ./src/Haddock/Backends/Xhtml/Utils.hs 116 --- | Ensure content contains at least something (a non-breaking space) -nonEmpty :: (HTML a) => a -> Html -nonEmpty a = if isNoHtml h then spaceHtml else h - where h = toHtml a +-- | Make an element that always has at least something (a non-breaking space) +-- If it would have otherwise been empty, then give it the class ".empty" +nonEmpty :: (Html -> Html) -> Html -> Html +nonEmpty el content_ = + if isNoHtml content_ + then el ! [theclass "empty"] << spaceHtml + else el << content_ hunk ./src/Haddock/Backends/Xhtml.hs 35 -import Control.Exception ( bracket ) hunk ./src/Haddock/Backends/Xhtml.hs 40 -import Foreign.Marshal.Alloc ( allocaBytes ) hunk ./src/Haddock/Backends/Xhtml.hs 41 -import System.IO ( IOMode(..), hClose, hGetBuf, hPutBuf, openFile ) -import System.Directory hiding ( copyFile ) +import System.Directory hunk ./src/Haddock/Backends/Xhtml.hs 94 -copyFile :: FilePath -> FilePath -> IO () -copyFile fromFPath toFPath = - (bracket (openFile fromFPath ReadMode) hClose $ \hFrom -> - bracket (openFile toFPath WriteMode) hClose $ \hTo -> - allocaBytes bufferSize $ \buffer -> - copyContents hFrom hTo buffer) - where - bufferSize = 1024 - - copyContents hFrom hTo buffer = do - count <- hGetBuf hFrom buffer bufferSize - when (count > 0) $ do - hPutBuf hTo buffer count - copyContents hFrom hTo buffer - - hunk ./html/Ocean.std-theme/ocean.css 7 -/* background-color: #f4f7f9; */ hunk ./html/Ocean.std-theme/ocean.css 34 -/* a:hover { background: #D9CBB8; } */ - hunk ./html/Ocean.std-theme/ocean.css 45 - margin-top: 4em; + margin-top: 2em; hunk ./html/Ocean.std-theme/ocean.css 63 -/* border-left: 1px solid rgb(78,98,114); */ + border-left: 1px solid rgb(78,98,114); hunk ./html/Ocean.std-theme/ocean.css 98 - margin: 0.5em 5em 0.5em 3em; +/* margin: 0.5em 5em 0.5em 3em; */ + margin: 0.5em 0 0.5em; hunk ./html/Ocean.std-theme/ocean.css 248 - top: 0em; /* use -5em to pull up into title area */ + top: 0em; hunk ./html/Ocean.std-theme/ocean.css 363 -/* div.top code { border: 1px solid #ddd; } */ hunk ./html/Ocean.std-theme/ocean.css 55 - position: absolute; - right: 5px; - top: 5px; + float: right; hunk ./html/Ocean.std-theme/ocean.css 57 + margin-left: 1em; hunk ./html/Ocean.std-theme/ocean.css 67 -ul.links li a { padding: 5px 10px; } +ul.links li a { + padding: 0.2em 0.5em; +} hunk ./html/Ocean.std-theme/ocean.css 142 - padding: 5px; + padding: 0.2em; hunk ./html/Ocean.std-theme/ocean.css 174 - max-width: 20em; - margin-top: -6em; - margin-bottom: 1em; + max-width: 40%; + margin: -1em 0 1em 1em; hunk ./src/Haddock/Backends/Xhtml.hs 170 - nonEmpty sectionName << doctitle, hunk ./src/Haddock/Backends/Xhtml.hs 175 - ] ++ [styleMenu themes]) ! [theclass "links"] + ] ++ [styleMenu themes]) ! [theclass "links"], + nonEmpty sectionName << doctitle hunk ./src/Haddock/Backends/Xhtml.hs 456 - divModuleHeader << (sectionName << mdl_str +++ moduleInfo iface), + divModuleHeader << (moduleInfo iface +++ (sectionName << mdl_str)), hunk ./html/Ocean.std-theme/ocean.css 325 +#interface p.src .link { + float: right; + color: #919191; + border-left: 1px solid #919191; + background: #f0f0f0; + padding: 0 0.5em 0.2em; + margin: 0 -0.5em 0 0.5em; +} + hunk ./html/Classic.theme/xhaddock.css 86 - position: absolute; - right: 5px; - top: 5px; + float: right; hunk ./html/Classic.theme/xhaddock.css 88 + padding: 0; hunk ./html/Classic.theme/xhaddock.css 161 - position: relative; hunk ./html/Classic.theme/xhaddock.css 165 - height: 1.5em; - padding-top: .25em; + padding: .25em 0; hunk ./html/Classic.theme/xhaddock.css 173 - position: absolute; - top: 3px; - right: 5px; + float: right; + width: 50%; hunk ./html/Classic.theme/xhaddock.css 265 - padding: 0 4px 2px 5px; + padding: 0 8px 2px 5px; + margin-right: -3px; + background-color: #f0f0f0; hunk ./html/Classic.theme/xhaddock.css 285 -.subs dt { - float: left; - margin-right: 1em; - clear: left; -} - hunk ./html/Classic.theme/xhaddock.css 287 - margin-bottom: 2px; - margin-top: 2px; + margin: 2px 0 9px 2em; +} + +.subs dd.empty { + display: none; hunk ./html/Snappy.theme/snappy.css 131 - list-style: none; - position: absolute; - right: 1px; - top: 0; - margin: 0; + list-style: none; + float: right; + margin: 0 0 0 0.5em; + font-size: 80%; hunk ./html/Snappy.theme/snappy.css 321 - display: none; + float: right; + margin: 0; + font-size: 80%; +} + +#module-header .info dt { + float: left; + width: 6em; + font-weight: bold; +} + +#module-header .info dd { + margin-left: 6em; hunk ./html/Snappy.theme/snappy.css 376 -#interface p + div { - margin-top: -15px +.src a.link { + float: right; + border-left-width: 1px; + border-left-color: #000099; + border-left-style: solid; + white-space: nowrap; + padding: 0 4px;; hunk ./html/Snappy.theme/snappy.css 384 +#interface p + div { + margin-top: -8px} hunk ./html/Snappy.theme/snappy.css 391 +dd.empty { + display: none; +} + +.subs .subs { + margin-left: 2em; +} hunk ./html/Snappy.theme/snappy.css 408 - hunk ./src/Haddock/Backends/Xhtml.hs 174 - indexButton maybe_index_url - ] ++ [styleMenu themes]) ! [theclass "links"], + indexButton maybe_index_url, + styleMenu themes]) ! [theclass "links"], hunk ./src/Haddock/Backends/Xhtml/Themes.hs 199 -styleMenu :: Themes -> Html -styleMenu [] = noHtml -styleMenu [_] = noHtml -styleMenu ts = thediv ! [identifier "style-menu-holder"] << [ +styleMenu :: Themes -> Maybe Html +styleMenu [] = Nothing +styleMenu [_] = Nothing +styleMenu ts = Just $ thediv ! [identifier "style-menu-holder"] << [ hunk ./haddock.cabal 127 + Haddock.Backends.Xhtml.Themes hunk ./src/Haddock/InterfaceFile.hs 106 - seekBin bh symtab_p + seekBin bh symtab_p hunk ./ghc.mk 8 +utils/haddock_dist_INSTALL_SHELL_WRAPPER_NAME = haddock-$(ProjectVersion) hunk ./ghc.mk 43 +ifeq "$(Windows)" "NO" +install: install_haddock_link +.PNONY: install_haddock_link +install_haddock_link: + "$(RM)" $(RM_OPTS) "$(DESTDIR)$(bindir)/haddock" + $(LN_S) haddock-$(ProjectVersion) "$(DESTDIR)$(bindir)/haddock" +endif + hunk ./haddock.cabal 55 - html/themes/Classic/haskell_icon.gif - html/themes/Classic/minus.gif - html/themes/Classic/plus.gif - html/themes/Classic/xhaddock.css - html/themes/Ocean/hslogo-16.png - html/themes/Ocean/minus.gif - html/themes/Ocean/ocean.css - html/themes/Ocean/plus.gif - html/themes/Snappy/minus.gif - html/themes/Snappy/plus.gif - html/themes/Snappy/s_haskell_icon.gif - html/themes/Snappy/snappy.css - html/themes/Tibbe/haskell_icon.gif - html/themes/Tibbe/minus.gif - html/themes/Tibbe/plus.gif - html/themes/Tibbe/tibbe.css + html/Classic.theme/haskell_icon.gif + html/Classic.theme/minus.gif + html/Classic.theme/plus.gif + html/Classic.theme/xhaddock.css + html/Ocean.std-theme/hslogo-16.png + html/Ocean.std-theme/minus.gif + html/Ocean.std-theme/ocean.css + html/Ocean.std-theme/plus.gif + html/Snappy.theme/minus.gif + html/Snappy.theme/plus.gif + html/Snappy.theme/s_haskell_icon.gif + html/Snappy.theme/snappy.css hunk ./haddock.cabal 185 + Haddock.Backends.Xhtml.Themes hunk ./ghc.mk 38 - $(INSTALL_DIR) "$(DESTDIR)$(ghclibdir)/html" - for i in utils/haddock/html/*; do \ - $(INSTALL_DATA) $(INSTALL_OPTS) $$i "$(DESTDIR)$(ghclibdir)/html"; \ - done + $(foreach i,$(sort $(dir $(utils/haddock_dist_DATA_FILES))), \ + $(call make-command,$(INSTALL_DIR) "$(DESTDIR)$(ghclibdir)/$i")) + $(foreach i,$(utils/haddock_dist_DATA_FILES), \ + $(call make-command,$(INSTALL_DATA) $(INSTALL_OPTS) utils/haddock/$i "$(DESTDIR)$(ghclibdir)/$(dir $i)")) hunk ./ghc.mk 51 -BINDIST_EXTRAS += $(addprefix utils/haddock/,html/*) +BINDIST_EXTRAS += $(addprefix utils/haddock/,$(utils/haddock_dist_DATA_FILES)) hunk ./html/Ocean.std-theme/ocean.css 273 - right: -21.5em; + right: 0; hunk ./html/Ocean.std-theme/ocean.css 275 - width: 22em; hunk ./html/Ocean.std-theme/ocean.css 276 - top: 5em; + top: 10%; hunk ./html/Ocean.std-theme/ocean.css 278 - background-color: #fff2b2; hunk ./html/Ocean.std-theme/ocean.css 280 -#synopsis:hover { - right: 0; - background: none; +#synopsis .caption { + text-align: right; + float: left; + width: 29px; + color: rgba(255,255,255,0); + height: 110px; + margin: 0; + font-size: 1px; + padding: 0; +} + +#synopsis p.caption.collapser, +#synopsis p.caption.expander { + background: url(synopsis.png) no-repeat 0 -8px; hunk ./html/Ocean.std-theme/ocean.css 296 -#synopsis .caption, hunk ./html/Ocean.std-theme/ocean.css 298 - background-color: #fff2b2; + background-color: #f9f8db; hunk ./html/Ocean.std-theme/ocean.css 302 -#synopsis > * { - margin: 0 0 0 8px; - border-left: 1px solid rgb(196,69,29); -} - -#synopsis .caption { - border-top: 1px solid rgb(196,69,29); - padding-top: 0.5em; - padding-bottom: 0.5em; - text-align: center; -} - -#synopsis ul { +#synopsis ul.collapser, +#synopsis ul.expander { + background-image: none; hunk ./html/Ocean.std-theme/ocean.css 306 + width: 22em; hunk ./html/Ocean.std-theme/ocean.css 309 - border-bottom: 1px solid rgb(196,69,29); - padding-left: 0.5em; + padding: 0.5em; + margin: 0; hunk ./html/Ocean.std-theme/ocean.css 314 - border: none; addfile ./html/Ocean.std-theme/synopsis.png binary ./html/Ocean.std-theme/synopsis.png oldhex * newhex *89504e470d0a1a0a0000000d49484452000000200000006808060000009071f2f5000017506943 *43504943432050726f66696c6500007801d5596558555bb79e6bf7864d77777797748348a7086c *ba3b2404410409452929954e410109310841444544422514440484a328822875177a3cdf779fef *de7ff7cf5dcfb3e67af718638e39f71ab3c6bb00605a230607fb23280108080c0fb5d0d7e2b4b3 *77e0c44e010ca0027440088813ddc28235cdcc8e82fff5da9a04d0a1724cecd0d7ff6af63f2ba8 *dc3dc2dc0080cc60b5ab7b985b008c6f0180d0720b0e0d0700b90dcb9f478507c318f508c6b4a1 *7007613c7388bd7ee3f543ecfa0ba351bf6cac2cb40140330280231089a15e0090f1c272ce4837 *2fd80f990e0018ea40779f400068ec60ace6e64d740780a900b6110d08083ac4fd301674fd373f *5eff868944d77f7c12895effe0dfff05ae0937ace31316ec4f8cfef5e3ffb208f08f80dfd7af8b *1a2e0981fec70e63430fdfcbee441d63f8c90adffbc1febf6206db40cc1e81d696b0ec108b06ba *1e33fd1bab7986ea59c018ae0b9905876b1d62f89d419ec1e166567fcbe363bcb58fc19800cb73 *3dc274fff829f5251a1dc68c1c96b784465858c39817c63d619196ba30864714f43ec6dbcaf66f *9b6fee1e3a7fcb11084f1f3dc3df36086a9f70c3c3b668e19873fb05191ff6016e0b210f8c813f *f0001120142e038118380ab481cedfa518f00444581309ebc2801ff800e300b846105c2708c69c *7fdb69ff8744ef573d2fb8de7ff7c809dc60db887fdafcdd1a27dce61f9f3ec01dc67fe444b88d *43dd61efc29c7d92fed5e61f8b437fbf7a23d920b922b9fba74f287e94344a0ea5855245a9a194 *00278a1ec50cc450b2284594264a1da502eb94801e780f7bf6fad3c743ff012d9e910541d1ca36 *deb0f6f0bfbbfed1029b5fd63efffcfe8f1e009f676b1d6b7f7a0040b8c749781e00a01d141c1d *eae3e51dcea909cf5c0f514ec3403771514e694929c943f5ff9beb70cdfaddd90d8b5f6b11443f *f22f99e37900e4d4e179fee45fb2e04a009a64016017fe974ca80a9e3ab06d93a25b4468e46f7f *a8c3071a90000a7884320176c00304e1f72c0de4810ad000bac00898022b600f9ce0f1e30d8fc1 *501005e24022480119e022c80345e01aa800b5a011b4800e7017f48287e009780e26c03498038b *6015ac832db00341101622836820268803e2834420694811528374a1a39005640fb9405e502014 *01c54167a00c281b2a82caa03aa819ba0df54243d028f41a9a8756a0afd04f04124140d022d810 *fc080984224213618cb0429c4078214210318864c4054401a21c711dd18ee8453c414c20e610ab *884d24409222e9915c4831a422521b698a74407a224391f1c874643eb21cd984ec420e22c79073 *c835e40f14064583e24489c1e3d400658d724385a0e25199a822542daa1dd58f1a43cda3d651fb *6832342b5a04ad8c3644dba1bdd051e814743eba1add861e404fa017d15b180c861e238051c018 *60ec31be98584c26e60ae606a607338a59c06c62b15826ac0856156b8a2562c3b129d842ec756c *37f6057611bb8d23c571e0a4717a38075c202e09978fabc7ddc7bdc02de176f094783ebc32de14 *ef8e8fc667e12bf15df811fc227e87848a44804495c48ac4972491a480a4896480648664839494 *949b5489d49cd487f4346901e94dd247a4f3a43f08d404618236c1911041b840a821f4105e1336 *c8c8c8f8c934c81cc8c2c92e90d5913d207b43b64d4e432e4e6e48ee4e9e405e4cde4efe82fc13 *059e828f4293c2892286229fa2956284628d124fc94fa94d49a48ca72ca6bc4df99272938a864a *8aca942a802a93aa9e6a886a991a4bcd4fad4bed4e9d4c5d41fd807a810649c343a34de3467386 *a6926680669116432b406b48eb4b9b41db48fb8c769d8e9a4e96ce86ee245d31dd3dba397a243d *3fbd21bd3f7d167d0bfd24fd4f0636064d060f8634862686170cdf19591835183d18d3196f304e *30fe64e264d265f263bac4d4c134cb8c62166636678e62beca3cc0bcc642cba2c2e2c692ced2c2 *32c58a601566b5608d65ad607dcabac9c6cea6cf16cc56c8f6806d8d9d9e5d83dd973d97fd3efb *0a070d871a870f472e4737c7474e3a4e4d4e7fce02ce7ece752e562e03ae08ae32ae675c3bdc02 *dcd6dc49dc37b86779487814793c797279fa78d67939784d78e3781b78a7f8f07c8a7cde7c97f9 *06f9bef30bf0dbf2a7f277f02f0b300a180ac4083408cc089209aa0b8608960b8e0b61841485fc *84ae083d174608cb097b0b170b8f882044e4457c44ae888c8aa24595440345cb455f8a11c434c5 *22c51ac4e6c5e9c58f8a278977887f92e0957090b8243128b12f2927e92f5929392d452d652495 *24d525f5555a58da4dba587a5c864c464f2641a653e68bac88ac87ec55d9577234722672a9727d *727bf20af2a1f24df22b0abc0a2e0a250a2f156915cd1433151f29a195b4941294ee2afd509657 *0e576e51feac22a6e2a752afb27c44e088c791ca230baadcaa44d532d539354e3517b552b53975 *2e75a27ab9fa3b0d1e0d778d6a8d254d214d5fcdeb9a9fb424b542b5dab4be6b2b6b9fd2eed141 *eae8eba4eb3cd3a5d6b5d62dd27da3c7ade7a5d7a0b7ae2fa71fabdf6380363036b864f0d290cd *d0cdb0ce70dd48c1e89451bf31c1d8d2b8c8f8dd51e1a3a147bb4c10264626392633c7f88e051e *eb3005a686a639a6b3660266216677cc31e666e6c5e61f2ca42ce22c062d692c9d2deb2db7acb4 *acb2aca6ad05ad23acfb6c286c1c6dea6cbedbead866dbced949d89db27b62cf6cef63dfe98075 *b071a876d83cae7b3ceff8a2a39c638ae3e4098113274f0c39313bf93bdd73a670263ab7baa05d *6c5dea5d7689a6c472e2a6aba16b89ebba9bb6db65b755770df75cf7150f558f6c8f254f55cf6c *cf652f55af1caf156f75ef7cef351f6d9f229f2fbe06bed77cbffb99fad5f81df8dbfadf08c005 *b804dc0ea40ef40bec0f620f3a19341a2c129c123c17a21c9217b21e6a1c5a1d06859d08eb0ca7 *850f874f230423ce46cc47aa4516476e47d944b59ea43a1978f269b470745af4528c5e4c552c2a *d62db62f8e2b2e316efe94e6a9b27828de35be2f8127213961f1b4fee9da449244bfc4e124c9a4 *eca46f676ccf7425b3259f4e5e38ab7fb621853c2534e565aa4aeab573a8733ee79ea5c9a415a6 *eda7bba73fce90ccc8cfd8cd74cb7c7c5eea7cc1f9830b9e179e65c9675dbd88b9187871f292fa *a5da6caaec98ec851c939cf65ccedcf4dc6f79ce7943f9b2f9d72e935c8eb83c5770b4a0b390b7 *f062e16e9177d144b156f18d12d692b492ef57dcafbcb8aa71b5e91adbb58c6b3f4b7d4a5f95e9 *97b597f397e757602a222b3e54da540e562956d55533576754efd504d6ccd55ad4f6d729d4d5d5 *b3d66735201a221a56ae3b5e7fdea8d3d8d924d6547683fe46c64d7033e2e6c76697e6c916e396 *be56c5d6a65b7cb74ada68dad2dba1f6e8f6f50eef8eb94efbced1db46b7fbba54badaee88dfa9 *b9cb75b7f81eddbdacfb24f793ef1f74c7746ff604f7acf57af52ef439f74d3fb07b30de6fdeff *6cc078e0d143bd870f063507bb1fa93eba3ba43c74fbb1e2e38e27f24fda9fca3d6d1b961b6e7b *26ffac7d4461a4f3b9d2f3aed123a3f75fa8bfe81dd3197b386e38fe64e2d8c4e8a4f5e4ab978e *2fe75eb9bf5a7eedfffacb54e4d4cef4e919f44cfa2ce56cfe1bd637e56f85dede98939fbb37af *33fff49de5bbe905b785d5f761ef7717933f907dc85fe258aa5b965ebebba2b7f2fce3f18f8bab *c1ab3b6b297f51fd55f249f0d3adcf1a9f9faedbad2f7e09fd72f035738369a3e69becb7be4db3 *cd375b015b3bdfd3b799b66b7f28fe18fc69fb7369276a17bb5bb027b4d7b56fbc3f7310707010 *4c0c25fe3a0b20e112e1e909c0d71a3887b0877387e70090f4fcce297e59c0e90a04dbc0d806e2 *816e227c914a283c6a09dd8329c026e1a2f01e24f6a40e047b3227720f0a5fca08aab3d44534ad *b48fe95618d08cbc4c7accde2c19ac2d6cb31c384e192e67ee0c9e2ede657e760163c178a126e1 *79517a3103f1588926c959694a192dd960b932f911857d2561656b958423f5aa636a3f34d83535 *b53cb5cfe9d4e83ed45b300086ac46f2c66647bd4de28fe599d69b759b8f5b2c5bee5a53d870db *cad9e9dbdb3bf81f8f77cc3a51ee74cbf991cb34f1931be44eeb21e879c4cbccdbc327daf7bc5f *b97f7bc0e3c037415f43d0a18c6122e1aa11c7225da2824e264467c614c656c5dd3cd519df9bf0 *e8f470e268d2f89989e489b3e329a3a9c3e71ea5f5a6dfce68ceac395f72e162d6998be1973cb3 *6d73f472e5f278f2a9f20f2eaf16bc2c7c5074a3b8a824f94ae055bb6b5aa52265b4657be58b15 *c3956d5557aacfd6f8d75ad629d77336601bfeba3eded8d5547a23e5a65fb3458b422bdb2de4ad *e5b667edb73a8a3a4fdff6e832be237997feeeeebd77f71f7537f5e4f646f7393fd0e9171ea01c *d87c383dd8f3a86a28ed71e0138ba70ac32cc307cf16461e3eaf1fcd7c113466312e37c130f163 *72fae5dd57575f274c11a7b5667867d1b34b6f1ebfbd3e77713ee29dc382e67ba1459ac5fd0f6b *4bb3cbcf571e7eec5ebdbb76efafde4f439f27e0d1f46383fa9bc4a6e956d8f7a2ed811f1b3bbc *bbd67b69fbbd070770fc45403f9487b047d221dfa34ad161183bac128e198fc6af924c918e1206 *c9fac81f50f4510e500d538fd12cd06ed0ed33d030f233a9305bb304b3a6b155b3f771bce74273 *73f3e8f17af365f0370a8c0a6e0a338b1c1175164b12af921890fc208d911194d59173958f5728 *546c511a527ea3f24d15abc6a42ea4a1a4a9a765a17d5cc75d37402f4c3fca20d630c128d138f1 *68a2c9e96309a6f166b1e6d1169196e15621d60136beb65e761ef6ae0ec4e3ce8e274e9c707274 *767439417472757623babb7a787afa7af97b07fb44f846fb9df24f0a4809cc0cba189c1752187a *25ac2cbc32a23ab22eaafe644374434c7d6c7d5ceda9aaf8b2842ba70b137392ce9f399b1c7f36 *3cc52f9578ce26cd285d2d432a93f73cfd05dc851f591f2f4e5d1acabe9d53939b97979c1f72d9 *a9c0b850a188a798a278a764e9cad8d5ee6bf5a5f96549e50115f695ba5552d56c352435df6bdf *d78dd67737345e2f694c6f8abee173d3bed9b045a955e4166b1b39bc826d742c754edf7ede3570 *e7cedde67b75f7cbba8b7a727ab3fa321ea4f6a70c9c7d983298fa286328eb71fe93ab4f6b865b *9e758f0c3f9f1dfd3486186798109fd47b497c15f7ba68eaf6f4d4ccee1b8eb7da73def317dedd *5a985e843e082c992c87ace47dec587db9b6f989eab3f0bac617cbaf6e1b41dfa237e3b74e7f4f *d88efd11fed377e7c4aee99ec6bef801d3aff8b381331027d488d0428c21bd503854397c12dec6 *9463cd71485c073e003e912e909613dce193e52a79134524a5361539d534750d4d04ad1e1d2bdd *2a7d37432ea30f93063313f33acb23d632b658762b0e314e0ce73c571777368f3faf3e1f07df16 *ffb0408560b490a9308ff096c890689198afb8b2044e6242b24c2a405a5106c80cca5e90b39267 *929f5528557457e253faa05cade2059f5116552bd5dce033c95b8d2b9a8e5acc5aafb42feb58eb *d2ea8ee9e5e85b1ad0188c1be61bd919b318cf1e2d33f13c267cecb369bbd929731d0b82c584e5 *352b1f6b19eb7d9bc7b6f976eef6d20ec0e1d9f1ab8e8127d49d289dde39b7b9a4128fbb4ab8a1 *dca6dc9b3dce79ba78297a5379affa3cf42df58bf3b70b900da40afc1c341cdc10921eea136610 *2e108189588cec8faa3c7926da3546239623762f6e1a5e55f212424f1f4b144ec224cd9fb99b9c *7f3638c530952775f7dc445a637a4a8653a6fc79f2f34b17bab30a2e865c32cae6cddecf7995db *9a9795ef77d9a080bf1055b850d45f5c55927ac5efaad935f952b63274d9e7f2a98ac1caf6aaea *ea829accdaa4ba98fa8886d0eba18d114d7137526fe635d7b6f4b6be6d43b54b76b8755ebbbd78 *47eeeec57bdbdd813d1b7d29fda2030b83d787d29f9c1a4e19a91c9d1ae79f4c7b8d9cce7ba33a *f773e1c987e695bab5e6cf835f3f6fd1ff30d9bd7c18ffdfdcd2e19e809107e0f22500ec3a01b0 *d60420930ea695600ba64200ccc800b0520288f50a8068eb0350ede63ffb07f42be7a482334e1e *2001679a867086e90362c105500e3ac1085882605607928373c320e802d4048d405f1074082584 *33e22ca21131096774a2483b640ab20d5e7fe8e14c2d0ed50cef43ec685bf425f4530c1ecebb52 *318fb0a47086958b9dc1f1e2827077f078bc1dbe0ebf4b624e524b0a911e27ed20d0132209afc9 *54c92ac909e451e40b1416140f28e5291ba8b8a98aa9e9a97368a8697268e9698be9b8e91ae8e5 *e8fb18cc19e619c398b04c25ccb2ccc32cdeac68d64a361db60fece91c921caf3813b9c4b8a6b8 *d37954783ef356f19de067e01f17c811b41262127a2b5c271221aa23462fb626de2f714d325eca *455a4f464296558e200fe4b7153614bf2a6d2aef1cc1a8d2aaf1abab68586b866a656b77e8bcd5 *23d15732f0372c379a39ca64627fec8ae9a2b984c529cb116b5e9b38db57f60a0e85c70f4e783b *4db8e8103bddc4dd6b3c79bdaa7c047d6ff82b060c045907af8426843346b445599dfc1e73254e *efd49784d2448b33b8e49e94b8732a697b197de733b26c2f0964ffcc1dcdbf5e905ee457627e55 *b954a09ca192508daa05f5e03aaa89f426430bff2dc5f6639dde5dc9772beef7f72c3d201d901c *b4198a7d726db877647e746f9c6152ec95da94d18cf91bab398b7746efd53e882d33acecafcefd *d5fdb9f84bc4c6d14dceadafdb8f7e16effaed2bfd5a3f1070fc4961be8e15f0c35c8306cc31b8 *c0ccc259984db8090661dee02744073304a630279005dd84c6a0ef085678adf145e420ee2156e0 *5d471b1986ac404ec02b8f2a2a0c558f5a40b3a1ede11c7c024387b1c51463e6b002d8206c170e *83b3c255e2b6f046f832fc0f124b929ba414a4c1a4630425421919812c9a6c99dc817c84428fa2 *9b5285b28b4a85aa1bce578769ece0dc34820e4357442f453fc4e0ce0818af31a933bd634e6511 *6399643dcd26ca3605c7fc08c73a67159723373df728cf055e133e0abe17fc0502ce8242829b42 *fdc27922dea26a620c625fc59f4b344be649c5497bc858c86ac9c9c98b28f02a722a712af3a808 *1d9151d550335377d788d5ccd36ad51ed7d9d6e3d437368831bc6e347f94d9c4063ed7bc3267b7 *f0b2bc658db2b1b56db4c738b81eef3dc1e394eafc9968effad05dcea3c68bc53bdb97d42f3500 *15981c8c0dc908a30e2f8ee48f6a8dd68a198bf33cb59b90932892f430d93505a496a669a4bfcb *4cb9209c357229228735f741be5f016de1bd62cf2b14573b4b89e52415ad558e35e8dac67a9b86 *fdc6aa1b2637bfb514dfd26a5be9c8ba2ddf357b37f9be68f778efa90702fd2f1e263c121f7af3 *e4d2b0feb383e7775ec48eab4f625f4ebcae9d4e9a757d6b34afb420b928b1a4b062b4eaf157fa *e7db5fbe7c93d98adf1edee1db3bf72bfe48800734305f2709b4802dcc23a6816a30003e402490 *24cc069d8163fe164185d085399d56c45f4861a40fb21ef909e610e35083683ab407ba034386f1 *c07463d9b0f1d87738435c2b9e0b9f4d82214920d9218d253d20a492d1c0b35a89fc0545302535 *6527953b350df5204d02ed11da3dba3efa0c063b4621c63da649e666964bac616cf6ec5af0eec3 *ca45ce8de0fec9f38d779d6f9dffabc096e09e3056845694474c56dc40c259f2a454ae748bcc98 *eca63c8b82b6628052a1f2a0cab6aa889a8bfa658de75a046d239d74dd617d6a037bc30aa3cf47 *d54d2e1dfb60a6665e68b16de560dd6d2b6897e7803e1ee3f8d529088e5db8eb9e7bba278b57b3 *8fb1efb27f7aa064d0eb90d430c5f0b5c8ca934e31acb133a7ae2578248a266d25f7a65c38e798 *2e9ab1777e24ab1c8e9a411e5bfe978281a2a292c0ab9aa5b4651f2a3aaa526bacebb8ea57afb7 *3645dd5468fed6dad846eca0e8ecec3a7ee7fbbdf3dd2c3de57d5c0f0a06700f83074787841fc7 *3ce91b463dd318097f5e3a3af862651c31c13029f052f295dc6bb929c969c119e65992d96f6f66 *de76cf95cdc7bfb35f907c8f79ff72b1f643c492d6327ef9c54afe478755d6d599b592bfec3ed1 *7d1af97c6e5d737dfbcb8dafee1b8c1b4fbfc56f4a6dce6d5dfcaef97d63bbea87d54fd4cfd61d *975df2ddae3df77df2fdb60387c3f88779ca481fee1e002268c1f4e39b83830d7e00b0d900ec5d *3a38d8293f38d8ab80930df81b488fffefef1587c61898732f713e443d6c1ea70f9fff7efd1746 *e27b0e48e692c6000000097048597300000b1300000b1301009a9c18000009de494441546805ed *5a7b7054d519ffed33d9cd73f3428291574021a311d2844006185e8255682b9696ca6344a8882d *0a61a633e958699d51ea20add02874c6a8b55a25c0d4d20ed23255071c41e2ab83a23ce4352026 *813c368fcd6673b7df77efdebbf7eeeebdbb7b17867f7266ee9e73bef39deffb9def3b8fefdeb3 *966030881b99ac375239eb1e043068811b6e017ba2abc062b130588bea49b4ab215f5c00a4d846 *12ec8b7f3e3f6be3e3eb67657b32ca8440305d0806194ccac910404879da81775eab985cf3bd57 *1c4ec7a8488d8220c06a8ded49a336594eec9ed41a3279da9499130aaba754bc1a4b795b5b0fde *7bff04388f4ceded52dbd5b6eec8264d3d260052cee665ebb87ebd6eedddce34e7484d2faab082 *a34d67e0f3f58bb91a446b6b178e7c24b535359d4567676f6477a56ee402077165e415e4942bdc *a1022bffe8e81904028248b15a2db0dba5b17c7bb9039f7d7601f219c363313a6ef400b03406e0 *f6fbfab3427ac52c52b9d369c3a4aa51c8ca4ac7f90b5771ecd845853d3ddd81aaca11c8cc4c57 *6891053d00ec029efdce3e7fbf53ee64a4fcf4e9167c7de2b2cc8a8c8c3451b9cba57457dad405 *2300a2150602030c04ed1d5ab3ab477efcab6f71e64cab223727db854a1ab9d3a9275e61353c0d *1980857c29ae775e6ad2dc943a0b4210fc70b2d924ff4b2d20baa0b4c934bd5cdb339a4b54cee4 *6cf2f1a4aa9170384483881390677a47472fc68e1982f1e3872abdbd5d7df8f0f037e8eeee5368 *7a857800783687419069b52006c4e5c620460c2f40797909594952d5dbeb1741182d41e68c0b20 *1279760c10bc2459d1b0e25c544c1c4e3ba384c2ef0fe0f0916f68a3d2df8c9206c0802241304d *5eeb4545d9a82257c9fb02cf1bd96dcc17994c0160210ca2aa7224dc6ea798e7e4b814d9799e0c *544f1a25b6f16a30b30f28c28c0aac74fab4b19ad521f33340bd36998773d3169085a897a64c93 *73a33699276500b220b379ca00fa059ef1d28674ea52374e9ebba2d41301157faf349072f0783b *9edffa06ded8f220767e78197f6fdc17e2f661d78b6ba91c5f7c4a1678969473f2faac785351ce *94747cf2f9712ec44da601f491d5f99c7ba6762ed2b25ca412985a5140235f8300953bbdd15152 *2c34a6010cd00ecdde2fc8cfc7c14fa563f8811fd4c4d261488bef249dee2e6b10fdd4b6aa4e72 *0368dc1e4f0916d5be247abe303f57a7a7966cda023cfa05f36729d2268ef7c06617d0dfc3f19f *0f65e3c6286d4605d31660a10f7dff56fc687a29fc7e1f6ea2ed97d3fad5f7606af92d54920e24 *9168f093340071c5d30f1fbb0394e7ba293e706720149ba0e68ee1623974201aa8969a9206f0e0 *933bd1d57c098df5eb70dfa3f562e41a4bcb8615d5a8ae9c18ab49434b7a0ea80dab2e6ba452a5 *ddab1f03a87993b640c36f1785bc1bc49e1768cd07adb05bd831419cbed405a1df8f31c3f370dd *5ca01ef5075f0d6ec5835bf1e0567c03b662f526c2654f860ded70e1eb731dc8a26d79caed2544 *552fd6c81eda7ad21b91bafbd55e1b56addf16a56e6ecd2d58b5e45e35ab6e39e9ad582d69b94a *f9d0a2dc50680aecffe03c4e9e3aad66d52d9bb6401f45c31c9265ba05bcb2790d595d1acbbb9f *b7a27efb4e5c69eb40221181690b0c84c6b4faa7d58a7226cd282f1063c244df794c0370534866 *75bbb0b9e1103a3aa5938fe3832d7f3d228664b7968e084134ce4cbb80cf3f0ebfece488877ef5 *6a941675acb8ebc55f507becb1c6a646898b263080c4175b747f9962da028c7c67fd1a1a973e0c *81d685555c1bfa3ca601f0081ca2fd82e8f65be0edf6c1690b222f3bfc4d50fa9aa4af9c65a404 *80df8096d6be1c0ac5599c949eaebd1b634b47ca55c3dcf41c60a98f6dda1ba59ce975cfed43c0 *7f9d624256c089bf125f3c77814cd883b7b63d4e2f2576d1db3bff7b1a8d8dfb71e0d027983773 *aac86bf463da025e3f05a324b96ef55c51392b616fff64e66871232a195ac4a4b8c934802ca720 *2adafa97f7f9d3a8a2e8ed436c15a0e54aa742332a989e848c3cb7a8805e525a71ffa3dba9c620 *c2e3995c719b915ea52ddc4321255ed8b17111c21f63c3a236ae9d833497e62bbfae50d3166089 *69e4f4bdf441a2b33788d6362f325c0e0cf184bf17ea6a5535a404e06aaf15cf3cbf07cd2d5755 *2281ae1e1f36ac9882c995776ae8b12a290158befe4f488b2195574387d71ba3259a641a803760 *0d290fe089b50b31e4a67c453adf2515e6481bb142d4299806e0b4f151032c9c3d1ae5e386e988 *8f4f0e4fddf8bc1a0e9e8059b40cf71c388ededef05ad0302550316d011e7d1bed010eb8b174fd *4b51aaea564fc7c4f2b2287a24c1b405188051e7e62bda9511a958ae9bb6002b7f60e154dc3bad *0c0ebb76c2f1ec906205598d7e6e1a006fbcafef3e8837e9c9745bb16ee53db8e3b661f4f1ca2a *5e38eaabd4b69806c06bbd802621cf83ae1e014f6ddd2b4abe737c311e5e321b859e4cad269d1a *df0b4635d14583838879f4dcf2afbd2fd7cdb96bea0fa39842040ec54f9cf7e2edff7c8ca68fbf *d4b02d985d86650ba7118de1c64e46f328768f08aa8d64979664a3a6727c440bf08f035fa06e53 *43145d4d30ed0216b2f7d01934bcbe2fcae70b669763746929b66cdf8d13e205865aa5b66c1a00 *4f42b5f2317471b966d96c9414b3e7a4b485de9cd0c3a12b73c736b66900ec55ba2146ed8abb30 *a5a294de4da3df10fefcbb65141df975955383183d719e546ae9b660d3b646bcb56539d229f038 *7aca8bdf3ff75a4846003b9e5e827c4f1ef2e9e305fd09c350766cbb187469eeb6e3910df53877 *ae1941a11f7c731256ce1ded7898ef1082899d0f4903d8dcf04e089e00178dfedf4dcda17a007f *7862093cb437b0bf0f377d11a21b674903387bf6024914b0ab7e15e97160f73fdf1335acfcf104 *9a80d9f84ded62b1dedbc7f729f1535200782efbc51b119a58d634716eb7d34ec869c66429fc72 *f2c64029272bb19d30a955c068d9c45e527af1520b4eb6482f277c4593e69214eef8dbbb22804e *6f9798c7fb890b80b665cd5e3d677a25f6d01de1634f352ab2e7d58ca0b205f31f79418911ab26 *5ca3f78280d0af71e6cf668e44b638d164fd3eac5cb2400ccfe443796ecdcd748b93233318e646 *1660970b5f1e3b757ededc191a217c69e10b90af8501a43bc3d3e8fef9d59845ff29185ae8d1f0 *1b55f44e4306c6177fc505459edbfff7e9fe3f1614e4f1fabae6290c5f2b9afdcea6ef6b6d6e6b *5bfbcb271bbefbaea54dcb726d6a7a166060bc8772b07f333da3b27333472f5d7cdfc47165a38b *6d563b7fa3e43f8e486b4eac98fb89098045d1ec6725fc8659484f71e8613764d3c36d0c326500 *4693903f86f23dac1cdefa426537e5fc46764d00e85a8014b01518208f96ddc177b39cb3720ed9 *521e3dc910ff2bc6b96e2210bcbcf991c170591e7dca200c2d20a32210ac9053642e5153f84d08 *400af2e37695471497f17a310c0218b4c0a005062df07f9a8d020e3dfb6d3c0000000049454e44 *ae426082 hunk ./src/Haddock/Backends/Xhtml.hs 507 - sectionName << "Synopsis" +++ + paragraph ! collapser "syn" "caption" << "Synopsis" +++ hunk ./src/Haddock/Backends/Xhtml.hs 510 - ) + ) ! ([identifier "syn"] ++ collapser "syn" "hide") hunk ./html/Classic.theme/xhaddock.css 219 +#synopsis .expander, +#synopsis .collapser { + background: none; + padding-left: inherit; +} + +#synopsis .hide { + display: inherit; +} + hunk ./html/Snappy.theme/snappy.css 355 +#synopsis .caption.expander, +#synopsis .caption.collapser { + background: inherit; +} + +#synopsis ul.hide { + display: inherit; +} + + hunk ./html/Ocean.std-theme/ocean.css 291 -#synopsis p.caption.collapser, -#synopsis p.caption.expander { +#synopsis p.caption.collapser { hunk ./html/Ocean.std-theme/ocean.css 295 +#synopsis p.caption.expander { + background: url(synopsis.png) no-repeat -64px -8px; +} + binary ./html/Ocean.std-theme/synopsis.png oldhex *89504e470d0a1a0a0000000d49484452000000200000006808060000009071f2f5000017506943 *43504943432050726f66696c6500007801d5596558555bb79e6bf7864d77777797748348a7086c *ba3b2404410409452929954e410109310841444544422514440484a328822875177a3cdf779fef *de7ff7cf5dcfb3e67af718638e39f71ab3c6bb00605a230607fb23280108080c0fb5d0d7e2b4b3 *77e0c44e010ca0027440088813ddc28235cdcc8e82fff5da9a04d0a1724cecd0d7ff6af63f2ba8 *dc3dc2dc0080cc60b5ab7b985b008c6f0180d0720b0e0d0700b90dcb9f478507c318f508c6b4a1 *7007613c7388bd7ee3f543ecfa0ba351bf6cac2cb40140330280231089a15e0090f1c272ce4837 *2fd80f990e0018ea40779f400068ec60ace6e64d740780a900b6110d08083ac4fd301674fd373f *5eff868944d77f7c12895effe0dfff05ae0937ace31316ec4f8cfef5e3ffb208f08f80dfd7af8b *1a2e0981fec70e63430fdfcbee441d63f8c90adffbc1febf6206db40cc1e81d696b0ec108b06ba *1e33fd1bab7986ea59c018ae0b9905876b1d62f89d419ec1e166567fcbe363bcb58fc19800cb73 *3dc274fff829f5251a1dc68c1c96b784465858c39817c63d619196ba30864714f43ec6dbcaf66f *9b6fee1e3a7fcb11084f1f3dc3df36086a9f70c3c3b668e19873fb05191ff6016e0b210f8c813f *f0001120142e038118380ab481cedfa518f00444581309ebc2801ff800e300b846105c2708c69c *7fdb69ff8744ef573d2fb8de7ff7c809dc60db887fdafcdd1a27dce61f9f3ec01dc67fe444b88d *43dd61efc29c7d92fed5e61f8b437fbf7a23d920b922b9fba74f287e94344a0ea5855245a9a194 *00278a1ec50cc450b2284594264a1da502eb94801e780f7bf6fad3c743ff012d9e910541d1ca36 *deb0f6f0bfbbfed1029b5fd63efffcfe8f1e009f676b1d6b7f7a0040b8c749781e00a01d141c1d *eae3e51dcea909cf5c0f514ec3403771514e694929c943f5ff9beb70cdfaddd90d8b5f6b11443f *f22f99e37900e4d4e179fee45fb2e04a009a64016017fe974ca80a9e3ab06d93a25b4468e46f7f *a8c3071a90000a7884320176c00304e1f72c0de4810ad000bac00898022b600f9ce0f1e30d8fc1 *501005e24022480119e022c80345e01aa800b5a011b4800e7017f48287e009780e26c03498038b *6015ac832db00341101622836820268803e2834420694811528374a1a39005640fb9405e502014 *01c54167a00c281b2a82caa03aa819ba0df54243d028f41a9a8756a0afd04f04124140d022d810 *fc080984224213618cb0429c4078214210318864c4054401a21c711dd18ee8453c414c20e610ab *884d24409222e9915c4831a422521b698a74407a224391f1c874643eb21cd984ec420e22c79073 *c835e40f14064583e24489c1e3d400658d724385a0e25199a822542daa1dd58f1a43cda3d651fb *6832342b5a04ad8c3644dba1bdd051e814743eba1add861e404fa017d15b180c861e238051c018 *60ec31be98584c26e60ae606a607338a59c06c62b15826ac0856156b8a2562c3b129d842ec756c *37f6057611bb8d23c571e0a4717a38075c202e09978fabc7ddc7bdc02de176f094783ebc32de14 *ef8e8fc667e12bf15df811fc227e87848a44804495c48ac4972491a480a4896480648664839494 *949b5489d49cd487f4346901e94dd247a4f3a43f08d404618236c1911041b840a821f4105e1336 *c8c8c8f8c934c81cc8c2c92e90d5913d207b43b64d4e432e4e6e48ee4e9e405e4cde4efe82fc13 *059e828f4293c2892286229fa2956284628d124fc94fa94d49a48ca72ca6bc4df99272938a864a *8aca942a802a93aa9e6a886a991a4bcd4fad4bed4e9d4c5d41fd807a810649c343a34de3467386 *a6926680669116432b406b48eb4b9b41db48fb8c769d8e9a4e96ce86ee245d31dd3dba397a243d *3fbd21bd3f7d167d0bfd24fd4f0636064d060f8634862686170cdf19591835183d18d3196f304e *30fe64e264d265f263bac4d4c134cb8c62166636678e62beca3cc0bcc642cba2c2e2c692ced2c2 *32c58a601566b5608d65ad607dcabac9c6cea6cf16cc56c8f6806d8d9d9e5d83dd973d97fd3efb *0a070d871a870f472e4737c7474e3a4e4d4e7fce02ce7ece752e562e03ae08ae32ae675c3bdc02 *dcd6dc49dc37b86779487814793c797279fa78d67939784d78e3781b78a7f8f07c8a7cde7c97f9 *06f9bef30bf0dbf2a7f277f02f0b300a180ac4083408cc089209aa0b8608960b8e0b61841485fc *84ae083d174608cb097b0b170b8f882044e4457c44ae888c8aa24595440345cb455f8a11c434c5 *22c51ac4e6c5e9c58f8a278977887f92e0957090b8243128b12f2927e92f5929392d452d652495 *24d525f5555a58da4dba587a5c864c464f2641a653e68bac88ac87ec55d9577234722672a9727d *727bf20af2a1f24df22b0abc0a2e0a250a2f156915cd1433151f29a195b4941294ee2afd509657 *0e576e51feac22a6e2a752afb27c44e088c791ca230baadcaa44d532d539354e3517b552b53975 *2e75a27ab9fa3b0d1e0d778d6a8d254d214d5fcdeb9a9fb424b542b5dab4be6b2b6b9fd2eed141 *eae8eba4eb3cd3a5d6b5d62dd27da3c7ade7a5d7a0b7ae2fa71fabdf6380363036b864f0d290cd *d0cdb0ce70dd48c1e89451bf31c1d8d2b8c8f8dd51e1a3a147bb4c10264626392633c7f88e051e *eb3005a686a639a6b3660266216677cc31e666e6c5e61f2ca42ce22c062d692c9d2deb2db7acb4 *acb2aca6ad05ad23acfb6c286c1c6dea6cbedbead866dbced949d89db27b62cf6cef63dfe98075 *b071a876d83cae7b3ceff8a2a39c638ae3e4098113274f0c39313bf93bdd73a670263ab7baa05d *6c5dea5d7689a6c472e2a6aba16b89ebba9bb6db65b755770df75cf7150f558f6c8f254f55cf6c *cf652f55af1caf156f75ef7cef351f6d9f229f2fbe06bed77cbffb99fad5f81df8dbfadf08c005 *b804dc0ea40ef40bec0f620f3a19341a2c129c123c17a21c9217b21e6a1c5a1d06859d08eb0ca7 *850f874f230423ce46cc47aa4516476e47d944b59ea43a1978f269b470745af4528c5e4c552c2a *d62db62f8e2b2e316efe94e6a9b27828de35be2f8127213961f1b4fee9da449244bfc4e124c9a4 *eca46f676ccf7425b3259f4e5e38ab7fb621853c2534e565aa4aeab573a8733ee79ea5c9a415a6 *eda7bba73fce90ccc8cfd8cd74cb7c7c5eea7cc1f9830b9e179e65c9675dbd88b9187871f292fa *a5da6caaec98ec851c939cf65ccedcf4dc6f79ce7943f9b2f9d72e935c8eb83c5770b4a0b390b7 *f062e16e9177d144b156f18d12d692b492ef57dcafbcb8aa71b5e91adbb58c6b3f4b7d4a5f95e9 *97b597f397e757602a222b3e54da540e562956d55533576754efd504d6ccd55ad4f6d729d4d5d5 *b3d66735201a221a56ae3b5e7fdea8d3d8d924d6547683fe46c64d7033e2e6c76697e6c916e396 *be56c5d6a65b7cb74ada68dad2dba1f6e8f6f50eef8eb94efbced1db46b7fbba54badaee88dfa9 *b9cb75b7f81eddbdacfb24f793ef1f74c7746ff604f7acf57af52ef439f74d3fb07b30de6fdeff *6cc078e0d143bd870f063507bb1fa93eba3ba43c74fbb1e2e38e27f24fda9fca3d6d1b961b6e7b *26ffac7d4461a4f3b9d2f3aed123a3f75fa8bfe81dd3197b386e38fe64e2d8c4e8a4f5e4ab978e *2fe75eb9bf5a7eedfffacb54e4d4cef4e919f44cfa2ce56cfe1bd637e56f85dede98939fbb37af *33fff49de5bbe905b785d5f761ef7717933f907dc85fe258aa5b965ebebba2b7f2fce3f18f8bab *c1ab3b6b297f51fd55f249f0d3adcf1a9f9faedbad2f7e09fd72f035738369a3e69becb7be4db3 *cd375b015b3bdfd3b799b66b7f28fe18fc69fb7369276a17bb5bb027b4d7b56fbc3f7310707010 *4c0c25fe3a0b20e112e1e909c0d71a3887b0877387e70090f4fcce297e59c0e90a04dbc0d806e2 *816e227c914a283c6a09dd8329c026e1a2f01e24f6a40e047b3227720f0a5fca08aab3d44534ad *b48fe95618d08cbc4c7accde2c19ac2d6cb31c384e192e67ee0c9e2ede657e760163c178a126e1 *79517a3103f1588926c959694a192dd960b932f911857d2561656b958423f5aa636a3f34d83535 *b53cb5cfe9d4e83ed45b300086ac46f2c66647bd4de28fe599d69b759b8f5b2c5bee5a53d870db *cad9e9dbdb3bf81f8f77cc3a51ee74cbf991cb34f1931be44eeb21e879c4cbccdbc327daf7bc5f *b97f7bc0e3c037415f43d0a18c6122e1aa11c7225da2824e264467c614c656c5dd3cd519df9bf0 *e8f470e268d2f89989e489b3e329a3a9c3e71ea5f5a6dfce68ceac395f72e162d6998be1973cb3 *6d73f472e5f278f2a9f20f2eaf16bc2c7c5074a3b8a824f94ae055bb6b5aa52265b4657be58b15 *c3956d5557aacfd6f8d75ad629d77336601bfeba3eded8d5547a23e5a65fb3458b422bdb2de4ad *e5b667edb73a8a3a4fdff6e832be237997feeeeebd77f71f7537f5e4f646f7393fd0e9171ea01c *d87c383dd8f3a86a28ed71e0138ba70ac32cc307cf16461e3eaf1fcd7c113466312e37c130f163 *72fae5dd57575f274c11a7b5667867d1b34b6f1ebfbd3e77713ee29dc382e67ba1459ac5fd0f6b *4bb3cbcf571e7eec5ebdbb76efafde4f439f27e0d1f46383fa9bc4a6e956d8f7a2ed811f1b3bbc *bbd67b69fbbd070770fc45403f9487b047d221dfa34ad161183bac128e198fc6af924c918e1206 *c9fac81f50f4510e500d538fd12cd06ed0ed33d030f233a9305bb304b3a6b155b3f771bce74273 *73f3e8f17af365f0370a8c0a6e0a338b1c1175164b12af921890fc208d911194d59173958f5728 *546c511a527ea3f24d15abc6a42ea4a1a4a9a765a17d5cc75d37402f4c3fca20d630c128d138f1 *68a2c9e96309a6f166b1e6d1169196e15621d60136beb65e761ef6ae0ec4e3ce8e274e9c707274 *767439417472757623babb7a787afa7af97b07fb44f846fb9df24f0a4809cc0cba189c1752187a *25ac2cbc32a23ab22eaafe644374434c7d6c7d5ceda9aaf8b2842ba70b137392ce9f399b1c7f36 *3cc52f9578ce26cd285d2d432a93f73cfd05dc851f591f2f4e5d1acabe9d53939b97979c1f72d9 *a9c0b850a188a798a278a764e9cad8d5ee6bf5a5f96549e50115f695ba5552d56c352435df6bdf *d78dd67737345e2f694c6f8abee173d3bed9b045a955e4166b1b39bc826d742c754edf7ede3570 *e7cedde67b75f7cbba8b7a727ab3fa321ea4f6a70c9c7d983298fa286328eb71fe93ab4f6b865b *9e758f0c3f9f1dfd3486186798109fd47b497c15f7ba68eaf6f4d4ccee1b8eb7da73def317dedd *5a985e843e082c992c87ace47dec587db9b6f989eab3f0bac617cbaf6e1b41dfa237e3b74e7f4f *d88efd11fed377e7c4aee99ec6bef801d3aff8b381331027d488d0428c21bd503854397c12dec6 *9463cd71485c073e003e912e909613dce193e52a79134524a5361539d534750d4d04ad1e1d2bdd *2a7d37432ea30f93063313f33acb23d632b658762b0e314e0ce73c571777368f3faf3e1f07df16 *ffb0408560b490a9308ff096c890689198afb8b2044e6242b24c2a405a5106c80cca5e90b39267 *929f5528557457e253faa05cade2059f5116552bd5dce033c95b8d2b9a8e5acc5aafb42feb58eb *d2ea8ee9e5e85b1ad0188c1be61bd919b318cf1e2d33f13c267cecb369bbd929731d0b82c584e5 *352b1f6b19eb7d9bc7b6f976eef6d20ec0e1d9f1ab8e8127d49d289dde39b7b9a4128fbb4ab8a1 *dca6dc9b3dce79ba78297a5379affa3cf42df58bf3b70b900da40afc1c341cdc10921eea136610 *2e108189588cec8faa3c7926da3546239623762f6e1a5e55f212424f1f4b144ec224cd9fb99b9c *7f3638c530952775f7dc445a637a4a8653a6fc79f2f34b17bab30a2e865c32cae6cddecf7995db *9a9795ef77d9a080bf1055b850d45f5c55927ac5efaad935f952b63274d9e7f2a98ac1caf6aaea *ea829accdaa4ba98fa8886d0eba18d114d7137526fe635d7b6f4b6be6d43b54b76b8755ebbbd78 *47eeeec57bdbdd813d1b7d29fda2030b83d787d29f9c1a4e19a91c9d1ae79f4c7b8d9cce7ba33a *f773e1c987e695bab5e6cf835f3f6fd1ff30d9bd7c18ffdfdcd2e19e809107e0f22500ec3a01b0 *d60420930ea695600ba64200ccc800b0520288f50a8068eb0350ede63ffb07f42be7a482334e1e *2001679a867086e90362c105500e3ac1085882605607928373c320e802d4048d405f1074082584 *33e22ca21131096774a2483b640ab20d5e7fe8e14c2d0ed50cef43ec685bf425f4530c1ecebb52 *318fb0a47086958b9dc1f1e2827077f078bc1dbe0ebf4b624e524b0a911e27ed20d0132209afc9 *54c92ac909e451e40b1416140f28e5291ba8b8a98aa9e9a97368a8697268e9698be9b8e91ae8e5 *e8fb18cc19e619c398b04c25ccb2ccc32cdeac68d64a361db60fece91c921caf3813b9c4b8a6b8 *d37954783ef356f19de067e01f17c811b41262127a2b5c271221aa23462fb626de2f714d325eca *455a4f464296558e200fe4b7153614bf2a6d2aef1cc1a8d2aaf1abab68586b866a656b77e8bcd5 *23d15732f0372c379a39ca64627fec8ae9a2b984c529cb116b5e9b38db57f60a0e85c70f4e783b *4db8e8103bddc4dd6b3c79bdaa7c047d6ff82b060c045907af8426843346b445599dfc1e73254e *efd49784d2448b33b8e49e94b8732a697b197de733b26c2f0964ffcc1dcdbf5e905ee457627e55 *b954a09ca192508daa05f5e03aaa89f426430bff2dc5f6639dde5dc9772beef7f72c3d201d901c *b4198a7d726db877647e746f9c6152ec95da94d18cf91bab398b7746efd53e882d33acecafcefd *d5fdb9f84bc4c6d14dceadafdb8f7e16effaed2bfd5a3f1070fc4961be8e15f0c35c8306cc31b8 *c0ccc259984db8090661dee02744073304a630279005dd84c6a0ef085678adf145e420ee2156e0 *5d471b1986ac404ec02b8f2a2a0c558f5a40b3a1ede11c7c024387b1c51463e6b002d8206c170e *83b3c255e2b6f046f832fc0f124b929ba414a4c1a4630425421919812c9a6c99dc817c84428fa2 *9b5285b28b4a85aa1bce578769ece0dc34820e4357442f453fc4e0ce0818af31a933bd634e6511 *6399643dcd26ca3605c7fc08c73a67159723373df728cf055e133e0abe17fc0502ce8242829b42 *fdc27922dea26a620c625fc59f4b344be649c5497bc858c86ac9c9c98b28f02a722a712af3a808 *1d9151d550335377d788d5ccd36ad51ed7d9d6e3d437368831bc6e347f94d9c4063ed7bc3267b7 *f0b2bc658db2b1b56db4c738b81eef3dc1e394eafc9968effad05dcea3c68bc53bdb97d42f3500 *15981c8c0dc908a30e2f8ee48f6a8dd68a198bf33cb59b90932892f430d93505a496a669a4bfcb *4cb9209c357229228735f741be5f016de1bd62cf2b14573b4b89e52415ad558e35e8dac67a9b86 *fdc6aa1b2637bfb514dfd26a5be9c8ba2ddf357b37f9be68f778efa90702fd2f1e263c121f7af3 *e4d2b0feb383e7775ec48eab4f625f4ebcae9d4e9a757d6b34afb420b928b1a4b062b4eaf157fa *e7db5fbe7c93d98adf1edee1db3bf72bfe48800734305f2709b4802dcc23a6816a30003e402490 *24cc069d8163fe164185d085399d56c45f4861a40fb21ef909e610e35083683ab407ba034386f1 *c07463d9b0f1d87738435c2b9e0b9f4d82214920d9218d253d20a492d1c0b35a89fc0545302535 *6527953b350df5204d02ed11da3dba3efa0c063b4621c63da649e666964bac616cf6ec5af0eec3 *ca45ce8de0fec9f38d779d6f9dffabc096e09e3056845694474c56dc40c259f2a454ae748bcc98 *eca63c8b82b6628052a1f2a0cab6aa889a8bfa658de75a046d239d74dd617d6a037bc30aa3cf47 *d54d2e1dfb60a6665e68b16de560dd6d2b6897e7803e1ee3f8d529088e5db8eb9e7bba278b57b3 *8fb1efb27f7aa064d0eb90d430c5f0b5c8ca934e31acb133a7ae2578248a266d25f7a65c38e798 *2e9ab1777e24ab1c8e9a411e5bfe978281a2a292c0ab9aa5b4651f2a3aaa526bacebb8ea57afb7 *3645dd5468fed6dad846eca0e8ecec3a7ee7fbbdf3dd2c3de57d5c0f0a06700f83074787841fc7 *3ce91b463dd318097f5e3a3af862651c31c13029f052f295dc6bb929c969c119e65992d96f6f66 *de76cf95cdc7bfb35f907c8f79ff72b1f643c492d6327ef9c54afe478755d6d599b592bfec3ed1 *7d1af97c6e5d737dfbcb8dafee1b8c1b4fbfc56f4a6dce6d5dfcaef97d63bbea87d54fd4cfd61d *975df2ddae3df77df2fdb60387c3f88779ca481fee1e002268c1f4e39b83830d7e00b0d900ec5d *3a38d8293f38d8ab80930df81b488fffefef1587c61898732f713e443d6c1ea70f9fff7efd1746 *e27b0e48e692c6000000097048597300000b1300000b1301009a9c18000009de494441546805ed *5a7b7054d519ffed33d9cd73f3428291574021a311d2844006185e8255682b9696ca6344a8882d *0a61a633e958699d51ea20add02874c6a8b55a25c0d4d20ed23255071c41e2ab83a23ce4352026 *813c368fcd6673b7df77efdebbf7eeeebdbb7b17867f7266ee9e73bef39deffb9def3b8fefdeb3 *966030881b99ac375239eb1e043068811b6e017ba2abc062b130588bea49b4ab215f5c00a4d846 *12ec8b7f3e3f6be3e3eb67657b32ca8440305d0806194ccac910404879da81775eab985cf3bd57 *1c4ec7a8488d8220c06a8ded49a336594eec9ed41a3279da9499130aaba754bc1a4b795b5b0fde *7bff04388f4ceded52dbd5b6eec8264d3d260052cee665ebb87ebd6eedddce34e7484d2faab082 *a34d67e0f3f58bb91a446b6b178e7c24b535359d4567676f6477a56ee402077165e415e4942bdc *a1022bffe8e81904028248b15a2db0dba5b17c7bb9039f7d7601f219c363313a6ef400b03406e0 *f6fbfab3427ac52c52b9d369c3a4aa51c8ca4ac7f90b5771ecd845853d3ddd81aaca11c8cc4c57 *6891053d00ec029efdce3e7fbf53ee64a4fcf4e9167c7de2b2cc8a8c8c3451b9cba57457dad405 *2300a2150602030c04ed1d5ab3ab477efcab6f71e64cab223727db854a1ab9d3a9275e61353c0d *1980857c29ae775e6ad2dc943a0b4210fc70b2d924ff4b2d20baa0b4c934bd5cdb339a4b54cee4 *6cf2f1a4aa9170384483881390677a47472fc68e1982f1e3872abdbd5d7df8f0f037e8eeee5368 *7a857800783687419069b52006c4e5c620460c2f40797909594952d5dbeb1741182d41e68c0b20 *1279760c10bc2459d1b0e25c544c1c4e3ba384c2ef0fe0f0916f68a3d2df8c9206c0802241304d *5eeb4545d9a82257c9fb02cf1bd96dcc17994c0160210ca2aa7224dc6ea798e7e4b814d9799e0c *544f1a25b6f16a30b30f28c28c0aac74fab4b19ad521f33340bd36998773d3169085a897a64c93 *73a33699276500b220b379ca00fa059ef1d28674ea52374e9ebba2d41301157faf349072f0783b *9edffa06ded8f220767e78197f6fdc17e2f661d78b6ba91c5f7c4a1678969473f2faac785351ce *94747cf2f9712ec44da601f491d5f99c7ba6762ed2b25ca412985a5140235f8300953bbdd15152 *2c34a6010cd00ecdde2fc8cfc7c14fa563f8811fd4c4d261488bef249dee2e6b10fdd4b6aa4e72 *0368dc1e4f0916d5be247abe303f57a7a7966cda023cfa05f36729d2268ef7c06617d0dfc3f19f *0f65e3c6286d4605d31660a10f7dff56fc687a29fc7e1f6ea2ed97d3fad5f7606af92d54920e24 *9168f093340071c5d30f1fbb0394e7ba293e706720149ba0e68ee1623974201aa8969a9206f0e0 *933bd1d57c098df5eb70dfa3f562e41a4bcb8615d5a8ae9c18ab49434b7a0ea80dab2e6ba452a5 *ddab1f03a87993b640c36f1785bc1bc49e1768cd07adb05bd831419cbed405a1df8f31c3f370dd *5ca01ef5075f0d6ec5835bf1e0567c03b662f526c2654f860ded70e1eb731dc8a26d79caed2544 *552fd6c81eda7ad21b91bafbd55e1b56addf16a56e6ecd2d58b5e45e35ab6e39e9ad582d69b94a *f9d0a2dc50680aecffe03c4e9e3aad66d52d9bb6401f45c31c9265ba05bcb2790d595d1acbbb9f *b7a27efb4e5c69eb40221181690b0c84c6b4faa7d58a7226cd282f1063c244df794c0370534866 *75bbb0b9e1103a3aa5938fe3832d7f3d228664b7968e084134ce4cbb80cf3f0ebfece488877ef5 *6a941675acb8ebc55f507becb1c6a646898b263080c4175b747f9962da028c7c67fd1a1a973e0c *81d685555c1bfa3ca601f0081ca2fd82e8f65be0edf6c1690b222f3bfc4d50fa9aa4af9c65a404 *80df8096d6be1c0ac5599c949eaebd1b634b47ca55c3dcf41c60a98f6dda1ba59ce975cfed43c0 *7f9d624256c089bf125f3c77814cd883b7b63d4e2f2576d1db3bff7b1a8d8dfb71e0d027983773 *aac86bf463da025e3f05a324b96ef55c51392b616fff64e66871232a195ac4a4b8c934802ca720 *2adafa97f7f9d3a8a2e8ed436c15a0e54aa742332a989e848c3cb7a8805e525a71ffa3dba9c620 *c2e3995c719b915ea52ddc4321255ed8b17111c21f63c3a236ae9d833497e62bbfae50d3166089 *69e4f4bdf441a2b33788d6362f325c0e0cf184bf17ea6a5535a404e06aaf15cf3cbf07cd2d5755 *2281ae1e1f36ac9882c995776ae8b12a290158befe4f488b2195574387d71ba3259a641a803760 *0d290fe089b50b31e4a67c453adf2515e6481bb142d4299806e0b4f151032c9c3d1ae5e386e988 *8f4f0e4fddf8bc1a0e9e8059b40cf71c388ededef05ad0302550316d011e7d1bed010eb8b174fd *4b51aaea564fc7c4f2b2287a24c1b405188051e7e62bda9511a958ae9bb6002b7f60e154dc3bad *0c0ebb76c2f1ec906205598d7e6e1a006fbcafef3e8837e9c9745bb16ee53db8e3b661f4f1ca2a *5e38eaabd4b69806c06bbd802621cf83ae1e014f6ddd2b4abe737c311e5e321b859e4cad269d1a *df0b4635d14583838879f4dcf2afbd2fd7cdb96bea0fa39842040ec54f9cf7e2edff7c8ca68fbf *d4b02d985d86650ba7118de1c64e46f328768f08aa8d64979664a3a6727c440bf08f035fa06e53 *43145d4d30ed0216b2f7d01934bcbe2fcae70b669763746929b66cdf8d13e205865aa5b66c1a00 *4f42b5f2317471b966d96c9414b3e7a4b485de9cd0c3a12b73c736b66900ec55ba2146ed8abb30 *a5a294de4da3df10fefcbb65141df975955383183d719e546ae9b660d3b646bcb56539d229f038 *7aca8bdf3ff75a4846003b9e5e827c4f1ef2e9e305fd09c350766cbb187469eeb6e3910df53877 *ae1941a11f7c731256ce1ded7898ef1082899d0f4903d8dcf04e089e00178dfedf4dcda17a007f *7862093cb437b0bf0f377d11a21b674903387bf6024914b0ab7e15e97160f73fdf1335acfcf104 *9a80d9f84ded62b1dedbc7f729f1535200782efbc51b119a58d634716eb7d34ec869c66429fc72 *f2c64029272bb19d30a955c068d9c45e527af1520b4eb6482f277c4593e69214eef8dbbb22804e *6f9798c7fb890b80b665cd5e3d677a25f6d01de1634f352ab2e7d58ca0b205f31f79418911ab26 *5ca3f78280d0af71e6cf668e44b638d164fd3eac5cb2400ccfe443796ecdcd748b93233318e646 *1660970b5f1e3b757ededc191a217c69e10b90af8501a43bc3d3e8fef9d59845ff29185ae8d1f0 *1b55f44e4306c6177fc505459edbfff7e9fe3f1614e4f1fabae6290c5f2b9afdcea6ef6b6d6e6b *5bfbcb271bbefbaea54dcb726d6a7a166060bc8772b07f333da3b27333472f5d7cdfc47165a38b *6d563b7fa3e43f8e486b4eac98fb89098045d1ec6725fc8659484f71e8613764d3c36d0c326500 *4693903f86f23dac1cdefa426537e5fc46764d00e85a8014b01518208f96ddc177b39cb3720ed9 *521e3dc910ff2bc6b96e2210bcbcf991c170591e7dca200c2d20a32210ac9053642e5153f84d08 *400af2e37695471497f17a310c0218b4c0a005062df07f9a8d020e3dfb6d3c0000000049454e44 *ae426082 newhex *89504e470d0a1a0a0000000d49484452000000800000006808060000003929f824000017506943 *43504943432050726f66696c6500007801d5596558555bb79e6bf7864d77777797748348a7086c *ba3b2404410409452929954e410109310841444544422514440484a328822875177a3cdf779fef *de7ff7cf5dcfb3e67af718638e39f71ab3c6bb00605a230607fb23280108080c0fb5d0d7e2b4b3 *77e0c44e010ca0027440088813ddc28235cdcc8e82fff5da9a04d0a1724cecd0d7ff6af63f2ba8 *dc3dc2dc0080cc60b5ab7b985b008c6f0180d0720b0e0d0700b90dcb9f478507c318f508c6b4a1 *7007613c7388bd7ee3f543ecfa0ba351bf6cac2cb40140330280231089a15e0090f1c272ce4837 *2fd80f990e0018ea40779f400068ec60ace6e64d740780a900b6110d08083ac4fd301674fd373f *5eff868944d77f7c12895effe0dfff05ae0937ace31316ec4f8cfef5e3ffb208f08f80dfd7af8b *1a2e0981fec70e63430fdfcbee441d63f8c90adffbc1febf6206db40cc1e81d696b0ec108b06ba *1e33fd1bab7986ea59c018ae0b9905876b1d62f89d419ec1e166567fcbe363bcb58fc19800cb73 *3dc274fff829f5251a1dc68c1c96b784465858c39817c63d619196ba30864714f43ec6dbcaf66f *9b6fee1e3a7fcb11084f1f3dc3df36086a9f70c3c3b668e19873fb05191ff6016e0b210f8c813f *f0001120142e038118380ab481cedfa518f00444581309ebc2801ff800e300b846105c2708c69c *7fdb69ff8744ef573d2fb8de7ff7c809dc60db887fdafcdd1a27dce61f9f3ec01dc67fe444b88d *43dd61efc29c7d92fed5e61f8b437fbf7a23d920b922b9fba74f287e94344a0ea5855245a9a194 *00278a1ec50cc450b2284594264a1da502eb94801e780f7bf6fad3c743ff012d9e910541d1ca36 *deb0f6f0bfbbfed1029b5fd63efffcfe8f1e009f676b1d6b7f7a0040b8c749781e00a01d141c1d *eae3e51dcea909cf5c0f514ec3403771514e694929c943f5ff9beb70cdfaddd90d8b5f6b11443f *f22f99e37900e4d4e179fee45fb2e04a009a64016017fe974ca80a9e3ab06d93a25b4468e46f7f *a8c3071a90000a7884320176c00304e1f72c0de4810ad000bac00898022b600f9ce0f1e30d8fc1 *501005e24022480119e022c80345e01aa800b5a011b4800e7017f48287e009780e26c03498038b *6015ac832db00341101622836820268803e2834420694811528374a1a39005640fb9405e502014 *01c54167a00c281b2a82caa03aa819ba0df54243d028f41a9a8756a0afd04f04124140d022d810 *fc080984224213618cb0429c4078214210318864c4054401a21c711dd18ee8453c414c20e610ab *884d24409222e9915c4831a422521b698a74407a224391f1c874643eb21cd984ec420e22c79073 *c835e40f14064583e24489c1e3d400658d724385a0e25199a822542daa1dd58f1a43cda3d651fb *6832342b5a04ad8c3644dba1bdd051e814743eba1add861e404fa017d15b180c861e238051c018 *60ec31be98584c26e60ae606a607338a59c06c62b15826ac0856156b8a2562c3b129d842ec756c *37f6057611bb8d23c571e0a4717a38075c202e09978fabc7ddc7bdc02de176f094783ebc32de14 *ef8e8fc667e12bf15df811fc227e87848a44804495c48ac4972491a480a4896480648664839494 *949b5489d49cd487f4346901e94dd247a4f3a43f08d404618236c1911041b840a821f4105e1336 *c8c8c8f8c934c81cc8c2c92e90d5913d207b43b64d4e432e4e6e48ee4e9e405e4cde4efe82fc13 *059e828f4293c2892286229fa2956284628d124fc94fa94d49a48ca72ca6bc4df99272938a864a *8aca942a802a93aa9e6a886a991a4bcd4fad4bed4e9d4c5d41fd807a810649c343a34de3467386 *a6926680669116432b406b48eb4b9b41db48fb8c769d8e9a4e96ce86ee245d31dd3dba397a243d *3fbd21bd3f7d167d0bfd24fd4f0636064d060f8634862686170cdf19591835183d18d3196f304e *30fe64e264d265f263bac4d4c134cb8c62166636678e62beca3cc0bcc642cba2c2e2c692ced2c2 *32c58a601566b5608d65ad607dcabac9c6cea6cf16cc56c8f6806d8d9d9e5d83dd973d97fd3efb *0a070d871a870f472e4737c7474e3a4e4d4e7fce02ce7ece752e562e03ae08ae32ae675c3bdc02 *dcd6dc49dc37b86779487814793c797279fa78d67939784d78e3781b78a7f8f07c8a7cde7c97f9 *06f9bef30bf0dbf2a7f277f02f0b300a180ac4083408cc089209aa0b8608960b8e0b61841485fc *84ae083d174608cb097b0b170b8f882044e4457c44ae888c8aa24595440345cb455f8a11c434c5 *22c51ac4e6c5e9c58f8a278977887f92e0957090b8243128b12f2927e92f5929392d452d652495 *24d525f5555a58da4dba587a5c864c464f2641a653e68bac88ac87ec55d9577234722672a9727d *727bf20af2a1f24df22b0abc0a2e0a250a2f156915cd1433151f29a195b4941294ee2afd509657 *0e576e51feac22a6e2a752afb27c44e088c791ca230baadcaa44d532d539354e3517b552b53975 *2e75a27ab9fa3b0d1e0d778d6a8d254d214d5fcdeb9a9fb424b542b5dab4be6b2b6b9fd2eed141 *eae8eba4eb3cd3a5d6b5d62dd27da3c7ade7a5d7a0b7ae2fa71fabdf6380363036b864f0d290cd *d0cdb0ce70dd48c1e89451bf31c1d8d2b8c8f8dd51e1a3a147bb4c10264626392633c7f88e051e *eb3005a686a639a6b3660266216677cc31e666e6c5e61f2ca42ce22c062d692c9d2deb2db7acb4 *acb2aca6ad05ad23acfb6c286c1c6dea6cbedbead866dbced949d89db27b62cf6cef63dfe98075 *b071a876d83cae7b3ceff8a2a39c638ae3e4098113274f0c39313bf93bdd73a670263ab7baa05d *6c5dea5d7689a6c472e2a6aba16b89ebba9bb6db65b755770df75cf7150f558f6c8f254f55cf6c *cf652f55af1caf156f75ef7cef351f6d9f229f2fbe06bed77cbffb99fad5f81df8dbfadf08c005 *b804dc0ea40ef40bec0f620f3a19341a2c129c123c17a21c9217b21e6a1c5a1d06859d08eb0ca7 *850f874f230423ce46cc47aa4516476e47d944b59ea43a1978f269b470745af4528c5e4c552c2a *d62db62f8e2b2e316efe94e6a9b27828de35be2f8127213961f1b4fee9da449244bfc4e124c9a4 *eca46f676ccf7425b3259f4e5e38ab7fb621853c2534e565aa4aeab573a8733ee79ea5c9a415a6 *eda7bba73fce90ccc8cfd8cd74cb7c7c5eea7cc1f9830b9e179e65c9675dbd88b9187871f292fa *a5da6caaec98ec851c939cf65ccedcf4dc6f79ce7943f9b2f9d72e935c8eb83c5770b4a0b390b7 *f062e16e9177d144b156f18d12d692b492ef57dcafbcb8aa71b5e91adbb58c6b3f4b7d4a5f95e9 *97b597f397e757602a222b3e54da540e562956d55533576754efd504d6ccd55ad4f6d729d4d5d5 *b3d66735201a221a56ae3b5e7fdea8d3d8d924d6547683fe46c64d7033e2e6c76697e6c916e396 *be56c5d6a65b7cb74ada68dad2dba1f6e8f6f50eef8eb94efbced1db46b7fbba54badaee88dfa9 *b9cb75b7f81eddbdacfb24f793ef1f74c7746ff604f7acf57af52ef439f74d3fb07b30de6fdeff *6cc078e0d143bd870f063507bb1fa93eba3ba43c74fbb1e2e38e27f24fda9fca3d6d1b961b6e7b *26ffac7d4461a4f3b9d2f3aed123a3f75fa8bfe81dd3197b386e38fe64e2d8c4e8a4f5e4ab978e *2fe75eb9bf5a7eedfffacb54e4d4cef4e919f44cfa2ce56cfe1bd637e56f85dede98939fbb37af *33fff49de5bbe905b785d5f761ef7717933f907dc85fe258aa5b965ebebba2b7f2fce3f18f8bab *c1ab3b6b297f51fd55f249f0d3adcf1a9f9faedbad2f7e09fd72f035738369a3e69becb7be4db3 *cd375b015b3bdfd3b799b66b7f28fe18fc69fb7369276a17bb5bb027b4d7b56fbc3f7310707010 *4c0c25fe3a0b20e112e1e909c0d71a3887b0877387e70090f4fcce297e59c0e90a04dbc0d806e2 *816e227c914a283c6a09dd8329c026e1a2f01e24f6a40e047b3227720f0a5fca08aab3d44534ad *b48fe95618d08cbc4c7accde2c19ac2d6cb31c384e192e67ee0c9e2ede657e760163c178a126e1 *79517a3103f1588926c959694a192dd960b932f911857d2561656b958423f5aa636a3f34d83535 *b53cb5cfe9d4e83ed45b300086ac46f2c66647bd4de28fe599d69b759b8f5b2c5bee5a53d870db *cad9e9dbdb3bf81f8f77cc3a51ee74cbf991cb34f1931be44eeb21e879c4cbccdbc327daf7bc5f *b97f7bc0e3c037415f43d0a18c6122e1aa11c7225da2824e264467c614c656c5dd3cd519df9bf0 *e8f470e268d2f89989e489b3e329a3a9c3e71ea5f5a6dfce68ceac395f72e162d6998be1973cb3 *6d73f472e5f278f2a9f20f2eaf16bc2c7c5074a3b8a824f94ae055bb6b5aa52265b4657be58b15 *c3956d5557aacfd6f8d75ad629d77336601bfeba3eded8d5547a23e5a65fb3458b422bdb2de4ad *e5b667edb73a8a3a4fdff6e832be237997feeeeebd77f71f7537f5e4f646f7393fd0e9171ea01c *d87c383dd8f3a86a28ed71e0138ba70ac32cc307cf16461e3eaf1fcd7c113466312e37c130f163 *72fae5dd57575f274c11a7b5667867d1b34b6f1ebfbd3e77713ee29dc382e67ba1459ac5fd0f6b *4bb3cbcf571e7eec5ebdbb76efafde4f439f27e0d1f46383fa9bc4a6e956d8f7a2ed811f1b3bbc *bbd67b69fbbd070770fc45403f9487b047d221dfa34ad161183bac128e198fc6af924c918e1206 *c9fac81f50f4510e500d538fd12cd06ed0ed33d030f233a9305bb304b3a6b155b3f771bce74273 *73f3e8f17af365f0370a8c0a6e0a338b1c1175164b12af921890fc208d911194d59173958f5728 *546c511a527ea3f24d15abc6a42ea4a1a4a9a765a17d5cc75d37402f4c3fca20d630c128d138f1 *68a2c9e96309a6f166b1e6d1169196e15621d60136beb65e761ef6ae0ec4e3ce8e274e9c707274 *767439417472757623babb7a787afa7af97b07fb44f846fb9df24f0a4809cc0cba189c1752187a *25ac2cbc32a23ab22eaafe644374434c7d6c7d5ceda9aaf8b2842ba70b137392ce9f399b1c7f36 *3cc52f9578ce26cd285d2d432a93f73cfd05dc851f591f2f4e5d1acabe9d53939b97979c1f72d9 *a9c0b850a188a798a278a764e9cad8d5ee6bf5a5f96549e50115f695ba5552d56c352435df6bdf *d78dd67737345e2f694c6f8abee173d3bed9b045a955e4166b1b39bc826d742c754edf7ede3570 *e7cedde67b75f7cbba8b7a727ab3fa321ea4f6a70c9c7d983298fa286328eb71fe93ab4f6b865b *9e758f0c3f9f1dfd3486186798109fd47b497c15f7ba68eaf6f4d4ccee1b8eb7da73def317dedd *5a985e843e082c992c87ace47dec587db9b6f989eab3f0bac617cbaf6e1b41dfa237e3b74e7f4f *d88efd11fed377e7c4aee99ec6bef801d3aff8b381331027d488d0428c21bd503854397c12dec6 *9463cd71485c073e003e912e909613dce193e52a79134524a5361539d534750d4d04ad1e1d2bdd *2a7d37432ea30f93063313f33acb23d632b658762b0e314e0ce73c571777368f3faf3e1f07df16 *ffb0408560b490a9308ff096c890689198afb8b2044e6242b24c2a405a5106c80cca5e90b39267 *929f5528557457e253faa05cade2059f5116552bd5dce033c95b8d2b9a8e5acc5aafb42feb58eb *d2ea8ee9e5e85b1ad0188c1be61bd919b318cf1e2d33f13c267cecb369bbd929731d0b82c584e5 *352b1f6b19eb7d9bc7b6f976eef6d20ec0e1d9f1ab8e8127d49d289dde39b7b9a4128fbb4ab8a1 *dca6dc9b3dce79ba78297a5379affa3cf42df58bf3b70b900da40afc1c341cdc10921eea136610 *2e108189588cec8faa3c7926da3546239623762f6e1a5e55f212424f1f4b144ec224cd9fb99b9c *7f3638c530952775f7dc445a637a4a8653a6fc79f2f34b17bab30a2e865c32cae6cddecf7995db *9a9795ef77d9a080bf1055b850d45f5c55927ac5efaad935f952b63274d9e7f2a98ac1caf6aaea *ea829accdaa4ba98fa8886d0eba18d114d7137526fe635d7b6f4b6be6d43b54b76b8755ebbbd78 *47eeeec57bdbdd813d1b7d29fda2030b83d787d29f9c1a4e19a91c9d1ae79f4c7b8d9cce7ba33a *f773e1c987e695bab5e6cf835f3f6fd1ff30d9bd7c18ffdfdcd2e19e809107e0f22500ec3a01b0 *d60420930ea695600ba64200ccc800b0520288f50a8068eb0350ede63ffb07f42be7a482334e1e *2001679a867086e90362c105500e3ac1085882605607928373c320e802d4048d405f1074082584 *33e22ca21131096774a2483b640ab20d5e7fe8e14c2d0ed50cef43ec685bf425f4530c1ecebb52 *318fb0a47086958b9dc1f1e2827077f078bc1dbe0ebf4b624e524b0a911e27ed20d0132209afc9 *54c92ac909e451e40b1416140f28e5291ba8b8a98aa9e9a97368a8697268e9698be9b8e91ae8e5 *e8fb18cc19e619c398b04c25ccb2ccc32cdeac68d64a361db60fece91c921caf3813b9c4b8a6b8 *d37954783ef356f19de067e01f17c811b41262127a2b5c271221aa23462fb626de2f714d325eca *455a4f464296558e200fe4b7153614bf2a6d2aef1cc1a8d2aaf1abab68586b866a656b77e8bcd5 *23d15732f0372c379a39ca64627fec8ae9a2b984c529cb116b5e9b38db57f60a0e85c70f4e783b *4db8e8103bddc4dd6b3c79bdaa7c047d6ff82b060c045907af8426843346b445599dfc1e73254e *efd49784d2448b33b8e49e94b8732a697b197de733b26c2f0964ffcc1dcdbf5e905ee457627e55 *b954a09ca192508daa05f5e03aaa89f426430bff2dc5f6639dde5dc9772beef7f72c3d201d901c *b4198a7d726db877647e746f9c6152ec95da94d18cf91bab398b7746efd53e882d33acecafcefd *d5fdb9f84bc4c6d14dceadafdb8f7e16effaed2bfd5a3f1070fc4961be8e15f0c35c8306cc31b8 *c0ccc259984db8090661dee02744073304a630279005dd84c6a0ef085678adf145e420ee2156e0 *5d471b1986ac404ec02b8f2a2a0c558f5a40b3a1ede11c7c024387b1c51463e6b002d8206c170e *83b3c255e2b6f046f832fc0f124b929ba414a4c1a4630425421919812c9a6c99dc817c84428fa2 *9b5285b28b4a85aa1bce578769ece0dc34820e4357442f453fc4e0ce0818af31a933bd634e6511 *6399643dcd26ca3605c7fc08c73a67159723373df728cf055e133e0abe17fc0502ce8242829b42 *fdc27922dea26a620c625fc59f4b344be649c5497bc858c86ac9c9c98b28f02a722a712af3a808 *1d9151d550335377d788d5ccd36ad51ed7d9d6e3d437368831bc6e347f94d9c4063ed7bc3267b7 *f0b2bc658db2b1b56db4c738b81eef3dc1e394eafc9968effad05dcea3c68bc53bdb97d42f3500 *15981c8c0dc908a30e2f8ee48f6a8dd68a198bf33cb59b90932892f430d93505a496a669a4bfcb *4cb9209c357229228735f741be5f016de1bd62cf2b14573b4b89e52415ad558e35e8dac67a9b86 *fdc6aa1b2637bfb514dfd26a5be9c8ba2ddf357b37f9be68f778efa90702fd2f1e263c121f7af3 *e4d2b0feb383e7775ec48eab4f625f4ebcae9d4e9a757d6b34afb420b928b1a4b062b4eaf157fa *e7db5fbe7c93d98adf1edee1db3bf72bfe48800734305f2709b4802dcc23a6816a30003e402490 *24cc069d8163fe164185d085399d56c45f4861a40fb21ef909e610e35083683ab407ba034386f1 *c07463d9b0f1d87738435c2b9e0b9f4d82214920d9218d253d20a492d1c0b35a89fc0545302535 *6527953b350df5204d02ed11da3dba3efa0c063b4621c63da649e666964bac616cf6ec5af0eec3 *ca45ce8de0fec9f38d779d6f9dffabc096e09e3056845694474c56dc40c259f2a454ae748bcc98 *eca63c8b82b6628052a1f2a0cab6aa889a8bfa658de75a046d239d74dd617d6a037bc30aa3cf47 *d54d2e1dfb60a6665e68b16de560dd6d2b6897e7803e1ee3f8d529088e5db8eb9e7bba278b57b3 *8fb1efb27f7aa064d0eb90d430c5f0b5c8ca934e31acb133a7ae2578248a266d25f7a65c38e798 *2e9ab1777e24ab1c8e9a411e5bfe978281a2a292c0ab9aa5b4651f2a3aaa526bacebb8ea57afb7 *3645dd5468fed6dad846eca0e8ecec3a7ee7fbbdf3dd2c3de57d5c0f0a06700f83074787841fc7 *3ce91b463dd318097f5e3a3af862651c31c13029f052f295dc6bb929c969c119e65992d96f6f66 *de76cf95cdc7bfb35f907c8f79ff72b1f643c492d6327ef9c54afe478755d6d599b592bfec3ed1 *7d1af97c6e5d737dfbcb8dafee1b8c1b4fbfc56f4a6dce6d5dfcaef97d63bbea87d54fd4cfd61d *975df2ddae3df77df2fdb60387c3f88779ca481fee1e002268c1f4e39b83830d7e00b0d900ec5d *3a38d8293f38d8ab80930df81b488fffefef1587c61898732f713e443d6c1ea70f9fff7efd1746 *e27b0e48e692c6000000097048597300000b1300000b1301009a9c1800001495494441547801ed *5d09781455b6feb3743ae9907d1362086b102224808140049e8a12443332f0dc1077709979cc40 *7c9fdfe353749627fa3e651c7ce0322333a3833342701447c179a0a2e04222208a281834c404c8 *9e743ae94e3a9d77ceadaeea4e67315de90edd95bedf575db7aa6edfbaff39e79e7beea9537583 *3a3b3b1148439702c143177a003953202000435c0e0202101080214e81210e3fa001020230c429 *30c4e187f6177f5050106b8b20a7adbf7ff546391b55ca1b681a3b28f358ade20ffa31fa11f010 *a273e8ca9537451516aebc223a3a2a13b6ce709bad938561505370303537a8d362349abedcb8f1 *4f7b366d7aa9991a60a5cde62d41d03afe3e05c00e5ebf67f7cbd367e5e5fc5917163ac695e336 *9b0dc1c13d9b127d5d73adc7dde3f636eba98f0f14df3e3f7f7909fdb78d368f0b416ff8fbc2d5 *d7357731f655de53f87be61cdd99c0f335fde597cf4eca9d7dc95f7a627e7d7d0bdedf7702bc77 *4d0d0dd2b5ba7a93eb258f1c737bb85df3e75f9a4415ea69f3a846ea0d7f3de179ef7dc6dc1d97 *84f91bd4d6b262f26ef214fe1e0580c03331d93e88282c5cb1304caf1bed0a87c116977c07b3b9 *5dec9d85a0a6a6199f1e94ae95947c8fa6a656d7bf7be498dbb57af55d57733b69d3d9db3de0ba *7bc35f5767c2c1e2ef61b1b4d3fe3b300de4545363c4279f9e227a58f1d9a132188d66f992d7f6 *9ec0dfa300d85baca37d647c7c5c962b0206ce04b05a851d464340104243a5aace9c6d2481f81e *1d1dd23596256f9a698989f153a87d06dad856f1a416e8865fa70b414888748b8e8e4e418346bb *701b0c7a85064c17b973b8d2ced3c703c5df9b00f0792680a1bdad3dcab9d1aecc0f0b0bc1cc19 *631015158ed3e575387cf8345be6e22fe1e13accca1d839818eea0de4916735b34d5cc02c0eded *0d8fbb37ef113f639c415859103831a30f92a6630d673084e1924b469180484d604dc0dacf6aed *70f7de6e951f28fede08c662ce28c3da2c6d61728bfa627e696935befcb2422e8ac848bd60feb0 *61e1ca396f64484099f16c03f47b4adb8f76f4889fff174d429093e360747b7b87d004cdcd16c4 *c618306d6a9a527d130d0387a843b061e8ad3450fc7d0980e805d68e0e21ee0d8d5dd5be73cf3f *fef5197c73e2ac8231263a42303f2242911de59aa733f6f631f3b9bd9e1a02b89e2ef89ddbcd8c *9e3963b4d2dbdbda3ac8e6390593c982a4a4685c7c71aa529ced21e78ea15cf05066a0f87b1300 *6e9e2028a97341549eea49b6a1d472f20390644baa5e567b32269678f99a7cce5b7bba17b753b4 *d5c3f7e882dfb56ec6280f757c8ded20de3875baf4f860fbb0202e7af867a0f819645f49e951ac *fa58ea9dc73fb6f41b1b5b91313e0593260d57ea31923afcf813a9472827fd33a3e0776e3e4f01 *8b4bca1421d7eb758236acf1ce9211fce5b14aa57872721432278d508e7d2df36302c052ae1021 *9a547b572160d52709c1a8f4446465a591969020b6b6b60921f0d614b00742f29d95b6f6705dd5 *2967fc5c8134143a6639d250388a8c40bdf00d1cf9bc5cd1946cfc4ecd1ea91cab6a40ffffa40a *ff8f0a80ebfd7b12029e1232a35347c462fab4744515b6b559c5dcb827a7896bbdfe70dc646c15 *56bf3cc5d5e982a9438c011bbacdcd66947ce6d00a6256303d5db1137c159fdb02c0405c8580cf *c973fde4e4689a2a8d56e6c46c37c8c30697f3e764a3b9bf9cd8ef3173a634fde573168b55b1f6 *19ef25c47c1e1a7c3da9120006c542302367b498fff2de79ae1f1f17895c220ef7029e32797b2a *3858448e8d25eb7fa61d3309797494c3bf9190300cb3668d25cc3ac17c7fc13ca0b933337ddedc *8c1ec7381690deae0d16c3bc719f986843afb85820e6cd9dd0233dbcd1164fd4a95a03c837779e *1acae7e47d5fd7e432feb8ef0b575fd77c11eb8005c0174105dad47f0a0c58004cd5b5a8b5f00d *4d38f2d121ecfee06b943579d7ffdd7f78de2fd96ee3d997641c7e5b69c2c9b25ae5d8fb771ff8 *1d06640394bef3061e7cbd02056b9663cac11df8ed7efbe3d1bf7d8e879eb801d9fc9846c3e9c3 *e30df8fdc657f0ca863bb0ede3b3787dfb2e3b5a338a9e5d45f90191775028a75e03749cc15f89 *f99cc29a2bb05b66be38538b6d1f9c11392dfffc0f319f93d11c8cbf2bcce733e138f4f971cef8 *7c522f008d8d3845f0262f5d8ac58946705c16c65d8aad4f2f023f0fab6fe1282ded260b697d7e *d4b5be7001f464fdf333cf39d313a9e7df2f82149b8c8e60115fa6826a01b05ada68d40752e343 *70bce41b81316fee58e87d5feb79841f1de421e7d13f3121011f1e969e842efb499e47ea1ecc4a *54b32b343e1e19d4d2dd2fbc8adda2c5064cbfa01e9b1f780be5749c11c3fd43bb2922b813ed04 *6fc55a6918e0e0e4b8b8345c5ff8a218f9931262fd02bc6a0d00fd705c33830371ec69e414cc4c *06be10a17009b8798ee3e9a05c444b7beefd05d75ea1409a36290e21a136b4b770fca3199913c7 *2bd77c39a35a0370c0d0ec3b962135b71c55e6108c9942be6f3460e9a25c8c9a9b85b14eb2e1cb *041848dbeeba7a0216cf1b87b636332e20f737a735f72ec29cac91946311f1fde4b600589a8c68 *b00623213e1c963a3386a5246118e36c34a29684227b3649beb505a68e28448a5822df27823b2d *14337efae1c7defc6c28d640200d91f45282544b1e7504cedb6343dca9fabc94755300ccf8c7fa *9751d4108d477f3d07afac7b0b277a6976da5505f8dde20b7bb9eabfa7ef78641b9aab2ab17dd3 *6afcf4679b44246a4f681eb83317b939d37abae453e7dcb6019c27777d45fbd769741ae8acd89d *f3ae5c6d30767f71c4b58c2f1cbba901c2b1e4bf966311c97d4cb40e8ffef77234d5d6c3121587 *b8b0161c2b2945554704c6678ec6a8c42ed1e4be80d5236dd8f2abebeda37b275edb4c73fece60 *8406b1feef446965336ced6d189f1eafd52180de1489a6b1dd4eca9ae2779d5cc1bbb051f606ee *3c21b9823d4272dfaac4b9d71ff83ae00a16dc09b88203aee0802b98ba42c0151c7005fbd678d5 *8fd6b869043a6a0cb88203aee0802b38e00a0eb882879c2bd83108704e87f43149b09e3a8b6307 *0ea13d220aa9d3c7636cb4067dc05d812b4771e4ef6ea0ef537c53d68828720bcf9eccd110ce93 *45a5a84f6654db008ca6f16431566d28167101cee8223373b1f9e7d3147f81f3352de5eb5a43b0 *62cd33ddd8bd206f2456dc728d5f4075db15aca0a290b0a79d981f492f4dc80e22d3b14ff0e4de *2aa5a85633b739317f7872ac3d341478e7c0699cfcb6d42f60abd600d6ba3a111286f0543cf4f0 *d5c88ee7d7a0da71e49f6fe3b76f55a0a1c9f9a9815fd0c2ad465a281a98435e86196cf8f393f7 *93d697fad27b9fd760d373db505bdf087f880850ad0164c9499b3bc3ce7ca69f0ed90ba78b9840 *7a58ea1641fdadb08ceede1b7315e63386cbb212454ca0f4c902df47a55a00903412732812b2fc *5f7bb1f38b2a98e8cb59a6ba33d8f1ec1e111296396a182c2d66343699ed04f17d62b8d3420385 *84051b22f0e496fd84517af2c7f1011bfefaa908099b306e943bd59db7b2724776bf0196461c13 *e15f4d786973115e72a9c13956f0a1a76e47b6c62284f8f91f877f85d24070d7837f7141df3556 *b0e8d99fd375f57dad5be51e3ca1be551d6d14f93674130b80ff4cf67ae7937a0d6048c3a3eb6e *803534a4f7f75fe81369d6d070a468acf73339b9e76cdb743fed7b1703fa8a105df76d51512f00 *64f0a50c4f2032b4e3dc779538dd40f141a1c33072ec7062f8d07004d107422875c2d41604a3c9 *8cb0904ec447f32b225292a8d0bb80c8e5cee77e000240cd6e2ac3e38fbc851297b1206fe962ac *be42db61e1cc34fe4cf9f2c23fd943c1f98c941e2b5c888c71a3e5439fdeabb701c8ffb7634377 *e633da0345ffc0ceeff8b5096da75f3cfe6637e633e2b54fed82b54d9331814e0c6da9c1fe737c *9c82356bf3313b8dfc8016233e287a9b42c36ab1eba372148c1ee3f4076d65f9db9f1565e564ff *b4e0d5677e492f85848ad17edbbba5d8befd1decd97f08f997cff179d0aa3580e55ca598efa72d *9a2d319fa1eaa33077599e7004c5253abe9fe3f35450d140631b0583d2ffd6debb40309fabe0d1 *fe86cbc78aa1216d38bd26e50749b500e85346084697ef3d88e26abb11d061c647db0e08c1a8a7 *0f486a394585d904a337beb48f96aa707c0bf88dfdac1580eada26bf80afde0834246226bdff58 *de508127d66d21b0d2b30019f5fca923e4ac26f7dc73629313e925911a2cfdd97374c442e0e84f *b3a65fe417b81d2d76bbb991b8f13ff33159f99fc3e8bbe4ba022c19ef980e2945349679fed1eb *21be8e23703948f9e8aa2ba1a7d8087f48ea3500a38b1f83479e5d81b293e5a8a826951f1181f4 *b16948a597468642d2d3a0ff267d10a2a9b51335f5464446906f24cebf6c9f010940e3c9a3787a *eb219c6a74f47ec1785a4626f5aa45786c71baa6e5a0ae3518eb7fff1aaaaaebbae06ca687600f *dc391bb372b2bb9cf7c503f502200242f6e38b5e5055b4c80f4c7b29a081d3b7adf95fb152852b *149e0d341a8daea77df258b500582bcfd8996f40fe75d39095eca4fae819802e31c527017baa51 *467a459e9729617fe0c3ab9620e502768b4b899792498af10f77b86a01088d9442c04cd979b87b *813fc4bec8ecf1cc3e2c841ff5004be68f45d6c454cf547a1e6a7198aeeede3c3e0d0bf9333847 *8ee28393b56814c11f26111cc101120eebd8dd8afda33c1b8051340d7c6dcf71b4b6fa2f5ad51a *00967a1c6d60669dc3c60daf76e35ac6a2023c768df63e102103e5de5f4f3e001d2d58b67ccd8b *f26965bff6de79989695a91cfb6a46bd06a08090fa3e5055346a3b289405a02fe255d5769d19f4 *41aaf37a49bd06d087d31269e3317ae6244c1e2107844b5878adbcd0c8e8f30accdb3767e62f5b *3207d7cccd848e82629c135b0752ac80f359dfccab17000a023d74f824dea10de109c8cfbf1857 *e664205d8487fb26584fb68a1dbf5b777c88bfd336cc108cd5772fc2948b52e9e351c162c1454f *decb9b75a91780903064901158cd7680b916bb5fdf27b6a491e9f8497e16664db9107e32135245 *5f9eeb279211c87640738b0dbfd9f8a6a8279b5608bbe796f9488a13df4e5355f760fe49bd00d0 *872257afbf1f2bebaaf0d597a5282e2ec5bbdf36a1fa7419fef8026d8422237b2aeeb97d16d2a5 *09f360e2f2fabd5800fe40df0be250f013a78d78e3ff3ea345a3bec291af2a71dfda97c4fd0be6 *67e2d6257329cfa57d33f565c7f4abc591f1c9c898380a1326c4752b7fe2c86114aeff58d35342 *5e4b7a5c5a34f2722675c3bf73cf31ac7d9c9f94fa6e52af0160c4de6d1fa0e8bd3254bbe0cbc8 *9e84dc540b76bc550ad3b92a9c25af707a573bc9e51ffe79f8e6feefb065ebae6e637ec17cfa52 *eab871d8f0dc0e9c100b48f82e3ef502d052dd85f991292928b86a2afe8d964b4bd033b7cd68d8 *5b8a9de67ad4939f245d63a1e16c043a337f3c2d9c79ffadf39136225ee1f6067a73082d1c3aca *a507ac6c957a3d99512f00212188233748c655d35170e924fa26003d00b174205c309f9ba8c315 *2bf3310531b85863cc67743caad30ac928bcf32acc9e3e8ede0dedfe86c00bbfbe95a283d81fe2 *9bcc671caa04a0f6f851fce1d5e3c8a5a5620a28f0a374ef3b585a54caf5513260e9caeb70e3d4 *58a44e1c03fff5924b687afaad3605e1f167b6e3d50db7219c023f8abf35e289a75eb617b5e2f9 *c76e41425c3c12c4c7929d1e92f554d9793ee7b668361edf8f7b36ee47c9b95afa6834a9fabaa3 *7850613ea36941d10bdbf1917f38c2dc267f952914f73db009656555b44a783b78e51007f3b9ba *50dcc36b0874fac7f3013705a01dfb5e3f6a279a0ef44d0494ee938f0db869f93ce4d1397e5b68 *fbbe1fece5b4b57b72cb6e3b201b054045e15f2555f6632b7ef7f02d8823df00abfc4f4a8ef905 *703705c0841f045e1dee5b7727f28777a0f8a014fd9a74e95c2c999d8995374f9280b76b3320e4 *fbefcb099f0d459b56109f75d8f1cff705debbff7d2a1980d158577893386e254fa93f24f704a0 *a50e2745047834462593fa6fa9c4a7ec09a4346f863d0ad86e554468f0fd40b6e5dbc48a2064d8 *05eb856ddf409e404e97cdca16fb30760c508a89d2a227d09002b2ed2814bc16ef7dfa03eaea0e *8b77008004648fe4286013f6be4dcf0628d56b30248c7b0bab782331bda2b21a27aba5974378ca *ab8f9018fefcdfde13f89b8ccd62efeb3f3f3a0ba0b570f9c9a73d456222cde976d257c177bfbc *d3be58145dcaccc245fa2afceabe22254670de646d848475c50f5c392f07afd11a81bff8cd7699 *28c8cf1b45f9205c7bdf66254670c6548dbc17d06eb57619cc726ebc1af9c2d093f127e0a15b09 *aca595be9727a5c8cc4bb178226b04ef277bfb5848e5cda33775c57ff3e5b46cbc30f4e4db9871 *f72d05e2e634288ab420ef425a4526462ee0d5fd40f1f7a50178c8b37df5d589d3f90be6394084 *24e3eef5f7e0daf22ad4d33470f8c864e9a99f250233674cc0828b27e1b29ce14a4f70fcd13b39 *6e1fd5ec0de6f78c9f6ec68b4698ad34d6dbc8f115e630a3965e9b8b2b7246637852f7e722de41 *0f0c147f506727d3ae6b22b5c782c1fd7c447272e2e42387773d9d9818c7f31b9f4a3535f535d9 *5317feb2aaaa86e7a295b435119e2e1a4b4d8387127e87f876a5144b0513d242c4ad5ff51febb6 *9c3b57d3570458d77f0fc211b767d5aa752f52fbd8e5c4fe56d9e9ee89bb0f19fcbd6900160cf6 *6172b03b47768e898d8d1ebb6cd975d3264e1c3f421742d12094884ad29c870f062151cfb4b55b *dbadc78f7f5bb175ebeb9f353434b1fff9146d15b4f1baedada40158750f28d17d860cfe1e0580 *a947446026f31b8e49b4f1249f371e0638d88faf3191065500e87eec5d621f2bbf76c34fa159ed *f3c69371f648594900ba8f6974c1dd3454f0f7650432b1f9257fd9abcf2e20cef3b33d8ef1196c *0160c6729b7868e24976236ddc1e1e9a78a9ee01f77caac3390d09fcbd6a00a604f5021610eeed *3c1c70e82fef99f9fcfaef60f77ebaa560328ff52c8c2c9cfc211eceb356b079aaf7535d220d05 *fc7d0a00538188c0d35bde6461e0bcdcfb075b08c4d48ceecf42c01b6b03de33ef3da2faa9ae2e *49ebf87f5400981a4404663827d7bd7476f07e6526cbea5eecbdc57c199696f1f74b00644204f6 *daa380dca3b5872c80a85f14080840bfc8a4dd420101d02e6ffb852c2000fd2293760b050440bb *bced17b28000f48b4cda2d141000edf2b65fc80202d02f3269b7504000b4cbdb7e21fb7fd01098 *569cca7b2b0000000049454e44ae426082 hunk ./html/Ocean.std-theme/ocean.css 12 - font-family: sans-serif; hunk ./html/Ocean.std-theme/ocean.css 15 - line-height: 1.4; + font: 87.5%/1.4 sans-serif; hunk ./html/Ocean.std-theme/ocean.css 27 -h1 { font-size: 150%; } +h1 { font-size: 145%; } hunk ./html/Ocean.std-theme/ocean.css 29 -h3 { font-size: 120%; } +h3 { font-size: 115%; } hunk ./html/Ocean.std-theme/ocean.css 31 -h5 { font-size: 105%; } +h5 { font-size: 100%; } hunk ./html/Ocean.std-theme/ocean.css 102 + font-family: monospace; + font-size: 115%; hunk ./html/Ocean.std-theme/ocean.css 106 -code { /* background: #f0f0f0; */ } +code { + font-family: monospace; + font-size: 125%; +} + +code code { + font-size: inherit; +} hunk ./html/Ocean.std-theme/ocean.css 117 + font-size: 125%; hunk ./html/Ocean.std-theme/ocean.css 142 - max-width: 50em; hunk ./html/Ocean.std-theme/ocean.css 158 - max-width: 48em; - margin: 0 auto; + margin: 0 1em; hunk ./html/Ocean.std-theme/ocean.css 169 - font-size: 200%; + font-size: 175%; hunk ./html/Ocean.std-theme/ocean.css 178 - font-size: 75%; + font-size: 85%; hunk ./html/Ocean.std-theme/ocean.css 252 - font-size: 80%; + font-size: 85%; hunk ./html/Ocean.std-theme/ocean.css 281 - font-size: 90%; + font-size: 85%; hunk ./html/Ocean.std-theme/ocean.css 316 - width: 22em; hunk ./html/Ocean.std-theme/ocean.css 15 - font: 87.5%/1.4 sans-serif; hunk ./html/Ocean.std-theme/ocean.css 26 -h1 { font-size: 145%; } -h2 { font-size: 130%; } -h3 { font-size: 115%; } -h4 { font-size: 110%; } -h5 { font-size: 100%; } +/* @end */ + +/* @group Fonts & Sizes */ + +/* Basic technique & IE workarounds from YUI 3 + For reasons, see: + http://yui.yahooapis.com/3.1.1/build/cssfonts/fonts.css + */ + +body { + font:13px/1.4 sans-serif; + *font-size:small; /* for IE */ + *font:x-small; /* for IE in quirks mode */ +} + +h1 { font-size: 146.5%; /* 19pt */ } +h2 { font-size: 131%; /* 17pt */ } +h3 { font-size: 116%; /* 15pt */ } +h4 { font-size: 100%; /* 13pt */ } +h5 { font-size: 100%; /* 13pt */ } + +select, input, button, textarea { + font:99% sans-serif; +} + +table { + font-size:inherit; + font:100%; +} + +pre, code, kbd, samp, tt, .src { + font-family:monospace; + *font-size:108%; + line-height:116%; +} + +.top > .src { + font-size: 116%; /* 15pt */ +} + +.top .src .link { + font-size: 86.2%; /* 13pt */ +} + +#module-header .caption { + font-size: 182%; /* 24pt */ +} + +dl.info, #table-of-contents, #synopsis { + font-size: 85%; /* 11pt */ +} + hunk ./html/Ocean.std-theme/ocean.css 148 - font-family: monospace; - font-size: 115%; -} - -code { - font-family: monospace; - font-size: 125%; -} - -code code { - font-size: inherit; hunk ./html/Ocean.std-theme/ocean.css 151 - font-family: monospace; - font-size: 125%; - line-height: normal; hunk ./html/Ocean.std-theme/ocean.css 201 - font-size: 175%; hunk ./html/Ocean.std-theme/ocean.css 209 - font-size: 85%; hunk ./html/Ocean.std-theme/ocean.css 282 - font-size: 85%; hunk ./html/Ocean.std-theme/ocean.css 310 - font-size: 85%; hunk ./html/Ocean.std-theme/ocean.css 175 - padding: 0 1em; + padding: 0 2em; hunk ./html/Ocean.std-theme/ocean.css 190 - margin: 0 1em; + margin: 0 2em; hunk ./html/Ocean.std-theme/ocean.css 22 -a:link { color: rgb(196,69,29); } -a:visited { color: rgb(171,105,84); } -a:hover { text-decoration:underline; } +a[href]:link { color: rgb(196,69,29); } +a[href]:visited { color: rgb(171,105,84); } +a[href]:hover { text-decoration:underline; } hunk ./src/Haddock/Backends/Xhtml.hs 609 - = nothingIf summary $ groupTag lev << namedAnchor id0 << docToHtml doc + = nothingIf summary $ groupTag lev ! [identifier id0] << docToHtml doc hunk ./html/Ocean.std-theme/ocean.css 358 -#interface div.top { margin: 1em 0 0.5em 0; } +#interface div.top { margin: 1em 0 2em 0; } hunk ./html/Ocean.std-theme/ocean.css 455 - font-size: 75%; + font-size: 77%; /* 10pt */ hunk ./html/Ocean.std-theme/ocean.css 461 - font-size: 160%; + font-size: 130%; hunk ./html/Ocean.std-theme/ocean.css 468 - font-size: 130%; + font-size: 100%; hunk ./html/Ocean.std-theme/ocean.css 477 -#mini #interface .src { - font-size: 120%; -} - hunk ./html/Ocean.std-theme/ocean.css 499 -#module-list .caption { font-size: 130%; } +#module-list .caption { font-size: 131%; /* 17pt */ } hunk ./html/Ocean.std-theme/ocean.css 509 - font-size: 70%; + font-size: 77%; /* 10pt */ hunk ./html/frames.html 1 - - - - - - - - - - - - - - - + + + + + + + + + + + + + hunk ./html/haddock-util.js 27 +function setCookie(name, value) { + document.cookie = name + "=" + escape(value) + ";path=/;"; +} + +function clearCookie(name) { + document.cookie = name + "=;path=/;expires=Thu, 01-Jan-1970 00:00:01 GMT;"; +} + +function getCookie(name) { + var nameEQ = name + "="; + var ca = document.cookie.split(';'); + for(var i=0;i < ca.length;i++) { + var c = ca[i]; + while (c.charAt(0)==' ') c = c.substring(1,c.length); + if (c.indexOf(nameEQ) == 0) { + return unescape(c.substring(nameEQ.length,c.length)); + } + } + return null; +} + + + hunk ./html/haddock-util.js 173 +function reframe() { + if (parent.location.href == window.location.href) { + 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"); + } +} hunk ./html/haddock-util.js 202 - document.cookie = "style=" + href + ";path=/"; + setCookie("haddock-style", href); hunk ./html/haddock-util.js 207 - var nameEQ = "style="; - var s; - var ca = document.cookie.split(';'); - for(var i=0;i < ca.length;i++) { - var c = ca[i]; - while (c.charAt(0)==' ') c = c.substring(1,c.length); - if (c.indexOf(nameEQ) == 0) s = c.substring(nameEQ.length,c.length); - } + var s = getCookie("haddock-style"); hunk ./src/Haddock/Backends/Xhtml.hs 175 - styleMenu themes]) ! [theclass "links"], + styleMenu themes, + Just (anchor ! [ href "#", onclick "reframe();"] << "Frames")]) + ! [theclass "links"], hunk ./html/haddock-util.js 167 +function addFramesButton() { + if (parent.location.href == window.location.href) { + var menu = document.getElementById("page-menu"); + if (menu) { + var btn = menu.lastChild.cloneNode(false); + btn.innerHTML = "Frames"; + menu.appendChild(btn); + } + } +} + hunk ./html/haddock-util.js 185 - if (parent.location.href == window.location.href) { - setCookie("haddock-reframe", document.URL); - window.location = "frames.html"; - } + setCookie("haddock-reframe", document.URL); + window.location = "frames.html"; hunk ./src/Haddock/Backends/Xhtml.hs 118 - "//Frames"; - menu.appendChild(btn); - } - } -} - hunk ./html/haddock-util.js 173 +function addMenuItem(html) { + var menu = document.getElementById("page-menu"); + if (menu) { + var btn = menu.firstChild.cloneNode(false); + btn.innerHTML = html; + menu.appendChild(btn); + } +} + +function addFramesButton() { + if (parent.location.href == window.location.href) { + addMenuItem("Frames"); + } +} + hunk ./html/haddock-util.js 201 +function addStyleMenu() { + var i, a, c = 0, btns = ""; + for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { + if(a.getAttribute("rel").indexOf("style") != -1 + && a.getAttribute("title")) { + btns += "
  • " + + a.getAttribute("title") + "
  • " + c += 1; + } + } + if (c > 1) { + var h = "
    " + + "Style ▾" + + "
      " + btns + "
    " + + "
    "; + addMenuItem(h); + } +} + hunk ./html/haddock-util.js 250 + +function pageLoad() { + addStyleMenu(); + addFramesButton(); + resetStyle(); +} + hunk ./src/Haddock/Backends/Xhtml.hs 118 - "// Maybe Interface -> Themes +bodyHtml :: String -> Maybe Interface hunk ./src/Haddock/Backends/Xhtml.hs 164 -bodyHtml doctitle iface themes +bodyHtml doctitle iface hunk ./src/Haddock/Backends/Xhtml.hs 174 - indexButton maybe_index_url, - styleMenu themes]) + indexButton maybe_index_url]) hunk ./src/Haddock/Backends/Xhtml.hs 229 - bodyHtml doctitle Nothing themes + bodyHtml doctitle Nothing hunk ./src/Haddock/Backends/Xhtml.hs 347 - bodyHtml doctitle Nothing themes + bodyHtml doctitle Nothing hunk ./src/Haddock/Backends/Xhtml.hs 453 - bodyHtml doctitle (Just iface) themes + bodyHtml doctitle (Just iface) hunk ./src/Haddock/Backends/Xhtml/Themes.hs 15 - cssFiles, styleSheet, stylePickers, styleMenu + cssFiles, styleSheet hunk ./src/Haddock/Backends/Xhtml/Themes.hs 19 -import Haddock.Backends.Xhtml.Utils (onclick) hunk ./src/Haddock/Backends/Xhtml/Themes.hs 189 - -stylePickers :: Themes -> [Html] -stylePickers ts = map mkPicker ts - where - mkPicker t = - let js = "setActiveStyleSheet('" ++ themeHref t ++ "'); return false;" in - anchor ! [href "#", onclick js] << themeName t - - -styleMenu :: Themes -> Maybe Html -styleMenu [] = Nothing -styleMenu [_] = Nothing -styleMenu ts = Just $ thediv ! [identifier "style-menu-holder"] << [ - anchor ! [ href "#", onclick js ] << "Style \9662", - unordList (stylePickers ts) ! [ identifier "style-menu", theclass "hide" ] - ] - where - js = "styleMenu(); return false;" - - hunk ./src/Haddock/Backends/Xhtml/Utils.hs 27 - onclick, hunk ./src/Haddock/Backends/Xhtml/Utils.hs 155 -onclick :: String -> HtmlAttr -onclick = strAttr "onclick" - - hunk ./src/Haddock/Backends/Xhtml/Utils.hs 184 -collapser id_ classes = [ theclass cs, onclick js ] +collapser id_ classes = [ theclass cs, strAttr "onclick" js ] hunk ./html/Ocean.std-theme/ocean.css 62 -.top > .src { - font-size: 116%; /* 15pt */ -} - -.top .src .link { - font-size: 86.2%; /* 13pt */ +.links, .link { + font-size: 85%; /* 11pt */ hunk ./html/Ocean.std-theme/ocean.css 70 -dl.info, #table-of-contents, #synopsis { +dl.info { hunk ./html/Ocean.std-theme/ocean.css 74 +#table-of-contents, #synopsis { + /* font-size: 85%; /* 11pt */ +} + hunk ./html/Ocean.std-theme/ocean.css 107 - border-left: 1px solid rgb(78,98,114); + border-left: 1px solid #d5d5d5; hunk ./html/Ocean.std-theme/ocean.css 143 - padding: 0.5em; + padding: 0.25em; hunk ./html/Ocean.std-theme/ocean.css 148 + border-bottom: 0.25em solid white; + /* white border adds some space below the box to compensate + for visual extra space that paragraphs have between baseline + and the bounding box */ hunk ./html/Ocean.std-theme/ocean.css 362 -#interface div.top { margin: 1em 0 2em 0; } - +#interface div.top { margin: 2em 0; } +#interface h1 + div.top, +#interface h2 + div.top, +#interface h3 + div.top, +#interface h4 + div.top, +#interface h5 + div.top { + margin-top: 1em; +} hunk ./html/Ocean.std-theme/ocean.css 284 - background: rgb(239,238,209); - border: 1px solid rgba(196,69,29,0.2); + background: #f9f8db; + border: 1px solid #d8d7ad; hunk ./html/Ocean.std-theme/ocean.css 320 - text-align: right; hunk ./html/Ocean.std-theme/ocean.css 330 - background: url(synopsis.png) no-repeat 0 -8px; -} - -#synopsis p.caption.expander { hunk ./html/Ocean.std-theme/ocean.css 333 -#synopsis ul, -#synopsis ul li.src { - background-color: #f9f8db; - white-space: nowrap; +#synopsis p.caption.expander { + background: url(synopsis.png) no-repeat 0px -8px; hunk ./html/Ocean.std-theme/ocean.css 337 -#synopsis ul.collapser, -#synopsis ul.expander { - background-image: none; - list-style: none; +#synopsis ul { hunk ./html/Ocean.std-theme/ocean.css 348 +#synopsis ul, +#synopsis ul li.src { + background-color: #f9f8db; + white-space: nowrap; + list-style: none; + margin-left: 0; +} + hunk ./html/Ocean.std-theme/ocean.css 419 -/* @group Left Margin */ - hunk ./html/Ocean.std-theme/ocean.css 424 -/* use these two for two levels of indent */ -/* -#description .doc, #interface div.top { - padding-left: 1.25em; -} - -div.top .subs, div.top .doc { - padding-left: 1.875em; -} -*/ -/* @end */ - hunk ./html/Ocean.std-theme/ocean.css 517 +#module-list li { + clear: right; +} + hunk ./html/haddock-util.js 3 -function makeClassToggle(cOn, cOff) +var rspace = /\s\s+/g, + rtrim = /^\s+|\s+$/g; + +function spaced(s) { return (" " + s + " ").replace(rspace, " "); } +function trim(s) { return s.replace(rtrim, ""); } + +function hasClass(elem, value) { + var className = spaced(elem.className || ""); + return className.indexOf( " " + value + " " ) >= 0; +} + +function addClass(elem, value) { + var className = spaced(elem.className || ""); + if ( className.indexOf( " " + value + " " ) < 0 ) { + elem.className = trim(className + " " + value); + } +} + +function removeClass(elem, value) { + var className = spaced(elem.className || ""); + className = className.replace(" " + value + " ", " "); + elem.className = trim(className); +} + +function toggleClass(elem, valueOn, valueOff, bool) { + if (bool == null) { bool = ! hasClass(elem, valueOn); } + if (bool) { + removeClass(elem, valueOff); + addClass(elem, valueOn); + } + else { + removeClass(elem, valueOn); + addClass(elem, valueOff); + } + return bool; +} + + +function makeClassToggle(valueOn, valueOff) hunk ./html/haddock-util.js 43 - var rOn = new RegExp('\\b'+cOn+'\\b'); - var rOff = new RegExp('\\b'+cOff+'\\b'); - - return function(e, a) { - var c = e.className; - if (a == null) { a = rOff.test(c); } - if (a) { c = c.replace(rOff, cOn); } - else { c = c.replace(rOn, cOff); } - e.className = c; + return function(elem, bool) { + return toggleClass(elem, valueOn, valueOff, bool); hunk ./html/haddock-util.js 48 -toggleClassShow = makeClassToggle("show", "hide"); -toggleClassCollapser = makeClassToggle("collapser", "expander"); +toggleShow = makeClassToggle("show", "hide"); +toggleCollapser = makeClassToggle("collapser", "expander"); hunk ./html/haddock-util.js 51 -function toggleSection(toggler,id) +function toggleSection(id) hunk ./html/haddock-util.js 53 - toggleClassShow(document.getElementById(id)) - toggleClassCollapser(toggler); + var b = toggleShow(document.getElementById("section." + id)) + toggleCollapser(document.getElementById("control." + id), b) + return b; hunk ./html/haddock-util.js 279 - toggleClassShow(m, show); + if (m) toggleClassShow(m, show); hunk ./src/Haddock/Backends/Xhtml.hs 267 - _ -> collapser p "module" + _ -> collapseControl p True "module" hunk ./src/Haddock/Backends/Xhtml.hs 281 - subtree = mkNodeList (s:ss) p ts ! [identifier p, theclass "show"] + subtree = mkNodeList (s:ss) p ts ! collapseSection p True "" hunk ./src/Haddock/Backends/Xhtml.hs 507 - paragraph ! collapser "syn" "caption" << "Synopsis" +++ + paragraph ! collapseControl "syn" False "caption" << "Synopsis" +++ hunk ./src/Haddock/Backends/Xhtml.hs 510 - ) ! ([identifier "syn"] ++ collapser "syn" "hide") + ) ! (collapseSection "syn" False "" ++ collapseToggle "syn") hunk ./src/Haddock/Backends/Xhtml/Decl.hs 388 - = subInstances instId (map instDecl instances) + = subInstances instName (map instDecl instances) hunk ./src/Haddock/Backends/Xhtml/Decl.hs 390 - instId = collapseId (getName baseName) + instName = getOccString $ getName baseName hunk ./src/Haddock/Backends/Xhtml/Layout.hs 43 +import Haddock.Utils (makeAnchorId) hunk ./src/Haddock/Backends/Xhtml/Layout.hs 158 -subInstances id_ = maybe noHtml wrap . instTable +subInstances nm = maybe noHtml wrap . instTable hunk ./src/Haddock/Backends/Xhtml/Layout.hs 161 - instTable = fmap (thediv ! [identifier id_, theclass "show"] <<) . subTable + instTable = fmap (thediv ! collapseSection id_ True [] <<) . subTable hunk ./src/Haddock/Backends/Xhtml/Layout.hs 163 - subCaption = paragraph ! collapser id_ "caption" << "Instances" - + subCaption = paragraph ! collapseControl id_ True "caption" << "Instances" + id_ = makeAnchorId $ "i:" ++ nm hunk ./src/Haddock/Backends/Xhtml/Utils.hs 27 - collapser, collapseId, + collapseSection, collapseToggle, collapseControl, hunk ./src/Haddock/Backends/Xhtml/Utils.hs 176 --- A section of HTML which is collapsible via a +/- button. +-- A section of HTML which is collapsible. hunk ./src/Haddock/Backends/Xhtml/Utils.hs 179 --- TODO: Currently the initial state is non-collapsed. Change the 'minusFile' --- below to a 'plusFile' and the 'display:block;' to a 'display:none;' when we --- use cookies from JavaScript to have a more persistent state. +-- | Attributes for an area that can be collapsed +collapseSection :: String -> Bool -> String -> [HtmlAttr] +collapseSection id_ state classes = [ identifier sid, theclass cs ] + where cs = unwords (words classes ++ [pick state "show" "hide"]) + sid = "section." ++ id_ hunk ./src/Haddock/Backends/Xhtml/Utils.hs 185 -collapser :: String -> String -> [HtmlAttr] -collapser id_ classes = [ theclass cs, strAttr "onclick" js ] - where - cs = unwords (words classes ++ ["collapser"]) - js = "toggleSection(this,'" ++ id_ ++ "')" +-- | Attributes for an area that toggles a collapsed area +collapseToggle :: String -> [HtmlAttr] +collapseToggle id_ = [ strAttr "onclick" js ] + where js = "toggleSection('" ++ id_ ++ "')"; + +-- | Attributes for an area that toggles a collapsed area, +-- and displays a control. +collapseControl :: String -> Bool -> String -> [HtmlAttr] +collapseControl id_ state classes = + [ identifier cid, theclass cs ] ++ collapseToggle id_ + where cs = unwords (words classes ++ [pick state "collapser" "expander"]) + cid = "control." ++ id_ hunk ./src/Haddock/Backends/Xhtml/Utils.hs 199 --- A quote is a valid part of a Haskell identifier, but it would interfere with --- the ECMA script string delimiter used in collapsebutton above. -collapseId :: Name -> String -collapseId nm = "i:" ++ escapeStr (getOccString nm) +pick :: Bool -> a -> a -> a +pick True t _ = t +pick False _ f = f hunk ./html/Ocean.std-theme/ocean.css 128 -span.module.collapser, -span.module.expander { - background-position: 0 0.3em; -} hunk ./html/Ocean.std-theme/ocean.css 517 +#module-list span.collapser, +#module-list span.expander { + background-position: 0 0.3em; +} + hunk ./src/Haddock/Backends/Xhtml.hs 265 - modAttrs = case ts of - [] -> [theclass "module"] - _ -> collapseControl p True "module" + modAttrs = case (ts, leaf) of + (_:_, False) -> collapseControl p True "module" + (_, _ ) -> [theclass "module"] hunk ./src/Haddock/Backends/Xhtml.hs 269 - htmlModule = thespan ! modAttrs << - (if leaf + cBtn = case (ts, leaf) of + (_:_, True) -> thespan ! collapseControl p True "" << spaceHtml + (_, _ ) -> noHtml + -- We only need an explicit collapser button when the module name + -- is also a leaf, and so is a link to a module page. Indeed, the + -- spaceHtml is a minor hack and does upset the layout a fraction. + + htmlModule = thespan ! modAttrs << (cBtn +++ + if leaf hunk ./haddock.cabal 63 + html/Ocean.std-theme/synopsis.png hunk ./html/haddock-util.js 214 -function addFramesButton() { +function adjustForFrames() { hunk ./html/haddock-util.js 216 + // not in frames, so add Frames button hunk ./html/haddock-util.js 219 + else { + // in frames, remove synopsis + var syn = document.getElementById("synopsis"); + if (syn) { syn.parentNode.removeChild(syn); } + } hunk ./html/haddock-util.js 291 - addFramesButton(); + adjustForFrames(); hunk ./html/Ocean.std-theme/ocean.css 59 - line-height:116%; + line-height: 120%; hunk ./html/Ocean.std-theme/ocean.css 155 -.doc p, .doc pre { - margin-top: 1em; -} - hunk ./html/Ocean.std-theme/ocean.css 276 - background: #f9f8db; + background: #faf9dc; hunk ./html/Ocean.std-theme/ocean.css 342 - background-color: #f9f8db; + background-color: #faf9dc; hunk ./html/Ocean.std-theme/ocean.css 441 - font-size: 77%; /* 10pt */ hunk ./html/Ocean.std-theme/ocean.css 445 +#mini > * { + font-size: 93%; /* 12pt */ +} + hunk ./html/Ocean.std-theme/ocean.css 450 - font-size: 130%; + font-size: 117%; /* 14pt */ hunk ./html/Ocean.std-theme/ocean.css 457 - font-size: 100%; + font-size: 109%; /* 13pt */ hunk ./html/haddock-util.js 285 - if (m) toggleClassShow(m, show); + if (m) toggleShow(m, show); hunk ./html/Ocean.std-theme/ocean.css 17 -p { margin: 0.5em 0; } +p { + margin: 0.8em 0; +} hunk ./html/Ocean.std-theme/ocean.css 88 - margin: 0.8em 0 0.5em; + margin: 0.8em 0 0.4em; hunk ./html/Ocean.std-theme/ocean.css 142 -/* margin: 0.5em 5em 0.5em 3em; */ - margin: 0.5em 0 0.5em; + margin: 0.8em 0; hunk ./html/Ocean.std-theme/ocean.css 159 -img.coll { - width : 0.75em; - height: 0.75em; - margin: 0 0.5em 0 0; -} - hunk ./html/Ocean.std-theme/ocean.css 376 - margin-top: 0.5em; + margin-top: 0.8em; hunk ./html/Ocean.std-theme/ocean.css 299 + display: none; +} + +.no-frame #synopsis { + display: block; hunk ./html/haddock-util.js 215 + var bodyCls; + hunk ./html/haddock-util.js 220 + bodyCls = "no-frame"; hunk ./html/haddock-util.js 223 - // in frames, remove synopsis - var syn = document.getElementById("synopsis"); - if (syn) { syn.parentNode.removeChild(syn); } + bodyCls = "in-frame"; hunk ./html/haddock-util.js 225 + addClass(document.body, bodyCls); hunk ./html/Ocean.std-theme/ocean.css 208 - width: 5em; hunk ./html/Ocean.std-theme/ocean.css 210 + margin-right: 1em; hunk ./html/Ocean.std-theme/ocean.css 215 - padding-left: 6em; + margin-left: 6em; hunk ./html/Ocean.std-theme/ocean.css 449 +#mini #module-list .caption, hunk ./html/Ocean.std-theme/ocean.css 451 - font-size: 117%; /* 14pt */ + font-size: 125%; /* 15pt */ hunk ./html/haddock-util.js 241 -function addStyleMenu() { - var i, a, c = 0, btns = ""; - for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { - if(a.getAttribute("rel").indexOf("style") != -1 - && a.getAttribute("title")) { - btns += "
  • " - + a.getAttribute("title") + "
  • " - c += 1; +function styles() { + var i, a, es = document.getElementsByTagName("link"), rs = []; + for (i = 0; a = es[i]; i++) { + if(a.rel.indexOf("style") != -1 && a.title) { + rs.push(a); hunk ./html/haddock-util.js 248 - if (c > 1) { + return rs; +} + +function addStyleMenu() { + var as = styles(); + var i, a, btns = ""; + for(i=0; a = as[i]; i++) { + btns += "
  • " + + a.title + "
  • " + } + if (as.length > 1) { hunk ./html/haddock-util.js 268 -function setActiveStyleSheet(href) { - var i, a, found = false; - for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { - if(a.getAttribute("rel").indexOf("style") != -1 - && a.getAttribute("title")) { - a.disabled = true; - // need to do this always, some browsers are edge triggered - if(a.getAttribute("href") == href) { - a.disabled = false; - found = true; - } +function setActiveStyleSheet(title) { + var as = styles(); + var i, a, found; + for(i=0; a = as[i]; i++) { + a.disabled = true; + // need to do this always, some browsers are edge triggered + if(a.title == title) { + found = a; hunk ./html/haddock-util.js 278 - if (!found) href = ""; - setCookie("haddock-style", href); + if (found) { + found.disabled = false; + setCookie("haddock-style", title); + } + else { + as[0].disabled = false; + clearCookie("haddock-style"); + } hunk ./html/haddock-util.js 201 - parent.window.synopsis.location = filename; + if (parent.window.synopsis.location.replace) { + // In Firefox this avoids adding the change to the history. + parent.window.synopsis.location.replace(filename); + } else { + parent.window.synopsis.location = filename; + } binary ./html/Snappy.theme/minus.gif oldhex *47494638396109000900910000fefefe8282820202020000002c00000000090009000002118c8f *a00bc6eb5e0b40583b6596f1a11f14003b newhex * rmfile ./html/Snappy.theme/minus.gif binary ./html/Snappy.theme/plus.gif oldhex *47494638396109000900910000fefefe8282820202020000002c00000000090009000002148c8f *a00bb6b29c82ca897b5b7871cfce74085200003b newhex * rmfile ./html/Snappy.theme/plus.gif binary ./html/Snappy.theme/s_haskell_icon.gif oldhex *47494638396110001000f66000204a87224b88234d89254e8a28508b315790315890335a91365c *933f64983465a43d69a33969a63a6aa73c6ba83d6ca840649844679b4b6d9e4975ae4b77ae5575 *a45676a45a79a6567eb25c83b55c83b65d85b76783ad7f94ae6f8ab16f90bc6f92bf7191bb7490 *b87693bb7893ba7996bd7496c1729fcf75a1d076a2d076a2d17da7d37ea7d37fa8d48195af859c *bd8ca1c18ca2c180a0c884a4ca88aed790aed192afd28bb0d891b2d692b3d795b3d596b4d7a2b4 *cda4b5ceb4bcc6b5bdc7aabad1b8c6d9a3c1e0a4c1e0b4cce5b6cde6c4c9cfc8d2e1c4d7ebc8d9 *ece0e6efe3e8f0e5eaf1e6eaf1e6ecf4ebeff5ebf0f6ecf1f6edf3f9eef3f9eef4f9f2f4f8f3f5 *f8f4f6f9f5f7faf7fafcf8fafdfbfbfdfcfdfefdfdfefdfefefefeffffffff0000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *0000000000000021f90400000000002c00000000100010000007bc800b1d3f468586873f2e0b2e *5452504e4f4b4b5f94955f2e3f4327360a1905003c969484542a2c1b0a24000655a2855f44273b *0a1411002fae465f58342a260a2500034a96af5f4927390d0e17001cc5ba943427330a21020047 *95c65fd329d6000012dbd148273a0b0e16e1004094af582c28210a2300042f0008585fafb13ab4 *200080b125c1c07e46a2a438a54004800357be04b9d7c4c80f21277028c06000408f4aeb3c24a2 *12254a1328922c5559c24411a643302d76581008003b newhex * rmfile ./html/Snappy.theme/s_haskell_icon.gif hunk ./html/Snappy.theme/snappy.css 1 -/* -------- Global things --------- */ - -@font-face { - font-family: 'DroidSerif'; - src: url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Regular.eot'); - src: local('Droid Serif'), - url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Regular.woff') format('woff'), - url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Regular.ttf') format('truetype'), - url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Regular.svg#DroidSerif') format('svg'); -} - -@font-face { - font-family: 'DroidSerif'; - font-style: italic; - src: url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Italic.eot'); - src: local('Droid Serif'), - url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Italic.woff') format('woff'), - url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Italic.ttf') format('truetype'), - url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Italic.svg#DroidSerif-Italic') format('svg'); -} - -@font-face { - font-family: 'DroidSerif'; - font-weight: bold; - src: url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Bold.eot'); - src: local('Droid Serif'), - url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Bold.woff') format('woff'), - url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Bold.ttf') format('truetype'), - url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Bold.svg#DroidSerif-Bold') format('svg'); -} - -@font-face { - font-family: 'DroidSerif'; - src: url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-BoldItalic.eot'); - font-weight: bold; - font-style: italic; - src: local('Droid Serif'), - url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-BoldItalic.woff') format('woff'), - url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-BoldItalic.ttf') format('truetype'), - url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-BoldItalic.svg#DroidSerif-BoldItalic') format('svg'); -} - - - -html { - background-color: #f0f3ff; - width: 100%; -} - -body { - -moz-border-radius:5px; - -webkit-border-radius:5px; - width: 50em; - margin: 2em auto; - padding: 0; - background-color: #ffffff; - color: #000000; - font-size: 110%; - font-family: DroidSerif, Georgia, serif; - } - -div#content { - padding: 0 30px; -} - -div#module-header { - margin: 0 -30px; -} - - -a:link { color: #5200A3; text-decoration: none } -a:visited { color: #5200A3; text-decoration: none } -a:hover { color: #5200A3; text-decoration: none; border-bottom:#5200A3 dashed 1px; } - -table{ - border-spacing: 1px 1px; -} - -td { - border-width: 0px; - vertical-align: top; -} - -p { - margin-top: 0; - margin-bottom: 0.75em; - padding-left: 4px; - font-size: 95%; - line-height: 1.66; - } - -li p { margin: 0pt } - - -tt, pre, code { - font-family: Monaco, - "DejaVu Sans Mono", - "Bitstream Vera Sans Mono", - "Lucida Console", - monospace; - font-size: 90%; -} - -.src { - padding: 4px 8px; - background-color: #f0f0f0; - font-size: 80%; - font-family: Monaco, - "DejaVu Sans Mono", - "Bitstream Vera Sans Mono", - "Lucida Console", - monospace; - - vertical-align: top; - white-space: nowrap; -} - -.def { - font-weight: bold; -} - -ul { - padding: 0; -} - -ul ul { - padding-left: 30px; -} - -ul.links { - list-style: none; - float: right; - margin: 0 0 0 0.5em; - font-size: 80%; -} - -ul.links li { - display: inline; - white-space: nowrap; -} - -.hide { display: none; } -.show { } - -.collapser { - background-image: url(minus.gif); - background-repeat: no-repeat; -} -.expander { - background-image: url(plus.gif); - background-repeat: no-repeat; -} - -span.module.collapser, -span.module.expander { - background-position: 0 6px; -} -p.caption.collapser, -p.caption.expander { - background-position: 0 17px; -} -#module-list .collapser, -#module-list .expander, -.subs p.caption.collapser, -.subs p.caption.expander { - padding-left: 14px; - margin-left: -14px; - cursor: pointer; -} - -/* Captions and Headers */ - -p.caption, h1, h2, h3, h4 { - font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif; - margin: 0; - padding: 0; - font-size: inherit; - line-height: inherit; -} - -#package-header .caption { - font-size: 80%; - font-weight: bold; - padding-left: 26px; - padding-top: 2px; - padding-bottom: 3px; -} - -#module-header .caption { - font-weight: bold; letter-spacing: -0.02em; - font-size: 201%; - margin: 0; - padding: 0; -} - -h1, -#description .caption, -#synopsis .caption, -#index .caption, -#module-list .caption { - padding-top: 14px; - margin-bottom: 0; - font-weight: bold; - letter-spacing: -0.02em; - font-size: 140% - } - -h2 -{ - padding-top: 14px; - font-weight: bold; - letter-spacing: -0.02em; - font-size: 120% -} - -h3, -#mini #module-list .caption { - padding-top: 12px; - font-weight: bold; - letter-spacing: -0.02em; - font-size: 105% -} - -h4, -#table-of-contents .caption, -.constructors .caption, -.instances .caption, -.methods .caption { - font-weight: bold; - padding-top: 12px; - padding-bottom: 4px; - letter-spacing: -0.02em; - font-size: 90% -} - -.arguments .caption, -.fields .caption { - display: none; -} - -/* Per Section Styling */ - -#package-header { - font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif; - background: #3465a4 url(s_haskell_icon.gif) no-repeat 4px 3px; - padding: 0; - -moz-border-radius-topleft:5px; - -moz-border-radius-topright:5px; - -webkit-border-radius-topleft:5px; - -webkit-border-radius-topright:5px; - position: relative; -} - -#package-header li { - font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif; - padding-left: 5px; - padding-right: 5px; - border-left-width: 1px; - border-left-color: #ffffff; - border-left-style: solid; - letter-spacing: -0.02em; - font-weight: bold; -} - -#package-header a { color: #ffffff } -#package-header a:visited { color: #ffff00 } -#package-header a:hover { background-color: #C9D3DE; } -#package-header li:hover { background-color: #C9D3DE; } - -div#style-menu-holder { - position: relative; - z-index: 2; - display: inline; - margin: 0; - padding: 0; -} - -#style-menu { - position: absolute; - z-index: 1; - overflow: visible; - background-color: #3465a4; - margin: 0; - width: 6em; - text-align: center; - right: 0; - padding: 0 2px 1px; - border-left: 1px solid #fffffff; - border-right: 1px solid #fffffff; - border-bottom: 1px solid #fffffff; -} - -#style-menu li { - display: list-item; - border-style: none; - margin: 0; - padding: 3px; - color: #000; - list-style-type: none; -} - -#style-menu li + li { - border-top: 1px solid #ffffff; -} - -#module-header { - font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif; - color: #141B24; - background-color: #C9D3DE; - padding: 5px; - border-top-width: 1px; - border-top-color: #ffffff; - border-top-style: solid; - -moz-border-radius-bottomleft:5px; - -moz-border-radius-bottomright:5px; - -webkit-border-radius-bottomleft:5px; - -webkit-border-radius-bottomright:5px; -} - -#module-header .info { - float: right; - margin: 0; - font-size: 80%; -} - -#module-header .info dt { - float: left; - width: 6em; - font-weight: bold; -} - -#module-header .info dd { - margin-left: 6em; -} - -#table-of-contents, -#description, -#synopsis, -#footer { - margin-top: 15px; -} - -#table-of-contents ul { - font-size: 80%; - font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif; - letter-spacing: -0.01em; - margin: 0; - list-style: none; -} - -#synopsis ul { - list-style: none; -} - -#synopsis .caption.expander, -#synopsis .caption.collapser { - background: inherit; -} - -#synopsis ul.hide { - display: inherit; -} - - -#synopsis .src, -.instances .src { - background-color: #FAFAFA; - border-bottom: #F2F2F2 solid 1px; - border-top: #FCFCFC solid 1px; -} - -.top { - padding: 20px 0 0.5ex 0; -} - -.top .src, -#interface .subs.methods .src { - border-spacing: 0px; - border-bottom:1px solid #d7d7df; - border-right:1px solid #d7d7df; - border-top:1px solid #f4f4f9; - border-left:1px solid #f4f4f9; - padding: 4px; -} - -.src a.link { - float: right; - border-left-width: 1px; - border-left-color: #000099; - border-left-style: solid; - white-space: nowrap; - padding: 0 4px;; -} -#interface p + div { - margin-top: -8px} - -.subs p { - margin: 0; -} - -dd.empty { - display: none; -} - -.subs .subs { - margin-left: 2em; -} -#interface .subs .src { - padding: 2px 12px; - border: none; -} - -#interface .subs td + td { - font-style: italic; - font-size: 80%; - font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif; -} -#interface .methods .src { - margin-top: 15px; -} -#interface .instances div { - margin: 0; - padding: 0; -} - -div.arguments { - padding-left: 0; - padding-top: 9px; -} - -.arguments table { - border-spacing: 0; -} - -#footer { - font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif; - -moz-border-radius:5px; - -webkit-border-radius:5px; - background-color: #3465a4; - color: #ffffff; - padding: 5px -} - -#footer p { - margin: 0; -} - -#footer a:link { - color: #ffffff; - text-decoration: underline - } -#footer a:visited { - color: #ffff00 - } -#footer a:hover { - background-color: #6060ff - } - - -#alphabet ul { - list-style: none; - padding: 0; - margin: 0.5em 0 0; - font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif; - font-weight: bold; -} - -#alphabet li { - display: inline; - margin: 0 0.25em; -} - -#alphabet a { - text-decoration: none; -} - -#index td { - background-color: #f0f0f0; - padding-left: 1em; - padding-right: 1em; -} -#index td.alt { - font-size: 70%; - font-style: italic; - padding-left: 3em; -} - - - -body#mini { - width: auto; - padding: 0; - background-color: #ffffff; - color: #000000; - font-size: 90%; - font-family: DroidSerif, Georgia, serif; - margin: 0.5em; -} - -#mini div { - padding: 0 10px; -} - -#module-list ul { - list-style: none; - margin-top: 0.5em; -} - -#module-list .package { - float: right; -} + rmfile ./html/Snappy.theme/snappy.css rmdir ./html/Snappy.theme hunk ./html/Ocean.std-theme/ocean.css 61 - line-height: 120%; + line-height: 124%; hunk ./haddock.cabal 170 + Main hunk ./src/Documentation/Haddock.hs 20 + createInterfaces', hunk ./src/Documentation/Haddock.hs 43 + markup, hunk ./src/Documentation/Haddock.hs 64 +import Haddock.Utils +import Main hunk ./src/Main.hs 18 -module Main (main) where +module Main (main, createInterfaces') where hunk ./src/Main.hs 118 +-- | Create 'Interface' structures from a given list of Haddock command-line +-- flags and file or module names (as accepted by 'haddock' executable). Flags +-- that control documentation generation or show help or version information +-- are ignored. +-- +-- This is a more high-level alternative to 'createInterfaces'. +createInterfaces' + :: [String] -- ^ A list of command-line flags and file or module names + -> IO [Interface] -- ^ Resulting list of interfaces +createInterfaces' args = do + (flags, fileArgs) <- parseHaddockOpts args + (_, ifaces) <- readPackagesAndCreateInterfaces flags fileArgs + return ifaces + + +readPackagesAndCreateInterfaces :: [Flag] -> [String] -> IO ([(InterfaceFile, FilePath)], [Interface]) +readPackagesAndCreateInterfaces flags fileArgs = do + libDir <- getGhcLibDir flags + + -- Catches all GHC source errors, then prints and re-throws them. + let handleSrcErrors action' = flip handleSourceError action' $ \err -> do + printExceptionAndWarnings err + liftIO exitFailure + + -- Initialize GHC. + withGhc libDir (ghcFlags flags) $ \_ -> handleSrcErrors $ do + + -- Get packages supplied with --read-interface. + packages <- readInterfaceFiles nameCacheFromGhc (ifacePairs flags) + + -- Create the interfaces -- this is the core part of Haddock. + (ifaces, homeLinks) <- createInterfaces (verbosity flags) fileArgs flags + (map fst packages) + + -- Dump an "interface file" (.haddock file), if requested. + liftIO $ case optDumpInterfaceFile flags of + Just f -> dumpInterfaceFile f (map toInstalledIface ifaces) homeLinks + Nothing -> return () + + return (packages, ifaces) + + hunk ./src/Main.hs 170 - libDir <- getGhcLibDir flags - - -- Catches all GHC source errors, then prints and re-throws them. - let handleSrcErrors action = flip handleSourceError action $ \err -> do - printExceptionAndWarnings err - liftIO exitFailure - - -- Initialize GHC. - withGhc libDir (ghcFlags flags) $ \_ -> handleSrcErrors $ do - - -- Get packages supplied with --read-interface. - packages <- readInterfaceFiles nameCacheFromGhc (ifacePairs flags) - - -- Create the interfaces -- this is the core part of Haddock. - (ifaces, homeLinks) <- createInterfaces (verbosity flags) fileArgs flags - (map fst packages) - liftIO $ do - -- Render the interfaces. - renderStep flags packages ifaces + (packages, ifaces) <- readPackagesAndCreateInterfaces flags fileArgs hunk ./src/Main.hs 172 - -- Dump an "interface file" (.haddock file), if requested. - case optDumpInterfaceFile flags of - Just f -> dumpInterfaceFile f (map toInstalledIface ifaces) homeLinks - Nothing -> return () + -- Render the interfaces. + renderStep flags packages ifaces hunk ./src/Documentation/Haddock.hs 20 - createInterfaces', + processModules, hunk ./src/Documentation/Haddock.hs 66 + + +-- | Create 'Interface' structures from a given list of Haddock command-line +-- flags and file or module names (as accepted by 'haddock' executable). Flags +-- that control documentation generation or show help or version information +-- are ignored. +createInterfaces + :: [Flag] -- ^ A list of command-line flags + -> [String] -- ^ File or module names + -> IO [Interface] -- ^ Resulting list of interfaces +createInterfaces flags modules = do + (_, ifaces, _) <- readPackagesAndProcessModules flags modules + return ifaces + hunk ./src/Haddock/Interface.hs 30 - createInterfaces + processModules hunk ./src/Haddock/Interface.hs 57 --- | Create 'Interface' structures by typechecking the list of modules --- using the GHC API and processing the resulting syntax trees. -createInterfaces - :: Verbosity -- ^ Verbosity of logging to 'stdout' - -> [String] -- ^ A list of file or module names sorted by module topology - -> [Flag] -- ^ Command-line flags - -> [InterfaceFile] -- ^ Interface files of package dependencies - -> Ghc ([Interface], LinkEnv) - -- ^ Resulting list of interfaces and renaming environment -createInterfaces verbosity modules flags extIfaces = do +-- | Create 'Interface's and a link environment by typechecking the list of +-- modules using the GHC API and processing the resulting syntax trees. +processModules + :: Verbosity -- ^ Verbosity of logging to 'stdout' + -> [String] -- ^ A list of file or module names sorted by + -- module topology + -> [Flag] -- ^ Command-line flags + -> [InterfaceFile] -- ^ Interface files of package dependencies + -> Ghc ([Interface], LinkEnv) -- ^ Resulting list of interfaces and renaming + -- environment +processModules verbosity modules flags extIfaces = do hunk ./src/Haddock/Interface.hs 72 - interfaces <- createInterfaces' verbosity modules flags instIfaceMap + interfaces <- createIfaces0 verbosity modules flags instIfaceMap hunk ./src/Haddock/Interface.hs 77 - out verbosity verbose "Building link environment..." + out verbosity verbose "Building cross-linking environment..." hunk ./src/Haddock/Interface.hs 93 -createInterfaces' :: Verbosity -> [String] -> [Flag] -> InstIfaceMap -> Ghc [Interface] -createInterfaces' verbosity modules flags instIfaceMap = do - let useTempDir = Flag_NoTmpCompDir `notElem` flags +-------------------------------------------------------------------------------- +-- * Module typechecking and Interface creation +-------------------------------------------------------------------------------- hunk ./src/Haddock/Interface.hs 97 - -- Output dir needs to be set before calling depanal since it uses it to + +createIfaces0 :: Verbosity -> [String] -> [Flag] -> InstIfaceMap -> Ghc [Interface] +createIfaces0 verbosity modules flags instIfaceMap = + -- Output dir needs to be set before calling depanal since depanal uses it to hunk ./src/Haddock/Interface.hs 103 - tmp <- liftIO getTemporaryDirectory - x <- liftIO getProcessID - let tempDir = tmp ".haddock-" ++ show x - when useTempDir $ modifySessionDynFlags (setOutputDir tempDir) + (if useTempDir then withTempOutputDir else id) $ do + modGraph <- depAnalysis + if needsTemplateHaskell modGraph + then do + modGraph' <- enableCompilation modGraph + createIfaces verbosity flags instIfaceMap modGraph' + else + createIfaces verbosity flags instIfaceMap modGraph hunk ./src/Haddock/Interface.hs 112 - targets <- mapM (\f -> guessTarget f Nothing) modules - setTargets targets - -- Dependency analysis. - modgraph <- depanal [] False + where + useTempDir :: Bool + useTempDir = Flag_NoTmpCompDir `notElem` flags hunk ./src/Haddock/Interface.hs 116 - -- If template haskell is used by the package, we can't use HscNothing as - -- target since we might need to run code generated from one or more of the - -- modules during typechecking. - if needsTemplateHaskell modgraph - then - -- Create a temporary directory in wich to write compilation output, - -- unless the user has asked us not to. - (if useTempDir then withTempDir tempDir else id) $ do - -- Turn on compilation. - let enableComp d = d { hscTarget = defaultObjectTarget } - modifySessionDynFlags enableComp - -- We need to update the DynFlags of the ModSummaries as well. - let upd m = m { ms_hspp_opts = enableComp (ms_hspp_opts m) } - let modgraph' = map upd modgraph hunk ./src/Haddock/Interface.hs 117 - processModules verbosity flags instIfaceMap modgraph' - else - processModules verbosity flags instIfaceMap modgraph + withTempOutputDir :: Ghc a -> Ghc a + withTempOutputDir action = do + tmp <- liftIO getTemporaryDirectory + x <- liftIO getProcessID + let dir = tmp ".haddock-" ++ show x + modifySessionDynFlags (setOutputDir dir) + withTempDir dir action hunk ./src/Haddock/Interface.hs 126 -withTempDir :: (ExceptionMonad m, MonadIO m) => FilePath -> m a -> m a -withTempDir dir = gbracket_ (liftIO $ createDirectory dir) - (liftIO $ removeDirectoryRecursive dir) + depAnalysis :: Ghc ModuleGraph + depAnalysis = do + targets <- mapM (\f -> guessTarget f Nothing) modules + setTargets targets + depanal [] False + hunk ./src/Haddock/Interface.hs 133 + enableCompilation :: ModuleGraph -> Ghc ModuleGraph + enableCompilation modGraph = do + let enableComp d = d { hscTarget = defaultObjectTarget } + modifySessionDynFlags enableComp + -- We need to update the DynFlags of the ModSummaries as well. + let upd m = m { ms_hspp_opts = enableComp (ms_hspp_opts m) } + let modGraph' = map upd modGraph + return modGraph' hunk ./src/Haddock/Interface.hs 142 -processModules :: Verbosity -> [Flag] -> InstIfaceMap -> [ModSummary] - -> Ghc [Interface] -processModules verbosity flags instIfaceMap mods = do + +createIfaces :: Verbosity -> [Flag] -> InstIfaceMap -> ModuleGraph -> Ghc [Interface] +createIfaces verbosity flags instIfaceMap mods = do hunk ./src/Haddock/Interface.hs 211 +-------------------------------------------------------------------------------- +-- * Building of cross-linking environment +-------------------------------------------------------------------------------- + + hunk ./src/Haddock/Interface.hs 237 + + +-------------------------------------------------------------------------------- +-- * Utils +-------------------------------------------------------------------------------- + + +withTempDir :: (ExceptionMonad m, MonadIO m) => FilePath -> m a -> m a +withTempDir dir = gbracket_ (liftIO $ createDirectory dir) + (liftIO $ removeDirectoryRecursive dir) + hunk ./src/Main.hs 18 -module Main (main, createInterfaces') where +module Main (main, readPackagesAndProcessModules) where hunk ./src/Main.hs 118 --- | Create 'Interface' structures from a given list of Haddock command-line --- flags and file or module names (as accepted by 'haddock' executable). Flags --- that control documentation generation or show help or version information --- are ignored. --- --- This is a more high-level alternative to 'createInterfaces'. -createInterfaces' - :: [String] -- ^ A list of command-line flags and file or module names - -> IO [Interface] -- ^ Resulting list of interfaces -createInterfaces' args = do - (flags, fileArgs) <- parseHaddockOpts args - (_, ifaces) <- readPackagesAndCreateInterfaces flags fileArgs - return ifaces - - -readPackagesAndCreateInterfaces :: [Flag] -> [String] -> IO ([(InterfaceFile, FilePath)], [Interface]) -readPackagesAndCreateInterfaces flags fileArgs = do - libDir <- getGhcLibDir flags - - -- Catches all GHC source errors, then prints and re-throws them. - let handleSrcErrors action' = flip handleSourceError action' $ \err -> do - printExceptionAndWarnings err - liftIO exitFailure - - -- Initialize GHC. - withGhc libDir (ghcFlags flags) $ \_ -> handleSrcErrors $ do - - -- Get packages supplied with --read-interface. - packages <- readInterfaceFiles nameCacheFromGhc (ifacePairs flags) - - -- Create the interfaces -- this is the core part of Haddock. - (ifaces, homeLinks) <- createInterfaces (verbosity flags) fileArgs flags - (map fst packages) - - -- Dump an "interface file" (.haddock file), if requested. - liftIO $ case optDumpInterfaceFile flags of - Just f -> dumpInterfaceFile f (map toInstalledIface ifaces) homeLinks - Nothing -> return () - - return (packages, ifaces) - - hunk ./src/Main.hs 123 - (flags, fileArgs) <- parseHaddockOpts args + (flags, files) <- parseHaddockOpts args hunk ./src/Main.hs 126 - if not (null fileArgs) + if not (null files) hunk ./src/Main.hs 128 - (packages, ifaces) <- readPackagesAndCreateInterfaces flags fileArgs + (packages, ifaces, homeLinks) <- readPackagesAndProcessModules flags files + + -- Dump an "interface file" (.haddock file), if requested. + case optDumpInterfaceFile flags of + Just f -> dumpInterfaceFile f (map toInstalledIface ifaces) homeLinks + Nothing -> return () hunk ./src/Main.hs 149 +readPackagesAndProcessModules flags files = do + libDir <- getGhcLibDir flags + + -- Catches all GHC source errors, then prints and re-throws them. + let handleSrcErrors action' = flip handleSourceError action' $ \err -> do + printExceptionAndWarnings err + liftIO exitFailure + + -- Initialize GHC. + withGhc libDir (ghcFlags flags) $ \_ -> handleSrcErrors $ do + + -- Get packages supplied with --read-interface. + packages <- readInterfaceFiles nameCacheFromGhc (ifacePairs flags) + + -- Create the interfaces -- this is the core part of Haddock. + let ifaceFiles = map fst packages + (ifaces, homeLinks) <- processModules (verbosity flags) files flags ifaceFiles + + return (packages, ifaces, homeLinks) + + hunk ./src/Haddock/Interface.hs 46 -import Data.Maybe hunk ./src/Haddock/Interface.hs 158 - tc_mod <- loadModule =<< typecheckModule =<< parseModule modsum + tm <- loadModule =<< typecheckModule =<< parseModule modsum hunk ./src/Haddock/Interface.hs 161 - let filename = msHsFilePath modsum - let dynflags = ms_hspp_opts modsum - let Just renamed_src = renamedSource tc_mod - let ghcMod = mkGhcModule (ms_mod modsum, - filename, - (parsedSource tc_mod, - renamed_src, - typecheckedSource tc_mod, - moduleInfo tc_mod)) - dynflags hunk ./src/Haddock/Interface.hs 162 - (interface, msg) <- runWriterGhc $ createInterface ghcMod flags modMap instIfaceMap + (interface, msg) <- runWriterGhc $ createInterface tm flags modMap instIfaceMap hunk ./src/Haddock/Interface.hs 170 -type CheckedMod = (Module, FilePath, FullyCheckedMod) - - -type FullyCheckedMod = (ParsedSource, - RenamedSource, - TypecheckedSource, - ModuleInfo) - - --- | Dig out what we want from the typechecker output -mkGhcModule :: CheckedMod -> DynFlags -> GhcModule -mkGhcModule (mdl, file, checkedMod) dynflags = GhcModule { - ghcModule = mdl, - ghcFilename = file, - ghcMbDocOpts = mbOpts, - ghcMbDocHdr = mbDocHdr, - ghcGroup = group_, - ghcMbExports = mbExports, - ghcExportedNames = modInfoExports modInfo, - ghcDefinedNames = map getName $ modInfoTyThings modInfo, - ghcNamesInScope = fromJust $ modInfoTopLevelScope modInfo, - ghcInstances = modInfoInstances modInfo, - ghcDynFlags = dynflags -} - where - mbOpts = haddockOptions dynflags - (group_, _, mbExports, mbDocHdr) = renamed - (_, renamed, _, modInfo) = checkedMod - - hunk ./src/Haddock/Interface/Create.hs 32 +import HscTypes hunk ./src/Haddock/Interface/Create.hs 41 -createInterface :: GhcModule -> [Flag] -> IfaceMap -> InstIfaceMap +createInterface :: TypecheckedModule -> [Flag] -> IfaceMap -> InstIfaceMap hunk ./src/Haddock/Interface/Create.hs 43 -createInterface ghcMod flags modMap instIfaceMap = do +createInterface tm flags modMap instIfaceMap = do hunk ./src/Haddock/Interface/Create.hs 45 - let mdl = ghcModule ghcMod - dflags = ghcDynFlags ghcMod + let ms = pm_mod_summary . tm_parsed_module $ tm + mi = moduleInfo tm + mdl = ms_mod ms + dflags = ms_hspp_opts ms + instances = modInfoInstances mi + exportedNames = modInfoExports mi + -- XXX: confirm always a Just. + Just (group_, _, optExports, optDocHeader) = renamedSource tm hunk ./src/Haddock/Interface/Create.hs 58 - opts0 <- liftErrMsg $ mkDocOpts (ghcMbDocOpts ghcMod) flags mdl + opts0 <- liftErrMsg $ mkDocOpts (haddockOptions dflags) flags mdl hunk ./src/Haddock/Interface/Create.hs 63 + (info, mbDoc) <- liftErrMsg $ lexParseRnHaddockModHeader dflags gre optDocHeader + decls0 <- liftErrMsg $ declInfos dflags gre (topDecls group_) hunk ./src/Haddock/Interface/Create.hs 66 - (info, mbDoc) <- liftErrMsg $ lexParseRnHaddockModHeader dflags - gre (ghcMbDocHdr ghcMod) - decls0 <- liftErrMsg $ declInfos dflags gre (topDecls (ghcGroup ghcMod)) - - let instances = ghcInstances ghcMod - localInsts = filter (nameIsLocalOrFrom mdl . getName) instances + let localInsts = filter (nameIsLocalOrFrom mdl . getName) instances hunk ./src/Haddock/Interface/Create.hs 72 - exports = fmap (reverse . map unLoc) (ghcMbExports ghcMod) + exports = fmap (reverse . map unLoc) optExports hunk ./src/Haddock/Interface/Create.hs 74 - exportedNames = ghcExportedNames ghcMod hunk ./src/Haddock/Interface/Create.hs 77 - exportItems <- mkExportItems modMap mdl gre (ghcExportedNames ghcMod) decls declMap + exportItems <- mkExportItems modMap mdl gre exportedNames decls declMap hunk ./src/Haddock/Interface/Create.hs 91 - ifaceOrigFilename = ghcFilename ghcMod, + ifaceOrigFilename = msHsFilePath ms, hunk ./src/Haddock/Types.hs 354 --- * Misc. ------------------------------------------------------------------------------ - - --- TODO: remove? --- | This structure holds the module information we get from GHC's --- type checking phase -data GhcModule = GhcModule { - ghcModule :: Module, - ghcFilename :: FilePath, - ghcMbDocOpts :: Maybe String, - ghcMbDocHdr :: GhcDocHdr, - ghcGroup :: HsGroup Name, - ghcMbExports :: Maybe [LIE Name], - ghcExportedNames :: [Name], - ghcDefinedNames :: [Name], - ghcNamesInScope :: [Name], - ghcInstances :: [Instance], - ghcDynFlags :: DynFlags -} - - ------------------------------------------------------------------------------ hunk ./src/Main.hs 149 +readPackagesAndProcessModules :: [Flag] -> [String] -> IO ([(InterfaceFile, FilePath)], + [Interface], LinkEnv) hunk ./html/Ocean.std-theme/ocean.css 21 -ul { margin-left: 2em; } +ul, ol { + margin: 0.8em 0 0.8em 2em; +} + +dl { + margin: 0.8em 0; +} + +dt { + margin-top: 0.8em; + font-weight: bold; +} +dd { + margin-left: 2em; +} hunk ./html/Ocean.std-theme/ocean.css 398 -#interface dt { +.subs dl { + margin: 0; +} + +.subs dt { hunk ./html/Ocean.std-theme/ocean.css 409 -#interface dd { +.subs dd { hunk ./html/Ocean.std-theme/ocean.css 417 -#interface dd.empty { +.subs dd.empty { hunk ./html/Ocean.std-theme/ocean.css 421 -#interface dd p { +.subs dd p { hunk ./tests/golden-tests/tests/Test.hs 243 + + [cat] a small, furry, domesticated mammal + + [pineapple] a fruit grown in the tropics hunk ./src/Haddock/Lex.x 55 + $ws* $digit+ \. { token TokNumber `andBegin` string } hunk ./html/Ocean.std-theme/ocean.css 118 - margin-left: 1em; + margin: 0 0 0 1em; hunk ./html/Ocean.std-theme/ocean.css 301 - margin-left: 0; + margin: 0; hunk ./tests/golden-tests/tests/A.html.ref 1 - - -A
     ContentsIndex
    A
    Documentation
    data A
    Constructors
    A
    Produced by Haddock version 2.7.2
    - +A

    A

    Documentation

    data A

    Constructors

    A 
    hunk ./tests/golden-tests/tests/B.html.ref 1 - - -B
     ContentsIndex
    B
    Documentation
    module A
    Produced by Haddock version 2.7.2
    - +B

    B

    Documentation

    module A

    hunk ./tests/golden-tests/tests/Bug1.html.ref 1 - - -Bug1
     ContentsIndex
    Bug1
    Synopsis
    data T = T
    Documentation
    data T
    We should have different anchors for constructors and types/classes. This - hyperlink should point to the type constructor by default: T. -
    Constructors
    T
    Produced by Haddock version 2.7.2
    - +Bug1

    Bug1

    Synopsis

    • data T = T

    Documentation

    data T

    We should have different anchors for constructors and types/classes. This + hyperlink should point to the type constructor by default: T. +

    Constructors

    T 
    hunk ./tests/golden-tests/tests/Bug2.html.ref 1 - - -Bug2
     ContentsIndex
    Bug2
    Documentation
    x :: A
    Produced by Haddock version 2.7.2
    - +Bug2

    Bug2

    Documentation

    x :: A

    hunk ./tests/golden-tests/tests/Bug3.html.ref 1 - - -Bug3
     ContentsIndex
    Bug3
    Synopsis
    foo :: Int
    Documentation
    foo :: Int
    /multi-line +Bug3

    Bug3

    Synopsis

    Documentation

    foo :: Int

    /multi-line hunk ./tests/golden-tests/tests/Bug3.html.ref 6 -

    Produced by Haddock version 2.7.2
    - +

    hunk ./tests/golden-tests/tests/Bug4.html.ref 1 - - -Bug4
     ContentsIndex
    Bug4
    Synopsis
    foo :: Int
    Documentation
    foo :: Int
    don't use apostrophe's in the wrong place's -
    Produced by Haddock version 2.7.2
    - +Bug4

    Bug4

    Synopsis

    Documentation

    foo :: Int

    don't use apostrophe's in the wrong place's +

    hunk ./tests/golden-tests/tests/Bug6.html.ref 1 - - -Bug6
     ContentsIndex
    Bug6
    Description
    Exporting records. -
    Synopsis
    data A = A Int
    data B = B {
    b :: Int
    }
    data C = C {
    c1 :: Int
    c2 :: Int
    }
    data D = D Int Int
    newtype E = E Int
    Documentation
    data A
    This record is exported without its field -
    Constructors
    A Int
    data B
    .. with its field, but the field is named separately in the export list +Bug6

    Bug6

    Description

    Exporting records. +

    Synopsis

    Documentation

    data A

    This record is exported without its field +

    Constructors

    A Int 

    data B

    .. with its field, but the field is named separately in the export list hunk ./tests/golden-tests/tests/Bug6.html.ref 8 -

    Constructors
    B
    b :: Int
    data C
    .. with fields names as subordinate names in the export -
    Constructors
    C
    c1 :: Int
    c2 :: Int
    data D
    .. with only some of the fields exported (we can't handle this one - +

    Constructors

    B 

    Fields

    b :: Int
     

    data C

    .. with fields names as subordinate names in the export +

    Constructors

    C 

    Fields

    c1 :: Int
     
    c2 :: Int
     

    data D

    .. with only some of the fields exported (we can't handle this one - hunk ./tests/golden-tests/tests/Bug6.html.ref 11 -

    Constructors
    D Int Int
    newtype E
    a newtype with a field -
    Constructors
    E Int
    Produced by Haddock version 2.7.2
    - +

    Constructors

    D Int Int 

    newtype E

    a newtype with a field +

    Constructors

    E Int 
    hunk ./tests/golden-tests/tests/Bug7.html.ref 1 - - -Bug7
     ContentsIndex
    Bug7
    Description
    This module caused a duplicate instance in the documentation for the Foo +Bug7

    Bug7

    Description

    This module caused a duplicate instance in the documentation for the Foo hunk ./tests/golden-tests/tests/Bug7.html.ref 6 -

    Synopsis
    data Foo = Foo
    class Bar x y
    Documentation
    data Foo
    The Foo datatype -
    Constructors
    Foo
    show/hide Instances
    Bar Foo FooJust one instance -
    class Bar x y
    The Bar class -
    show/hide Instances
    Bar Foo FooJust one instance -
    Produced by Haddock version 2.7.2
    - +

    Synopsis

    Documentation

    data Foo

    The Foo datatype +

    Constructors

    Foo 

    Instances

    Bar Foo Foo

    Just one instance +

    class Bar x y

    The Bar class +

    Instances

    Bar Foo Foo

    Just one instance +

    hunk ./tests/golden-tests/tests/Bug8.html.ref 1 - - -Bug8
     ContentsIndex
    Bug8
    Documentation
    data Typ
    Constructors
    Type (String, [Typ])
    TFree (String, [String])
    Produced by Haddock version 2.7.2
    - +Bug8

    Bug8

    Documentation

    data Typ

    Constructors

    Type (String, [Typ]) 
    TFree (String, [String]) 
    hunk ./tests/golden-tests/tests/Bugs.html.ref 1 - - -Bugs
     ContentsIndex
    Bugs
    Documentation
    data A a
    Constructors
    A a (a -> Int)
    Produced by Haddock version 2.7.2
    - +Bugs

    Bugs

    Documentation

    data A a

    Constructors

    A a (a -> Int) 
    hunk ./tests/golden-tests/tests/CrossPackageDocs.html.ref 1 - - -CrossPackageDocs
     ContentsIndex
    CrossPackageDocs
    Synopsis
    map :: (a -> b) -> [a] -> [b]
    class Monad m where
    (>>=) :: m a -> (a -> m b) -> m b
    (>>) :: m a -> m b -> m b
    return :: a -> m a
    fail :: String -> m a
    runInteractiveProcess :: FilePath -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> IO (Handle, Handle, Handle, ProcessHandle)
    Documentation
    map :: (a -> b) -> [a] -> [b]

    map f xs is the list obtained by applying f to each element - of xs, i.e., -

    map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn] +CrossPackageDocs

    CrossPackageDocs

    Synopsis

    Documentation

    map :: (a -> b) -> [a] -> [b]

    map f xs is the list obtained by applying f to each element + of xs, i.e., +

    map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn] hunk ./tests/golden-tests/tests/CrossPackageDocs.html.ref 8 -
    class Monad m where

    The Monad class defines the basic operations over a monad, -a concept from a branch of mathematics known as category theory. +

    class Monad m where

    The Monad class defines the basic operations over a monad, +a concept from a branch of mathematics known as category theory. hunk ./tests/golden-tests/tests/CrossPackageDocs.html.ref 11 -think of a monad as an abstract datatype of actions. -Haskell's do expressions provide a convenient syntax for writing +think of a monad as an abstract datatype of actions. +Haskell's do expressions provide a convenient syntax for writing hunk ./tests/golden-tests/tests/CrossPackageDocs.html.ref 14 -

    Minimal complete definition: >>= and return. -

    Instances of Monad should satisfy the following laws: -

    return a >>= k == k a +

    Minimal complete definition: >>= and return. +

    Instances of Monad should satisfy the following laws: +

    return a >>= k == k a hunk ./tests/golden-tests/tests/CrossPackageDocs.html.ref 19 -

    Instances of both Monad and Functor should additionally satisfy the law: -

    fmap f xs == xs >>= return . f -

    The instances of Monad for lists, Data.Maybe.Maybe and System.IO.IO -defined in the Prelude satisfy these laws. -

    Methods
    (>>=) :: m a -> (a -> m b) -> m b
    Sequentially compose two actions, passing any value produced +

    Instances of both Monad and Functor should additionally satisfy the law: +

    fmap f xs == xs >>= return . f +

    The instances of Monad for lists, Data.Maybe.Maybe and System.IO.IO +defined in the Prelude satisfy these laws. +

    Methods

    (>>=) :: m a -> (a -> m b) -> m b

    Sequentially compose two actions, passing any value produced hunk ./tests/golden-tests/tests/CrossPackageDocs.html.ref 25 -

    (>>) :: m a -> m b -> m b
    Sequentially compose two actions, discarding any value produced +

    (>>) :: m a -> m b -> m b

    Sequentially compose two actions, discarding any value produced hunk ./tests/golden-tests/tests/CrossPackageDocs.html.ref 28 -

    return :: a -> m a
    Inject a value into the monadic type. -
    fail :: String -> m a
    Fail with a message. This operation is not part of the +

    return :: a -> m a

    Inject a value into the monadic type. +

    fail :: String -> m a

    Fail with a message. This operation is not part of the hunk ./tests/golden-tests/tests/CrossPackageDocs.html.ref 31 - failure in a do expression. -

    show/hide Instances
    runInteractiveProcess
    :: FilePathFilename of the executable -
    -> [String]Arguments to pass to the executable -
    -> Maybe FilePathOptional path to the working directory -
    -> Maybe [(String, String)]Optional environment (otherwise inherit) -
    -> IO (Handle, Handle, Handle, ProcessHandle)

    Runs a raw command, and returns Handles that may be used to communicate - with the process via its stdin, stdout and stderr respectively. -

    For example, to start a process and feed a string to its stdin: -

    (inp,out,err,pid) <- runInteractiveProcess "..." + failure in a do expression. +

    Instances

    Monad [] 
    Monad IO 
    Monad Q 
    Monad Maybe 
    Monad ((->) r) 

    runInteractiveProcess

    Arguments

    :: FilePath

    Filename of the executable +

    -> [String]

    Arguments to pass to the executable +

    -> Maybe FilePath

    Optional path to the working directory +

    -> Maybe [(String, String)]

    Optional environment (otherwise inherit) +

    -> IO (Handle, Handle, Handle, ProcessHandle) 

    Runs a raw command, and returns Handles that may be used to communicate + with the process via its stdin, stdout and stderr respectively. +

    For example, to start a process and feed a string to its stdin: +

    (inp,out,err,pid) <- runInteractiveProcess "..." hunk ./tests/golden-tests/tests/CrossPackageDocs.html.ref 41 -

    The Handles are initially in binary mode; if you need them to be - in text mode then use hSetBinaryMode. -

    Produced by Haddock version 2.7.2
    - +

    The Handles are initially in binary mode; if you need them to be + in text mode then use hSetBinaryMode. +

    hunk ./tests/golden-tests/tests/Examples.html.ref 1 - - -Examples
     ContentsIndex
    Examples
    Synopsis
    fib :: Integer -> Integer
    Documentation
    fib :: Integer -> Integer

    Fibonacci number of given Integer. -

    Examples: -

    ghci> fib 5
    -5
    -ghci> fib 10
    -55
    -
    ghci> fib 10
    -55
    -

    One more Example: -

    ghci> fib 5
    -5
    -

    One more Example: -

    ghci> fib 5
    -5
    -

    Example with an import: -

    ghci> import Data.Char
    -ghci> isSpace 'a'
    -False
    -
    Produced by Haddock version 2.7.2
    - +Examples

    Examples

    Synopsis

    Documentation

    fib :: Integer -> Integer

    Fibonacci number of given Integer. +

    Examples: +

    ghci> fib 5
    +5
    +ghci> fib 10
    +55
    +
    ghci> fib 10
    +55
    +

    One more Example: +

    ghci> fib 5
    +5
    +

    One more Example: +

    ghci> fib 5
    +5
    +

    Example with an import: +

    ghci> import Data.Char
    +ghci> isSpace 'a'
    +False
    +
    hunk ./tests/golden-tests/tests/FunArgs.html.ref 1 - - -FunArgs
     ContentsIndex
    FunArgs
    Documentation
    f
    :: forall a . Ord a
    => IntFirst argument -
    -> aSecond argument -
    -> BoolThird argument -
    -> (a -> a)Fourth argument -
    -> ()Result -
    g
    :: aFirst argument -
    -> bSecond argument -
    -> cThird argument -
    -> dResult -
    Produced by Haddock version 2.7.2
    - +FunArgs

    FunArgs

    Documentation

    f

    Arguments

    :: forall a . Ord a 
    => Int

    First argument +

    -> a

    Second argument +

    -> Bool

    Third argument +

    -> (a -> a)

    Fourth argument +

    -> ()

    Result +

    g

    Arguments

    :: a

    First argument +

    -> b

    Second argument +

    -> c

    Third argument +

    -> d

    Result +

    hunk ./tests/golden-tests/tests/GADTRecords.html.ref 1 - - -GADTRecords
     ContentsIndex
    GADTRecords
    Synopsis
    data H1 a b where
    C1 :: H1 a b
    C2 :: Ord a => [a] -> H1 a a
    C3 :: {
    field :: Int
    } -> H1 Int Int
    C4 :: {
    field2 :: a
    } -> H1 Int a
    Documentation
    data H1 a b where
    h1 -
    Constructors
    C1 :: H1 a b
    C2 :: Ord a => [a] -> H1 a a
    C3 :: Int -> H1 Int Int
    field :: Inthello docs -
    C4 :: a -> H1 Int a
    field2 :: ahello2 docs -
    Produced by Haddock version 2.7.2
    - +GADTRecords

    GADTRecords

    Synopsis

    Documentation

    data H1 a b where

    h1 +

    Constructors

    C1 :: H1 a b 
    C2 :: Ord a => [a] -> H1 a a 
    C3 :: Int -> H1 Int Int 

    Fields

    field :: Int

    hello docs +

    C4 :: a -> H1 Int a 

    Fields

    field2 :: a

    hello2 docs +

    hunk ./tests/golden-tests/tests/Hash.html.ref 1 - - -Hash
     ContentsIndex
    Hash
    Contents
    The HashTable type -
    Operations on HashTables -
    The Hash class -
    Description
    Implementation of fixed-size hash tables, with a type +Hash

    Hash

    Description

    Implementation of fixed-size hash tables, with a type hunk ./tests/golden-tests/tests/Hash.html.ref 9 -

    Synopsis
    data HashTable key val
    new :: (Eq key, Hash key) => Int -> IO (HashTable key val)
    insert :: (Eq key, Hash key) => key -> val -> IO ()
    lookup :: Hash key => key -> IO (Maybe val)
    class Hash a where
    hash :: a -> Int
    The HashTable type -
    data HashTable key val
    A hash table with keys of type key and values of type val. - The type key should be an instance of Eq. -
    Operations on HashTables -
    new :: (Eq key, Hash key) => Int -> IO (HashTable key val)
    Builds a new hash table with a given size -
    insert :: (Eq key, Hash key) => key -> val -> IO ()
    Inserts a new element into the hash table -
    lookup :: Hash key => key -> IO (Maybe val)
    Looks up a key in the hash table, returns Just val if the key - was found, or Nothing otherwise. -
    The Hash class -
    class Hash a where
    A class of types which can be hashed. -
    Methods
    hash :: a -> Int
    hashes the value of type a into an Int -
    show/hide Instances
    Hash Float
    Hash Int
    (Hash a, Hash b) => Hash (a, b)
    Produced by Haddock version 2.7.2
    - +

    Synopsis

    The HashTable type +

    data HashTable key val

    A hash table with keys of type key and values of type val. + The type key should be an instance of Eq. +

    Operations on HashTables +

    new :: (Eq key, Hash key) => Int -> IO (HashTable key val)

    Builds a new hash table with a given size +

    insert :: (Eq key, Hash key) => key -> val -> IO ()

    Inserts a new element into the hash table +

    lookup :: Hash key => key -> IO (Maybe val)

    Looks up a key in the hash table, returns Just val if the key + was found, or Nothing otherwise. +

    The Hash class +

    class Hash a where

    A class of types which can be hashed. +

    Methods

    hash :: a -> Int

    hashes the value of type a into an Int +

    Instances

    Hash Float 
    Hash Int 
    (Hash a, Hash b) => Hash (a, b) 
    hunk ./tests/golden-tests/tests/NamedDoc.html.ref 1 - - -NamedDoc
     ContentsIndex
    NamedDoc
    Synopsis
    Documentation
    bar -
    Produced by Haddock version 2.7.2
    - +NamedDoc

    NamedDoc

    Synopsis

      Documentation

      bar +

      hunk ./tests/golden-tests/tests/NoLayout.hs 7 - -- | the class 'C' + -- | the function 'g' hunk ./tests/golden-tests/tests/NoLayout.html.ref 1 - - -NoLayout
       ContentsIndex
      NoLayout
      Synopsis
      g :: Int
      Documentation
      g :: Int
      the class C -
      Produced by Haddock version 2.7.2
      - +NoLayout

      NoLayout

      Synopsis

      Documentation

      g :: Int

      the function g +

      hunk ./tests/golden-tests/tests/NonGreedy.html.ref 1 - - -NonGreedy
       ContentsIndex
      NonGreedy
      Synopsis
      f :: a
      Documentation
      f :: a
      url1 url2 -
      Produced by Haddock version 2.7.2
      - +NonGreedy

      NonGreedy

      Synopsis

      • f :: a

      Documentation

      f :: a

      hunk ./tests/golden-tests/tests/QuasiExpr.html.ref 1 - - -QuasiExpr
       ContentsIndex
      QuasiExpr
      Documentation
      data Expr
      Constructors
      IntExpr Integer
      AntiIntExpr String
      BinopExpr BinOp Expr Expr
      AntiExpr String
      show/hide Instances
      data BinOp
      Constructors
      AddOp
      SubOp
      MulOp
      DivOp
      show/hide Instances
      eval :: Expr -> Integer
      parseExprExp :: String -> Q Exp
      Produced by Haddock version 2.7.2
      - +QuasiExpr

      QuasiExpr

      Documentation

      data BinOp

      Constructors

      AddOp 
      SubOp 
      MulOp 
      DivOp 

      parseExprExp :: String -> Q Exp

      hunk ./tests/golden-tests/tests/QuasiQuote.html.ref 1 - - -QuasiQuote
       ContentsIndex
      QuasiQuote
      Documentation
      val :: Integer
      Produced by Haddock version 2.7.2
      - +QuasiQuote

      QuasiQuote

      Documentation

      hunk ./tests/golden-tests/tests/TH.html.ref 1 - - -TH
       ContentsIndex
      TH
      Documentation
      decl :: Q [Dec]
      Produced by Haddock version 2.7.2
      - +TH

      TH

      Documentation

      decl :: Q [Dec]

      hunk ./tests/golden-tests/tests/TH2.html.ref 1 - - -TH2
       ContentsIndex
      TH2
      Produced by Haddock version 2.7.2
      - +TH2

      TH2

      hunk ./tests/golden-tests/tests/Test.html.ref 1 - - -Test
       ContentsIndex
      Test
      Portabilityportable
      Stabilityprovisional
      Maintainerlibraries@haskell.org
      Contents
      Type declarations -
      Data types -
      Records -
      Class declarations -
      Function types -
      Auxiliary stuff -
      A hidden module -
      A visible module -
      Existential / Universal types -
      Type signatures with argument docs -
      A section -
      A subsection -
      Description
      This module illustrates & tests most of the features of Haddock. - Testing references from the description: T, f, g, visible. -
      Synopsis
      data T a b
      = A Int (Maybe Float)
      | B (T a b, T Int Float)
      data T2 a b
      data T3 a b
      = A1 a
      | B1 b
      data T4 a b
      = A2 a
      | B2 b
      data T5 a b
      = A3 a
      | B3 b
      data T6
      = A4
      | B4
      | C4
      newtype N1 a = N1 a
      newtype N2 a b = N2 {
      n :: a b
      }
      newtype N3 a b = N3 {
      n3 :: a b
      }
      data N4 a b
      newtype N5 a b = N5 {
      n5 :: a b
      }
      newtype N6 a b = N6 {
      n6 :: a b
      }
      newtype N7 a b = N7 {
      n7 :: a b
      }
      data R
      = C1 {
      p :: Int
      q :: forall a. a -> a
      r :: Int
      s :: Int
      }
      | C2 {
      t :: T1 -> T2 Int Int -> T3 Bool Bool -> T4 Float Float -> T5 () ()
      u :: Int
      v :: Int
      }
      data R1 = C3 {
      s1 :: Int
      s2 :: Int
      s3 :: Int
      }
      class D a => C a where
      a :: IO a
      b :: [a]
      class D a where
      d :: T a b
      e :: (a, a)
      class E a
      class F a where
      ff :: a
      f :: C a => a -> Int
      g :: Int -> IO CInt
      hidden :: Int -> Int
      module Visible
      data Ex a
      = forall b . C b => Ex1 b
      | forall b . Ex2 b
      | forall b . C a => Ex3 b
      | Ex4 (forall a. a -> a)
      k :: T () () -> T2 Int Int -> (T3 Bool Bool -> T4 Float Float) -> T5 () () -> IO ()
      l :: (Int, Int, Float) -> Int
      m :: R -> N1 () -> IO Int
      o :: Float -> IO Float
      f' :: Int
      Type declarations -
      Data types -
      data T a b
      This comment applies to the following declaration +Test
      Portability
      portable
      Stability
      provisional
      Maintainer
      libraries@haskell.org

      Test

      Description

      This module illustrates & tests most of the features of Haddock. + Testing references from the description: T, f, g, visible. +

      Synopsis

      Type declarations +

      Data types +

      data T a b

      This comment applies to the following declaration hunk ./tests/golden-tests/tests/Test.html.ref 22 -

      Constructors
      A Int (Maybe Float)This comment describes the A constructor -
      B (T a b, T Int Float)This comment describes the B constructor -
      data T2 a b
      An abstract data declaration -
      data T3 a b
      A data declaration with no documentation annotations on the constructors -
      Constructors
      A1 a
      B1 b
      data T4 a b
      Constructors
      A2 a
      B2 b
      data T5 a b
      Constructors
      A3 adocuments A3 -
      B3 bdocuments B3 -
      data T6
      Testing alternative comment styles -
      Constructors
      A4This is the doc for A4 -
      B4This is the doc for B4 -
      C4This is the doc for C4 -
      newtype N1 a
      A newtype -
      Constructors
      N1 a
      newtype N2 a b
      A newtype with a fieldname -
      Constructors
      N2
      n :: a b
      newtype N3 a b
      A newtype with a fieldname, documentation on the field -
      Constructors
      N3
      n3 :: a bthis is the n3 field -
      data N4 a b
      An abstract newtype - we show this one as data rather than newtype because +

      Constructors

      A Int (Maybe Float)

      This comment describes the A constructor +

      B (T a b, T Int Float)

      This comment describes the B constructor +

      data T2 a b

      An abstract data declaration +

      data T3 a b

      A data declaration with no documentation annotations on the constructors +

      Constructors

      A1 a 
      B1 b 

      data T4 a b

      Constructors

      A2 a 
      B2 b 

      data T5 a b

      Constructors

      A3 a

      documents A3 +

      B3 b

      documents B3 +

      data T6

      Testing alternative comment styles +

      Constructors

      A4

      This is the doc for A4 +

      B4

      This is the doc for B4 +

      C4

      This is the doc for C4 +

      newtype N1 a

      A newtype +

      Constructors

      N1 a 

      newtype N2 a b

      A newtype with a fieldname +

      Constructors

      N2 

      Fields

      n :: a b
       

      newtype N3 a b

      A newtype with a fieldname, documentation on the field +

      Constructors

      N3 

      Fields

      n3 :: a b

      this is the n3 field +

      data N4 a b

      An abstract newtype - we show this one as data rather than newtype because hunk ./tests/golden-tests/tests/Test.html.ref 38 -

      newtype N5 a b
      Constructors
      N5
      n5 :: a bno docs on the datatype or the constructor -
      newtype N6 a b
      Constructors
      N6docs on the constructor only -
      n6 :: a b
      newtype N7 a b
      docs on the newtype and the constructor -
      Constructors
      N7The N7 constructor -
      n7 :: a b
      Records -
      data R
      This is the documentation for the R record, which has four fields, - p, q, r, and s. -
      Constructors
      C1This is the C1 record constructor, with the following fields: -
      p :: IntThis comment applies to the p field -
      q :: forall a. a -> aThis comment applies to the q field -
      r :: IntThis comment applies to both r and s -
      s :: IntThis comment applies to both r and s -
      C2This is the C2 record constructor, also with some fields: -
      t :: T1 -> T2 Int Int -> T3 Bool Bool -> T4 Float Float -> T5 () ()
      u :: Int
      v :: Int
      data R1
      Testing different record commenting styles -
      Constructors
      C3This is the C3 record constructor -
      s1 :: IntThe s1 record selector -
      s2 :: IntThe s2 record selector -
      s3 :: IntThe s3 record selector -
      test that we can export record selectors on their own: -
      Class declarations -
      class D a => C a where
      This comment applies to the previous declaration (the C class) -
      Methods
      a :: IO a
      this is a description of the a method -
      b :: [a]
      this is a description of the b method -
      class D a where
      This is a class declaration with no separate docs for the methods -
      Methods
      d :: T a b
      e :: (a, a)
      show/hide Instances
      class E a
      This is a class declaration with no methods (or no methods exported) -
      class F a where
      Methods
      ff :: a
      Test that we can export a class method on its own: -
      Function types -
      f :: C a => a -> Int

      In a comment string we can refer to identifiers in scope with -single quotes like this: T, and we can refer to modules by -using double quotes: Foo. We can add emphasis like this. -

      • This is a bulleted list -
      • This is the next item (different kind of bullet) -
      1. This is an ordered list -

      2. This is the next item (different kind of bullet) -

      -     This is a block of code, which can include other markup: R
      +

      newtype N5 a b

      Constructors

      N5 

      Fields

      n5 :: a b

      no docs on the datatype or the constructor +

      newtype N6 a b

      Constructors

      N6

      docs on the constructor only +

      Fields

      n6 :: a b
       

      newtype N7 a b

      docs on the newtype and the constructor +

      Constructors

      N7

      The N7 constructor +

      Fields

      n7 :: a b
       

      Records +

      data R

      This is the documentation for the R record, which has four fields, + p, q, r, and s. +

      Constructors

      C1

      This is the C1 record constructor, with the following fields: +

      Fields

      p :: Int

      This comment applies to the p field +

      q :: forall a. a -> a

      This comment applies to the q field +

      r :: Int

      This comment applies to both r and s +

      s :: Int

      This comment applies to both r and s +

      C2

      This is the C2 record constructor, also with some fields: +

      Fields

      t :: T1 -> T2 Int Int -> T3 Bool Bool -> T4 Float Float -> T5 () ()
       
      u :: Int
       
      v :: Int
       

      data R1

      Testing different record commenting styles +

      Constructors

      C3

      This is the C3 record constructor +

      Fields

      s1 :: Int

      The s1 record selector +

      s2 :: Int

      The s2 record selector +

      s3 :: Int

      The s3 record selector +

      test that we can export record selectors on their own: +

      Class declarations +

      class D a => C a where

      This comment applies to the previous declaration (the C class) +

      Methods

      a :: IO a

      this is a description of the a method +

      b :: [a]

      this is a description of the b method +

      class D a where

      This is a class declaration with no separate docs for the methods +

      Methods

      d :: T a b

      e :: (a, a)

      Instances

      class E a

      This is a class declaration with no methods (or no methods exported) +

      class F a where

      Methods

      ff :: a

      Test that we can export a class method on its own: +

      Function types +

      f :: C a => a -> Int

      In a comment string we can refer to identifiers in scope with +single quotes like this: T, and we can refer to modules by +using double quotes: Foo. We can add emphasis like this. +

      • This is a bulleted list +
      • This is the next item (different kind of bullet) +
      1. This is an ordered list +
      2. This is the next item (different kind of bullet) +
      cat
      a small, furry, domesticated mammal +
      pineapple
      a fruit grown in the tropics +
      +     This is a block of code, which can include other markup: R
      hunk ./tests/golden-tests/tests/Test.html.ref 79
      -
       this is another block of code
      -

      We can also include URLs in documentation: http://www.haskell.org/. -

      g :: Int -> IO CInt
      we can export foreign declarations too -
      Auxiliary stuff -

      This is some documentation that is attached to a name ($aux1) +

       this is another block of code
      +

      We can also include URLs in documentation: http://www.haskell.org/. +

      g :: Int -> IO CInt

      we can export foreign declarations too +

      Auxiliary stuff +

      This is some documentation that is attached to a name ($aux1) hunk ./tests/golden-tests/tests/Test.html.ref 86 -

       code block in named doc
      This is some documentation that is attached to a name ($aux2) -
       code block on its own in named doc
       code block on its own in named doc (after newline)

      a nested, named doc comment -

      with a paragraph, -

       and a code block
      test
      +

       code block in named doc

      This is some documentation that is attached to a name ($aux2) +

       code block on its own in named doc
       code block on its own in named doc (after newline)

      a nested, named doc comment +

      with a paragraph, +

       and a code block
      test
      hunk ./tests/golden-tests/tests/Test.html.ref 91
      -
       test2
      +
       test2
      hunk ./tests/golden-tests/tests/Test.html.ref 93
      -
      +
      hunk ./tests/golden-tests/tests/Test.html.ref 96
      -
      test3
      +
      test3
      hunk ./tests/golden-tests/tests/Test.html.ref 98
      -
      +
      hunk ./tests/golden-tests/tests/Test.html.ref 101
      -
      test3
      +
      test3
      hunk ./tests/golden-tests/tests/Test.html.ref 103
      -
      test3
      +
      test3
      hunk ./tests/golden-tests/tests/Test.html.ref 105
      -
      +
      hunk ./tests/golden-tests/tests/Test.html.ref 108
      -

      aux11: -

      test3
      +

      aux11: +

      test3
      hunk ./tests/golden-tests/tests/Test.html.ref 111
      -
      +
      hunk ./tests/golden-tests/tests/Test.html.ref 114
      -
       foo
      -
       bar
      -

      This is some inline documentation in the export list -

       a code block using bird-tracks
      +
       foo
      +
       bar
      +

      This is some inline documentation in the export list +

       a code block using bird-tracks
      hunk ./tests/golden-tests/tests/Test.html.ref 120
      -
      A hidden module -
      hidden :: Int -> Int
      A visible module -
      module Visible
      nested-style doc comments -
      Existential / Universal types -
      data Ex a
      A data-type using existential/universal types -
      Constructors
      forall b . C b => Ex1 b
      forall b . Ex2 b
      forall b . C a => Ex3 b
      Ex4 (forall a. a -> a)
      Type signatures with argument docs -
      k
      :: T () ()This argument has type T -
      -> T2 Int IntThis argument has type 'T2 Int Int' -
      -> (T3 Bool Bool -> T4 Float Float)This argument has type T3 Bool Bool -> T4 Float Float -
      -> T5 () ()This argument has a very long description that should +

      A hidden module +

      hidden :: Int -> Int

      A visible module +

      module Visible

      nested-style doc comments +

      Existential / Universal types +

      data Ex a

      A data-type using existential/universal types +

      Constructors

      forall b . C b => Ex1 b 
      forall b . Ex2 b 
      forall b . C a => Ex3 b 
      Ex4 (forall a. a -> a) 

      Type signatures with argument docs +

      k

      Arguments

      :: T () ()

      This argument has type T +

      -> T2 Int Int

      This argument has type 'T2 Int Int' +

      -> (T3 Bool Bool -> T4 Float Float)

      This argument has type T3 Bool Bool -> T4 Float Float +

      -> T5 () ()

      This argument has a very long description that should hunk ./tests/golden-tests/tests/Test.html.ref 132 -

      -> IO ()This is the result type -
      This is a function with documentation for each argument -
      l
      :: (Int, Int, Float)takes a triple -
      -> Intreturns an Int -
      m
      :: R
      -> N1 ()one of the arguments -
      -> IO Intand the return value -
      This function has some arg docs -
      o
      :: FloatThe input float -
      -> IO FloatThe output float -
      A foreign import with argument docs -
      A section -
      A subsection -
       a literal line
      -

      $ a non literal line $ -

      f' :: Int
      a function with a prime can be referred to as f' +

      -> IO ()

      This is the result type +

      This is a function with documentation for each argument +

      l

      Arguments

      :: (Int, Int, Float)

      takes a triple +

      -> Int

      returns an Int +

      m

      Arguments

      :: R 
      -> N1 ()

      one of the arguments +

      -> IO Int

      and the return value +

      This function has some arg docs +

      o

      Arguments

      :: Float

      The input float +

      -> IO Float

      The output float +

      A foreign import with argument docs +

      A section +

      A subsection +

       a literal line
      +

      $ a non literal line $ +

      f' :: Int

      a function with a prime can be referred to as f' hunk ./tests/golden-tests/tests/Test.html.ref 148 -

      Produced by Haddock version 2.7.2
      - +

      hunk ./tests/golden-tests/tests/Ticket112.html.ref 1 - - -Ticket112
       ContentsIndex
      Ticket112
      Synopsis
      f :: a
      Documentation
      f :: a
      ...given a raw Addr# to the string, and the length of the string. -
      Produced by Haddock version 2.7.2
      - +Ticket112

      Ticket112

      Synopsis

      • f :: a

      Documentation

      f :: a

      ...given a raw Addr# to the string, and the length of the string. +

      hunk ./tests/golden-tests/tests/Ticket61.html.ref 1 - - -Ticket61
       ContentsIndex
      Ticket61
      Documentation
      class C a where
      Methods
      f :: a
      A comment about f -
      Produced by Haddock version 2.7.2
      - +Ticket61

      Ticket61

      Documentation

      class C a where

      Methods

      f :: a

      A comment about f +

      hunk ./tests/golden-tests/tests/Ticket75.html.ref 1 - - -Ticket75
       ContentsIndex
      Ticket75
      Synopsis
      data a :- b = Q
      f :: Int
      Documentation
      data a :- b
      Constructors
      Q
      f :: Int
      A reference to :- -
      Produced by Haddock version 2.7.2
      - +Ticket75

      Ticket75

      Synopsis

      Documentation

      data a :- b

      Constructors

      Q 

      f :: Int

      A reference to :- +

      hunk ./tests/golden-tests/tests/TypeFamilies.html.ref 1 - - -TypeFamilies
       ContentsIndex
      TypeFamilies
      Synopsis
      type family G a :: *
      class A a where
      data B a :: * -> *
      f :: B a Int
      type family F a
      Documentation
      type family G a :: *
      Type family G -
      class A a where
      A class with an associated type -
      Associated Types
      data B a :: * -> *
      An associated type -
      Methods
      f :: B a Int
      A method -
      show/hide Instances
      type family F a
      Doc for family -
      Produced by Haddock version 2.7.2
      - +TypeFamilies

      TypeFamilies

      Synopsis

      • type family G a :: *
      • class A a where
        • data B a :: * -> *
        • f :: B a Int
      • type family F a

      Documentation

      type family G a :: *

      Type family G +

      class A a where

      A class with an associated type +

      Associated Types

      data B a :: * -> *

      An associated type +

      Methods

      f :: B a Int

      A method +

      Instances

      A Int 

      type family F a

      Doc for family +

      hunk ./tests/golden-tests/tests/TypeOperators.html.ref 1 - - -TypeOperators
       ContentsIndex
      TypeOperators
      Contents
      stuff -
      Synopsis
      data a :-: b
      data (a :+: b) c
      data Op a b
      newtype O g f a = O {
      unO :: g (f a)
      }
      biO :: (g `O` f) a
      newtype Flip (~>) b a = Flip {
      unFlip :: a ~> b
      }
      stuff -
      data a :-: b
      data (a :+: b) c
      data Op a b
      newtype O g f a
      Constructors
      O
      unO :: g (f a)
      biO :: (g `O` f) a
      newtype Flip (~>) b a
      Constructors
      Flip
      unFlip :: a ~> b
      Produced by Haddock version 2.7.2
      - +TypeOperators

      TypeOperators

      Contents

      Synopsis

      stuff +

      data a :-: b

      data (a :+: b) c

      data Op a b

      newtype O g f a

      Constructors

      O 

      Fields

      unO :: g (f a)
       

      biO :: (g `O` f) a

      newtype Flip (~>) b a

      Constructors

      Flip 

      Fields

      unFlip :: a ~> b
       
      hunk ./tests/golden-tests/tests/Visible.html.ref 1 - - -Visible
       ContentsIndex
      Visible
      Documentation
      visible :: Int -> Int
      Produced by Haddock version 2.7.2
      - +Visible

      Visible

      Documentation

      hunk ./html/Ocean.std-theme/ocean.css 30 - margin-top: 0.8em; hunk ./html/Ocean.std-theme/ocean.css 223 - margin-right: 1em; + margin: 0 1em 0 0; hunk ./html/Ocean.std-theme/ocean.css 228 - margin-left: 6em; + margin: 0 0 0 6em; hunk ./html/Ocean.std-theme/ocean.css 9 + height: 100%; hunk ./html/Ocean.std-theme/ocean.css 16 + min-height: 100%; + position: relative; hunk ./html/Ocean.std-theme/ocean.css 182 - padding: 0 2em; + padding: 0 2em 6em; hunk ./html/Ocean.std-theme/ocean.css 272 - margin: 1em 0 0 0; hunk ./html/Ocean.std-theme/ocean.css 274 - padding: 0.5em; + padding: 0.5em 0; hunk ./html/Ocean.std-theme/ocean.css 277 + position: absolute; + bottom: 0; + width: 100%; + height: 3em; hunk ./html/Ocean.std-theme/ocean.css 465 - padding: 0 1em; + padding: 0 1em 1em; hunk ./src/Haddock/Backends/Xhtml/Layout.hs 121 - docElement ddef << (fmap docToHtml mdoc +++ subs) + docElement ddef << (fmap docToHtml mdoc +++ subs) hunk ./haddock.cabal 64 - html/Snappy.theme/minus.gif - html/Snappy.theme/plus.gif - html/Snappy.theme/s_haskell_icon.gif - html/Snappy.theme/snappy.css hunk ./src/Haddock/Backends/Xhtml/Layout.hs 45 +import qualified Data.Map as Map hunk ./src/Haddock/Backends/Xhtml/Layout.hs 179 -topDeclElem ((_,_,maybe_source_url), (_,_,maybe_wiki_url)) loc name html = +topDeclElem ((_,_,sourceMap), (_,_,maybe_wiki_url)) loc name html = hunk ./src/Haddock/Backends/Xhtml/Layout.hs 182 - case maybe_source_url of + case Map.lookup origPkg sourceMap of hunk ./src/Haddock/Backends/Xhtml/Layout.hs 200 + origPkg = modulePackageId origMod hunk ./src/Haddock/Backends/Xhtml/Types.hs 19 +import Data.Map +import GHC + + hunk ./src/Haddock/Backends/Xhtml/Types.hs 24 -type SourceURLs = (Maybe String, Maybe String, Maybe String) -type WikiURLs = (Maybe String, Maybe String, Maybe String) +type SourceURLs = (Maybe FilePath, Maybe FilePath, Map PackageId FilePath) +type WikiURLs = (Maybe FilePath, Maybe FilePath, Maybe FilePath) hunk ./src/Haddock/Backends/Xhtml/Types.hs 28 --- The URL for source and wiki links, and the current module +-- The URL for source and wiki links hunk ./src/Haddock/GhcUtils.hs 43 -moduleString = moduleNameString . moduleName - - --- return the name of the package, with version info -modulePackageString :: Module -> String -modulePackageString = packageIdString . modulePackageId +moduleString = moduleNameString . moduleName hunk ./src/Haddock/InterfaceFile.hs 15 - InterfaceFile(..), + InterfaceFile(..), ifPackageId, hunk ./src/Haddock/InterfaceFile.hs 49 +ifPackageId :: InterfaceFile -> PackageId +ifPackageId if_ = + case ifInstalledIfaces if_ of + [] -> error "empty InterfaceFile" + iface:_ -> modulePackageId $ instMod iface + + hunk ./src/Haddock/Options.hs 29 - ifacePairs + ifaceTriples hunk ./src/Haddock/Options.hs 233 -ifacePairs :: [Flag] -> [(FilePath, FilePath)] -ifacePairs flags = [ parseIfaceOption s | Flag_ReadInterface s <- flags ] +ifaceTriples :: [Flag] -> [(DocPaths, FilePath)] +ifaceTriples flags = [ parseIfaceOption s | Flag_ReadInterface s <- flags ] hunk ./src/Haddock/Options.hs 236 - parseIfaceOption :: String -> (FilePath, FilePath) + parseIfaceOption :: String -> (DocPaths, FilePath) hunk ./src/Haddock/Options.hs 239 - (fpath, ',':file) -> (fpath, file) - (file, _) -> ("", file) + (fpath, ',':rest) -> + case break (==',') rest of + (src, ',':file) -> ((fpath, Just src), file) + (file, _) -> ((fpath, Nothing), file) + (file, _) -> (("", Nothing), file) hunk ./src/Haddock/Types.hs 40 +type SrcMap = Map PackageId FilePath hunk ./src/Haddock/Types.hs 43 +type DocPaths = (FilePath, Maybe FilePath) -- paths to HTML and sources hunk ./src/Main.hs 61 +import Module hunk ./src/Main.hs 144 - packages <- readInterfaceFiles freshNameCache (ifacePairs flags) + packages <- readInterfaceFiles freshNameCache (ifaceTriples flags) hunk ./src/Main.hs 150 -readPackagesAndProcessModules :: [Flag] -> [String] -> IO ([(InterfaceFile, FilePath)], - [Interface], LinkEnv) +readPackagesAndProcessModules :: [Flag] -> [String] + -> IO ([(DocPaths, InterfaceFile)], [Interface], LinkEnv) hunk ./src/Main.hs 164 - packages <- readInterfaceFiles nameCacheFromGhc (ifacePairs flags) + packages <- readInterfaceFiles nameCacheFromGhc (ifaceTriples flags) hunk ./src/Main.hs 167 - let ifaceFiles = map fst packages + let ifaceFiles = map snd packages hunk ./src/Main.hs 173 -renderStep :: [Flag] -> [(InterfaceFile, FilePath)] -> [Interface] -> IO () -renderStep flags packages interfaces = do - updateHTMLXRefs packages - let ifaceFiles = map fst packages - installedIfaces = concatMap ifInstalledIfaces ifaceFiles - render flags interfaces installedIfaces +renderStep :: [Flag] -> [(DocPaths, InterfaceFile)] -> [Interface] -> IO () +renderStep flags pkgs interfaces = do + updateHTMLXRefs pkgs + let + ifaceFiles = map snd pkgs + installedIfaces = concatMap ifInstalledIfaces ifaceFiles + srcMap = Map.fromList [ (ifPackageId if_, x) | ((_, Just x), if_) <- pkgs ] + render flags interfaces installedIfaces srcMap hunk ./src/Main.hs 184 -render :: [Flag] -> [Interface] -> [InstalledInterface] -> IO () -render flags ifaces installedIfaces = do +render :: [Flag] -> [Interface] -> [InstalledInterface] -> SrcMap -> IO () +render flags ifaces installedIfaces srcMap = do hunk ./src/Main.hs 190 - opt_source_urls = optSourceUrls flags hunk ./src/Main.hs 202 - packageMod = ifaceMod (head ifaces) - packageStr = Just (modulePackageString packageMod) - (pkgName,pkgVer) = modulePackageInfo packageMod + pkgMod = ifaceMod (head ifaces) + pkgId = modulePackageId pkgMod + pkgStr = Just (packageIdString pkgId) + (pkgName,pkgVer) = modulePackageInfo pkgMod + + (src_base, src_module, src_entity) = optSourceUrls flags + srcMap' = maybe srcMap (\path -> Map.insert pkgId path srcMap) src_entity + sourceUrls = (src_base, src_module, srcMap') hunk ./src/Main.hs 216 - ppHtmlIndex odir title packageStr - themes opt_contents_url opt_source_urls opt_wiki_urls + ppHtmlIndex odir title pkgStr + themes opt_contents_url sourceUrls opt_wiki_urls hunk ./src/Main.hs 222 - ppHtmlContents odir title packageStr - themes opt_index_url opt_source_urls opt_wiki_urls + ppHtmlContents odir title pkgStr + themes opt_index_url sourceUrls opt_wiki_urls hunk ./src/Main.hs 228 - ppHtml title packageStr visibleIfaces odir + ppHtml title pkgStr visibleIfaces odir hunk ./src/Main.hs 230 - themes opt_source_urls opt_wiki_urls + themes sourceUrls opt_wiki_urls hunk ./src/Main.hs 239 - ppLaTeX title packageStr visibleIfaces odir prologue opt_latex_style + ppLaTeX title pkgStr visibleIfaces odir prologue opt_latex_style hunk ./src/Main.hs 249 - -> [(FilePath, FilePath)] -> - m [(InterfaceFile, FilePath)] + -> [(DocPaths, FilePath)] -> + m [(DocPaths, InterfaceFile)] hunk ./src/Main.hs 256 - tryReadIface (html, iface) = do - eIface <- readInterfaceFile name_cache_accessor iface + tryReadIface (paths, file) = do + eIface <- readInterfaceFile name_cache_accessor file hunk ./src/Main.hs 260 - putStrLn ("Warning: Cannot read " ++ iface ++ ":") + putStrLn ("Warning: Cannot read " ++ file ++ ":") hunk ./src/Main.hs 264 - Right f -> return $ Just (f, html) + Right f -> return $ Just (paths, f) hunk ./src/Main.hs 376 -updateHTMLXRefs :: [(InterfaceFile, FilePath)] -> IO () +updateHTMLXRefs :: [(DocPaths, InterfaceFile)] -> IO () hunk ./src/Main.hs 379 - mapping = [ (instMod iface, html) | (ifaces, html) <- packages + mapping = [ (instMod iface, html) | ((html, _), ifaces) <- packages hunk ./src/Haddock/Options.hs 23 - optSourceUrls, - optWikiUrls, + sourceUrls, + wikiUrls, hunk ./src/Haddock/Options.hs 29 - ifaceTriples + readIfaceArgs hunk ./src/Haddock/Options.hs 199 -optSourceUrls :: [Flag] -> (Maybe String, Maybe String, Maybe String) -optSourceUrls flags = +sourceUrls :: [Flag] -> (Maybe String, Maybe String, Maybe String) +sourceUrls flags = hunk ./src/Haddock/Options.hs 206 -optWikiUrls :: [Flag] -> (Maybe String, Maybe String, Maybe String) -optWikiUrls flags = +wikiUrls :: [Flag] -> (Maybe String, Maybe String, Maybe String) +wikiUrls flags = hunk ./src/Haddock/Options.hs 220 + hunk ./src/Haddock/Options.hs 234 -ifaceTriples :: [Flag] -> [(DocPaths, FilePath)] -ifaceTriples flags = [ parseIfaceOption s | Flag_ReadInterface s <- flags ] +readIfaceArgs :: [Flag] -> [(DocPaths, FilePath)] +readIfaceArgs flags = [ parseIfaceOption s | Flag_ReadInterface s <- flags ] hunk ./src/Main.hs 144 - packages <- readInterfaceFiles freshNameCache (ifaceTriples flags) + packages <- readInterfaceFiles freshNameCache (readIfaceArgs flags) hunk ./src/Main.hs 164 - packages <- readInterfaceFiles nameCacheFromGhc (ifaceTriples flags) + packages <- readInterfaceFiles nameCacheFromGhc (readIfaceArgs flags) hunk ./src/Main.hs 190 - opt_wiki_urls = optWikiUrls flags + opt_wiki_urls = wikiUrls flags hunk ./src/Main.hs 207 - (src_base, src_module, src_entity) = optSourceUrls flags - srcMap' = maybe srcMap (\path -> Map.insert pkgId path srcMap) src_entity - sourceUrls = (src_base, src_module, srcMap') + (srcBase, srcModule, srcEntity) = sourceUrls flags + srcMap' = maybe srcMap (\path -> Map.insert pkgId path srcMap) srcEntity + sourceUrls' = (srcBase, srcModule, srcMap') hunk ./src/Main.hs 217 - themes opt_contents_url sourceUrls opt_wiki_urls + themes opt_contents_url sourceUrls' opt_wiki_urls hunk ./src/Main.hs 223 - themes opt_index_url sourceUrls opt_wiki_urls + themes opt_index_url sourceUrls' opt_wiki_urls hunk ./src/Main.hs 230 - themes sourceUrls opt_wiki_urls + themes sourceUrls' opt_wiki_urls hunk ./html/Classic.theme/xhaddock.css 165 - padding: .25em 0; + padding: .35em 0; hunk ./html/Classic.theme/xhaddock.css 170 -dl.info { +table.info { hunk ./html/Classic.theme/xhaddock.css 174 - width: 50%; + max-width: 50%; hunk ./html/Classic.theme/xhaddock.css 177 -dl.info dt { - float: left; - width: 5em; - font-weight: bold; - display: block; +.info th, .info td { + text-align: left; + padding: 0 10px 0 0; hunk ./html/Classic.theme/xhaddock.css 182 -dl.info dd { - display: block; - padding-left: 6em; -} hunk ./html/Ocean.std-theme/ocean.css 88 -dl.info { +.info { hunk ./html/Ocean.std-theme/ocean.css 212 -dl.info { +table.info { hunk ./html/Ocean.std-theme/ocean.css 220 + border-spacing: 0; hunk ./html/Ocean.std-theme/ocean.css 223 -dl.info dt { - float: left; - font-weight: bold; - display: block; - margin: 0 1em 0 0; -} - -dl.info dd { - display: block; - margin: 0 0 0 6em; +.info th { + padding: 0 1em 0 0; hunk ./src/Haddock/Backends/Xhtml.hs 192 - doOneEntry :: (String, (HaddockModInfo GHC.Name) -> Maybe String) -> Maybe (String, String) - doOneEntry (fieldName, field) = field info >>= \a -> return (fieldName, a) + doOneEntry :: (String, (HaddockModInfo GHC.Name) -> Maybe String) -> Maybe HtmlTable + doOneEntry (fieldName, field) = + field info >>= \a -> return (th << fieldName <-> td << a) hunk ./src/Haddock/Backends/Xhtml.hs 196 - entries :: [(String, String)] + entries :: [HtmlTable] hunk ./src/Haddock/Backends/Xhtml.hs 205 - _ -> defList entries ! [theclass "info"] + _ -> table ! [theclass "info"] << aboves entries hunk ./tests/golden-tests/tests/Test.html.ref 4 -
      Portability
      portable
      Stability
      provisional
      Maintainer
      libraries@haskell.org

      Test

      Contents

      +

      hunk ./tests/golden-tests/tests/Bug4.html.ref 5 -

      +

      hunk ./tests/golden-tests/tests/Bug6.html.ref 12 -

      Constructors

      E Int 
      +

      Constructors

      E Int 
      hunk ./tests/golden-tests/tests/Bug7.html.ref 10 -

      +

      hunk ./tests/golden-tests/tests/Bug8.html.ref 4 -

      Bug8

      Documentation

      data Typ

      Constructors

      Type (String, [Typ]) 
      TFree (String, [String]) 
      +

      Bug8

      Documentation

      data Typ

      Constructors

      Type (String, [Typ]) 
      TFree (String, [String]) 
      hunk ./tests/golden-tests/tests/Bugs.html.ref 4 -

      Bugs

      Documentation

      data A a

      Constructors

      A a (a -> Int) 
      +

      Bugs

      Documentation

      data A a

      Constructors

      A a (a -> Int) 
      hunk ./tests/golden-tests/tests/CrossPackageDocs.html.ref 43 -

      +

      hunk ./tests/golden-tests/tests/Examples.html.ref 22 - + hunk ./tests/golden-tests/tests/FunArgs.html.ref 13 -

      +

      hunk ./tests/golden-tests/tests/GADTRecords.html.ref 7 -

      +

      hunk ./tests/golden-tests/tests/Hash.html.ref 20 -

      Instances

      Hash Float 
      Hash Int 
      (Hash a, Hash b) => Hash (a, b) 
      +

      Instances

      Hash Float 
      Hash Int 
      (Hash a, Hash b) => Hash (a, b) 
      hunk ./tests/golden-tests/tests/NamedDoc.html.ref 5 -

      +

      hunk ./tests/golden-tests/tests/NoLayout.html.ref 5 -

      +

      hunk ./tests/golden-tests/tests/NonGreedy.html.ref 5 -

      +

      hunk ./tests/golden-tests/tests/QuasiExpr.html.ref 4 -

      QuasiExpr

      Documentation

      data BinOp

      Constructors

      AddOp 
      SubOp 
      MulOp 
      DivOp 

      parseExprExp :: String -> Q Exp

      +

      QuasiExpr

      Documentation

      data BinOp

      Constructors

      AddOp 
      SubOp 
      MulOp 
      DivOp 

      parseExprExp :: String -> Q Exp

      hunk ./tests/golden-tests/tests/QuasiQuote.html.ref 4 -

      QuasiQuote

      Documentation

      +

      QuasiQuote

      Documentation

      hunk ./tests/golden-tests/tests/TH.html.ref 4 -

      TH

      Documentation

      decl :: Q [Dec]

      +

      TH

      Documentation

      decl :: Q [Dec]

      hunk ./tests/golden-tests/tests/TH2.html.ref 4 -

      TH2

      +

      TH2

      hunk ./tests/golden-tests/tests/Test.html.ref 148 -

      +

      hunk ./tests/golden-tests/tests/Ticket112.html.ref 5 -

      +

      hunk ./tests/golden-tests/tests/Ticket61.html.ref 5 -

      +

      hunk ./tests/golden-tests/tests/Ticket75.html.ref 5 -

      +

      hunk ./tests/golden-tests/tests/TypeFamilies.html.ref 9 -

      +

      hunk ./tests/golden-tests/tests/TypeOperators.html.ref 6 -

      data a :-: b

      data (a :+: b) c

      data Op a b

      newtype O g f a

      Constructors

      O 

      Fields

      unO :: g (f a)
       

      biO :: (g `O` f) a

      newtype Flip (~>) b a

      Constructors

      Flip 

      Fields

      unFlip :: a ~> b
       
      +

      data a :-: b

      data (a :+: b) c

      data Op a b

      newtype O g f a

      Constructors

      O 

      Fields

      unO :: g (f a)
       

      biO :: (g `O` f) a

      newtype Flip (~>) b a

      Constructors

      Flip 

      Fields

      unFlip :: a ~> b
       
      hunk ./tests/golden-tests/tests/Visible.html.ref 4 -

      Visible

      Documentation

      +

      Visible

      Documentation

      hunk ./doc/haddock.xml 255 - - =option + + dir +
      + + + =dir hunk ./doc/haddock.xml 263 - Pass option to GHC. + Generate files into dir + instead of the current directory. hunk ./doc/haddock.xml 268 - hunk ./doc/haddock.xml 270 - - dir + + dir hunk ./doc/haddock.xml 274 - - =dir + + =dir hunk ./doc/haddock.xml 278 - Generate files into dir - instead of the current directory. + Use Haddock auxiliary files (themes, javascript, etc...) in dir. hunk ./doc/haddock.xml 338 - - - - dir - - - - =dir - - - Use auxiliary files in dir. - - - - - - - - - - - - - - Reserved for future use (output documentation in DocBook XML - format). - - - hunk ./doc/haddock.xml 399 - - - - - - - + + + hunk ./doc/haddock.xml 403 - - (In HTML mode only) Produce extra contents and index - files for given HTML Help system. Currently supported Help - systems are Microsoft HTML Help 1.3 and 2.0 and GNOME DevHelp. - - Using the Microsoft HTML Help system provides two - advantages over plain HTML: the help viewer gives you a nice - hierarchical folding contents pane on the left, and the - documentation files are compressed and therefore much - smaller (roughly a factor of 10). The disadvantage is that - the help can't be viewed over the web. - - In order to create a compiled Microsoft help file, you - also need the Microsoft HTML Help compiler, which is - available free from - http://www.microsoft.com/ - (search for HTML Help compiler). - - Viewers + + Generate documentation in LaTeX format. Several files + will be generated into the current directory (or the + specified directory if the option is + given), including the following: + hunk ./doc/haddock.xml 410 - - Microsoft HTML Help Viewer - Distributed with Microsoft Windows - - - xCHM - a CHM viewer for UNIX (Linux, *BSD, Solaris), written by Razvan Cojocaru + + package.tex + + The top-level LaTeX source file; to format the + documentation into PDF you might run something like + this: + +$ pdflatex package.tex + hunk ./doc/haddock.xml 421 - JouleData Solutions' CHM Viewer - a comercial 100% native Cocoa .chm file viewer for the Mac OS X platform + haddock.sty + + The default style. The file contains + definitions for various macros used in the LaTeX + sources generated by Haddock; to change the way the + formatted output looks, you might want to override + these by specifying your own style with + the option. + hunk ./doc/haddock.xml 432 - GnoCHM - a CHM file viewer. It is designed to integrate nicely with Gnome. + module.tex + + The LaTeX documentation for + each module. + hunk ./doc/haddock.xml 438 - + + +
      hunk ./doc/haddock.xml 442 - The GNOME DevHelp also provides help viewer which looks like - MSHelp viewer but the documentation files aren't compressed. - The documentation can be viewed with any HTML browser but - DevHelp gives you a nice hierarchical folding contents and - keyword index panes on the left. The DevHelp expects to see - *.devhelp file in the folder where the documentation is placed. - The file contains all required information - to build the contents and index panes. - + + + + + + + This option lets you override the default style used + by the LaTeX generated by the option. + Normally Haddock puts a + standard haddock.sty in the output + directory, and includes the + command \usepackage{haddock} in the + LaTeX source. If this option is given, + then haddock.sty is not generated, + and the command is + instead \usepackage{style}. + + + + + + + + + + + + + + + Reserved for future use (output documentation in DocBook XML + format). hunk ./doc/haddock.xml 653 - - - - - - - Generate documentation in LaTeX format. Several files - will be generated into the current directory (or the - specified directory if the option is - given), including the following: - - - - package.tex - - The top-level LaTeX source file; to format the - documentation into PDF you might run something like - this: - -$ pdflatex package.tex - - - - haddock.sty - - The default style. The file contains - definitions for various macros used in the LaTeX - sources generated by Haddock; to change the way the - formatted output looks, you might want to override - these by specifying your own style with - the option. - - - - module.tex - - The LaTeX documentation for - each module. - - - - - - - - - - - - - This option lets you override the default style used - by the LaTeX generated by the option. - Normally Haddock puts a - standard haddock.sty in the output - directory, and includes the - command \usepackage{haddock} in the - LaTeX source. If this option is given, - then haddock.sty is not generated, - and the command is - instead \usepackage{style}. - - - - hunk ./doc/haddock.xml 720 - - + + hunk ./doc/haddock.xml 724 - - + + hunk ./doc/haddock.xml 728 - Increase verbosity. Currently this will cause Haddock - to emit some extra warnings, in particular about modules - which were imported but it had no information about (this is - often quite normal; for example when there is no information - about the Prelude). + Output version information and exit. hunk ./doc/haddock.xml 734 - - + + hunk ./doc/haddock.xml 738 - - + + hunk ./doc/haddock.xml 742 - Output version information and exit. + Increase verbosity. Currently this will cause Haddock + to emit some extra warnings, in particular about modules + which were imported but it had no information about (this is + often quite normal; for example when there is no information + about the Prelude). hunk ./doc/haddock.xml 808 - - - + + + =option hunk ./doc/haddock.xml 813 - If the input modules use Template Haskell, Haddock has to - perform compilation (using GHC). This results in .o, .hi, and stub files that - are written to a temporary directory by default. When this flag is specified, - however, the files are written to the present directory (or another path if you - tell GHC, for example like this: --optghc=-odir --optghc=path). - Note that not only will files be written to this directory, GHC will also look for - already existing files there, and use them in order to skip compilation. - + Pass option to GHC. hunk ./doc/haddock.xml 830 + + + + + + + + If the input modules use Template Haskell, Haddock has to + perform compilation (using GHC). This results in .o, .hi, and stub files that + are written to a temporary directory by default. When this flag is specified, + however, the files are written to the present directory (or another path if you + tell GHC, for example like this: --optghc=-odir --optghc=path). + Note that not only will files be written to this directory, GHC will also look for + already existing files there, and use them in order to skip compilation. + + + hunk ./doc/haddock.xml 354 + module.html + mini_module.html + + An HTML page for each + module, and a "mini" page for + each used when viewing in frames. + + + hunk ./doc/haddock.xml 371 - haddock.css + doc-index.html + doc-index-X.html hunk ./doc/haddock.xml 374 - The stylesheet used by the generated HTML. Feel - free to modify this to change the colors or - layout, or even specify your own stylesheet using the - option. + The alphabetic index, possibly split into multiple + pages if big enough. hunk ./doc/haddock.xml 379 - haddock-util.js + frames.html hunk ./doc/haddock.xml 381 - A small piece of JavaScript for collapsing sections - of the generated HTML. + The top level document when viewing in frames. hunk ./doc/haddock.xml 385 - module.html + some.css + etc... hunk ./doc/haddock.xml 388 - An HTML page for each - module. + Files needed for the themes used. Specify your themes + using the option. hunk ./doc/haddock.xml 393 - doc-index.html - doc-index-XX.html + haddock-util.js hunk ./doc/haddock.xml 395 - The index, split into two - (functions/constructors and types/classes, as per - Haskell namespaces) and further split - alphabetically. + Some JavaScript utilities used to implement some of the + dynamic features like collapsable sections, and switching to + frames view. hunk ./doc/haddock.xml 643 + + + + =path + + + Specify a theme to be used for HTML () + documentation. If given multiple times then the pages will use the + first theme given by default, and have alternate style sheets for + the others. The reader can switch between themes with browsers that + support alternate style sheets, or with the "Style" menu that gets + added when the page is loaded. If + no themes are specified, then just the default built-in theme + ("Ocean") is used. + + + The path parameter can be one of: + + + + + A directory: The base name of + the directory becomes the name of the theme. The directory + must contain exactly one + some.css file. + Other files, usually image files, will be copied, along with + the some.css + file, into the generated output directory. + + + A CSS file: The base name of + the file becomes the name of the theme. + + + The name of a built-in theme + ("Ocean" or "Classic"). + + + + + + + + + + + + Includes the built-in themes ("Ocean" and "Classic"). + Can be combined with . Note that order + matters: The first specified theme will be the default. + + + hunk ./doc/haddock.xml 706 - Specify a CSS stylesheet to use instead of the default one - that comes with Haddock. It should specify certain classes: - see the default stylesheet for details. + Deprecated aliases for hunk ./doc/haddock.xml 809 + + + + hunk ./doc/haddock.xml 818 - Instead, redirect the Index link on each page to + Instead, redirect the Contents and/or Index link on each page to hunk ./doc/haddock.xml 820 - use in conjuction with for - generating a separate index covering multiple + use in conjuction with and/or + for + generating a separate contents and/or index covering multiple hunk ./doc/haddock.xml 829 + + + + hunk ./doc/haddock.xml 837 - Generate an HTML index containing entries pulled from - all the specified interfaces (interfaces are specified using + Generate an HTML contents and/or index containing entries pulled + from all the specified interfaces (interfaces are specified using hunk ./doc/haddock.xml 840 - This is used to generate a single index for multiple sets of - Haddock documentation. + This is used to generate a single contents and/or index for multiple + sets of Haddock documentation. hunk ./ANNOUNCE 46 - * Frames-mode can be turned on/off from the header menu. + * Frames-mode can be enabled from the header menu. hunk ./CHANGES 18 - * Frames-mode can be turned on/off from the header menu. + * Frames-mode can be enabled from the header menu. hunk ./doc/configure.ac 8 -FP_DIR_DOCBOOK_XSL([/usr/share/xml/docbook/stylesheet/nwalsh/current /usr/share/xml/docbook/stylesheet/nwalsh /usr/share/sgml/docbook/docbook-xsl-stylesheets* /usr/share/sgml/docbook/xsl-stylesheets* /opt/kde?/share/apps/ksgmltools2/docbook/xsl /usr/share/docbook-xsl /usr/share/sgml/docbkxsl /usr/local/share/xsl/docbook /sw/share/xml/xsl/docbook-xsl]) +FP_DIR_DOCBOOK_XSL([/usr/share/xml/docbook/stylesheet/nwalsh/current /usr/share/xml/docbook/stylesheet/nwalsh /usr/share/sgml/docbook/docbook-xsl-stylesheets* /usr/share/sgml/docbook/xsl-stylesheets* /opt/kde?/share/apps/ksgmltools2/docbook/xsl /usr/share/docbook-xsl /usr/share/sgml/docbkxsl /usr/local/share/xsl/docbook /sw/share/xml/xsl/docbook-xsl /usr/share/xml/docbook/xsl-stylesheets-*]) hunk ./src/Haddock/Lex.x 20 - LToken, + LToken, hunk ./doc/haddock.xml 1511 - Furthermore, the character sequence ghci> + Furthermore, the character sequence >>> hunk ./doc/haddock.xml 1513 - escape it, just prefix the > character with a + escape it, just prefix the characters in the sequence with a hunk ./doc/haddock.xml 1571 - ghci> followed by an expression followed + >>> followed by an expression followed hunk ./doc/haddock.xml 1577 --- ghci> fib 10 +-- >>> fib 10 hunk ./doc/haddock.xml 1580 --- ghci> putStrLn "foo\nbar" +-- >>> putStrLn "foo\nbar" hunk ./src/Haddock/Backends/Xhtml/DocMarkup.hs 72 - htmlPrompt = (thecode . toHtml $ "ghci> ") ! [theclass "prompt"] + htmlPrompt = (thecode . toHtml $ ">>> ") ! [theclass "prompt"] hunk ./src/Haddock/Lex.x 51 - $ws* ghci \> { strtoken TokExamplePrompt `andBegin` exampleexpr } + $ws* \>\>\> { strtoken TokExamplePrompt `andBegin` exampleexpr } hunk ./src/Haddock/Lex.x 62 - $ws* ghci \> { strtoken TokExamplePrompt `andBegin` exampleexpr } + $ws* \>\>\> { strtoken TokExamplePrompt `andBegin` exampleexpr } hunk ./src/Haddock/Lex.x 77 - $ws* ghci \> { strtoken TokExamplePrompt `andBegin` exampleexpr } + $ws* \>\>\> { strtoken TokExamplePrompt `andBegin` exampleexpr } hunk ./src/Haddock/Types.hs 299 - "ghci> " ++ expression ++ "\n" ++ unlines result + ">>> " ++ expression ++ "\n" ++ unlines result hunk ./tests/golden-tests/tests/Examples.hs 7 --- ghci> fib 5 +-- >>> fib 5 hunk ./tests/golden-tests/tests/Examples.hs 9 --- ghci> fib 10 +-- >>> fib 10 hunk ./tests/golden-tests/tests/Examples.hs 12 --- ghci> fib 10 +-- >>> fib 10 hunk ./tests/golden-tests/tests/Examples.hs 17 --- ghci> fib 5 +-- >>> fib 5 hunk ./tests/golden-tests/tests/Examples.hs 22 --- ghci> fib 5 +-- >>> fib 5 hunk ./tests/golden-tests/tests/Examples.hs 27 --- ghci> import Data.Char --- ghci> isSpace 'a' +-- >>> import Data.Char +-- >>> isSpace 'a' hunk ./tests/golden-tests/tests/Examples.html.ref 6 -

      ghci> fib 5
      +

      >>> fib 5
      hunk ./tests/golden-tests/tests/Examples.html.ref 8
      -ghci> fib 10
      +>>> fib 10
      hunk ./tests/golden-tests/tests/Examples.html.ref 10
      -
      ghci> fib 10
      +
      >>> fib 10
      hunk ./tests/golden-tests/tests/Examples.html.ref 13
      -

      ghci> fib 5
      +

      >>> fib 5
      hunk ./tests/golden-tests/tests/Examples.html.ref 16
      -

      ghci> fib 5
      +

      >>> fib 5
      hunk ./tests/golden-tests/tests/Examples.html.ref 19
      -

      ghci> import Data.Char
      -ghci> isSpace 'a'
      +

      >>> import Data.Char
      +>>> isSpace 'a'
      hunk ./doc/haddock.xml 903
      -          If the input modules use Template Haskell, Haddock has to
      -          perform compilation (using GHC).  This results in .o, .hi, and stub files that
      -          are written to a temporary directory by default. When this flag is specified,
      -          however, the files are written to the present directory (or another path if you
      -          tell GHC, for example like this: --optghc=-odir --optghc=path).
      -          Note that not only will files be written to this directory, GHC will also look for
      -          already existing files there, and use them in order to skip compilation.
      +          
      +          Do not use a temporary directory for reading and writing compilation output files
      +          (.o, .hi, and stub files). Instead, use the
      +          present directory or another directory that you have explicitly told GHC to use
      +          via the --optghc flag.
      +          
      +          
      +          This flag can be used to avoid recompilation if compilation files already exist.
      +          Compilation files are produced when Haddock has to process modules that make use of
      +          Template Haskell, in which case Haddock compiles the modules using the GHC API.  
      hunk ./doc/haddock.xml 165
      +      Contributors
      +      Haddock was originally written by Simon Marlow. Since it is an open source
      +      project, many people have contributed to its development over the years.
      +      Below is a list of contributors in alphabetical order that we hope is
      +      somewhat complete. If you think you are missing from this list, please contact
      +      us.
      +      
      +      
      +	Ashley Yakeley
      +	Benjamin Franksen
      +	Brett Letner
      +        Clemens Fruhwirth
      +        Conal Elliott
      +        David Waern 
      +        Duncan Coutts
      +        George Pollard
      +        George Russel
      +        Hal Daume
      +        Ian Lynagh
      +        Isaac Dupree
      +        Joachim Breitner
      +        Krasimir Angelov
      +        Lennart Augustsson
      +        Luke Plant
      +        Malcolm Wallace
      +        Mark Lentczner
      +        Mark Shields
      +        Neil Mitchell
      +        Mike Thomas
      +        Manuel Chakravarty
      +        Oliver Brown
      +        Roman Cheplyaka
      +        Ross Paterson
      +        Simon Hengel
      +        Simon Marlow
      +        Simon Peyton-Jones
      +        Sigbjorn Finne
      +        Stefan O'Rear
      +        Sven Panne
      +        Thomas Schilling
      +        Wolfgang Jeltsch
      +        Yitzchak Gale
      +      
      +    
      +    
      hunk ./doc/haddock.xml 233 - Thanks to the following people for useful feedback, - discussion, patches, packaging, and moral support: Simon Peyton - Jones, Mark Shields, Manuel Chakravarty, Ross Patterson, Brett - Letner, Sven Panne, Hal Daume, George Russell, Oliver Braun, - Ashley Yakeley, Malcolm Wallace, Krasimir Angelov, the members - of haskelldoc@haskell.org, and everyone who + Thanks to the the members + of haskelldoc@haskell.org, + haddock@projects.haskell.org and everyone who hunk ./LICENSE 1 -Copyright 2002, Simon Marlow. All rights reserved. +Copyright 2002-2010, Simon Marlow. All rights reserved. hunk ./doc/haddock.xml 128 - Copyright 2002, Simon Marlow. All rights reserved. + Copyright 2002-2010, Simon Marlow. All rights reserved. hunk ./make-sdist.sh 30 -# - scp haddock-doc-html-${version}.tar.gz haskell.org:haddock/doc +# - scp haddock-doc-html-${version}.tar.gz www.haskell.org:../haskell/haddock/doc hunk ./ANNOUNCE 27 +This version is compatible with .haddock files produced by Haddock 2.6.1 and +above, provided that the version of GHC used to build Haddock stays the same. + hunk ./src/Haddock/Utils.hs 1 +{-# LANGUAGE ForeignFunctionInterface #-}