Require haddock-library >= 1.1 and simplify haddock reader code.

See #1346.
This commit is contained in:
John MacFarlane 2014-06-26 12:34:41 -07:00
parent 9f694619cd
commit b2127311cb
2 changed files with 2 additions and 40 deletions

View file

@ -259,7 +259,7 @@ Library
hslua >= 0.3 && < 0.4,
binary >= 0.5 && < 0.8,
SHA >= 1.6 && < 1.7,
haddock-library >= 1.0 && < 1.1
haddock-library >= 1.1 && < 1.2
if flag(https)
Build-Depends: http-client >= 0.3.2 && < 0.4,
http-client-tls >= 0.2 && < 0.3,

View file

@ -43,11 +43,8 @@ docHToBlocks d' =
(docHToInlines False $ headerTitle h)
DocAppend d1 d2 -> mappend (docHToBlocks d1) (docHToBlocks d2)
DocString _ -> inlineFallback
DocParagraph (DocHeader h) -> docHToBlocks (DocHeader h)
DocParagraph (DocAName h) -> B.plain $ docHToInlines False $ DocAName h
DocParagraph x -> let (ils, rest) = getInlines x
in (B.para $ docHToInlines False ils)
<> docHToBlocks rest
DocParagraph x -> B.para $ docHToInlines False x
DocIdentifier _ -> inlineFallback
DocIdentifierUnchecked _ -> inlineFallback
DocModule s -> B.plain $ docHToInlines False $ DocModule s
@ -115,40 +112,6 @@ docHToInlines isCode d' =
DocProperty _ -> mempty
DocExamples _ -> mempty
getInlines :: DocH String Identifier -> (DocH String Identifier, DocH String Identifier)
getInlines (DocAppend x y) = if isInline x
then let (a, b) = getInlines y
in (DocAppend x a, b)
else (DocEmpty, DocAppend x y)
getInlines x = if isInline x
then (x, DocEmpty)
else (DocEmpty, x)
isInline :: DocH String Identifier -> Bool
isInline d' =
case d' of
DocEmpty -> True
DocAppend d1 _ -> isInline d1
DocString _ -> True
DocParagraph _ -> False
DocIdentifier _ -> True
DocIdentifierUnchecked _ -> True
DocModule _ -> True
DocWarning _ -> True
DocEmphasis _ -> True
DocMonospaced _ -> True
DocBold _ -> True
DocHeader _ -> False
DocUnorderedList _ -> False
DocOrderedList _ -> False
DocDefList _ -> False
DocCodeBlock _ -> False
DocHyperlink _ -> True
DocPic _ -> True
DocAName _ -> True
DocProperty _ -> False
DocExamples _ -> False
-- | Create an 'Example', stripping superfluous characters as appropriate
makeExample :: String -> String -> [String] -> Blocks
makeExample prompt expression result =
@ -173,4 +136,3 @@ makeExample prompt expression result =
substituteBlankLine "<BLANKLINE>" = ""
substituteBlankLine line = line
coder = B.codeWith ([], ["result"], [])