packages feed

hdocs 0.4.0.2 → 0.4.0.3

raw patch · 2 files changed

+8/−2 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

hdocs.cabal view
@@ -1,5 +1,5 @@ name:                hdocs
-version:             0.4.0.2
+version:             0.4.0.3
 synopsis:            Haskell docs tool
 description:
   Tool and library to get docs for installed packages and source files.
src/HDocs/Base.hs view
@@ -6,6 +6,7 @@ 
 import Data.Char (isSpace)
 import Data.Map (Map)
+import Data.Foldable (foldMap)
 import qualified Data.Map as M
 
 import Documentation.Haddock
@@ -45,6 +46,7 @@ -- | Format documentation to plain text.
 formatDoc :: Doc String -> String
 formatDoc = trim . go where
+	go :: Doc String -> String
 	go DocEmpty = ""
 	go (DocAppend a b) = go a ++ go b
 	go (DocString str) = trimSpaces str
@@ -52,8 +54,10 @@ 	go (DocIdentifier i) = i
 	go (DocIdentifierUnchecked (mname, occname)) = moduleNameString mname ++ "." ++ occNameString occname
 	go (DocModule m) = m
+	go (DocWarning w) = go w
 	go (DocEmphasis e) = "*" ++ go e ++ "*"
 	go (DocMonospaced e) = "`" ++ go e ++ "`"
+	go (DocBold b) = "*" ++ go b ++ "*"
 	go (DocUnorderedList i) = unlines (map (("* " ++) . go) i)
 	go (DocOrderedList i) = unlines (zipWith (\i' x -> show i' ++ ". " ++ go x) ([1..] :: [Integer]) i)
 	go (DocDefList xs) = unlines (map (\(i,x) -> go i ++ ". " ++ go x) xs)
@@ -61,10 +65,12 @@ 	go (DocHyperlink (Hyperlink url label)) = maybe url (\l -> l ++ "[" ++ url ++ "]") label
 	go (DocPic pic) = show pic
 	go (DocAName name) = name
+	go (DocProperty prop) = prop
 	go (DocExamples exs) = unlines (map formatExample exs)
+	go (DocHeader h) = foldMap go h
 
 	formatExample :: Example -> String
-	formatExample (Example expr result) = "    > " ++ expr ++ unlines (map ("    " ++) result)
+	formatExample (Example expr result) = ">>> " ++ expr ++ "\n" ++ unlines result
 
 	trimSpaces [] = []
 	trimSpaces [s] = [s]