removed Servant.Docs.printMarkdown

This commit is contained in:
Sönke Hahn 2014-11-14 19:54:38 +08:00
parent 49c301d26e
commit 102c752268
2 changed files with 9 additions and 12 deletions

View file

@ -102,4 +102,4 @@ main = do
print =<< runEitherT (deleteGreet "blah" uri) print =<< runEitherT (deleteGreet "blah" uri)
killThread tid killThread tid
putStrLn "\n---------\n" putStrLn "\n---------\n"
printMarkdown docsGreet putStrLn $ markdown docsGreet

View file

@ -16,13 +16,13 @@
-- --
-- @docs :: 'HasDocs' api => 'Proxy' api -> 'API'@ -- @docs :: 'HasDocs' api => 'Proxy' api -> 'API'@
-- --
-- You can then call 'printMarkdown' on it: -- You can then call 'markdown' on it:
-- --
-- @printMarkdown :: 'API' -> IO ()@ -- @printMarkdown :: 'API' -> String@
-- --
-- or define a custom pretty printer: -- or define a custom pretty printer:
-- --
-- @yourPrettyDocs :: 'API' -> IO () -- or blaze-html's HTML, or ...@ -- @yourPrettyDocs :: 'API' -> String -- or blaze-html's HTML, or ...@
-- --
-- The only thing you'll need to do will be to implement some classes -- The only thing you'll need to do will be to implement some classes
-- for your captures, get parameters and request or response bodies. -- for your captures, get parameters and request or response bodies.
@ -70,7 +70,7 @@
-- > toCapture _ = DocCapture "greetid" "identifier of the greet msg to remove" -- > toCapture _ = DocCapture "greetid" "identifier of the greet msg to remove"
-- > -- >
-- > -- API specification -- > -- API specification
-- > type TestApi = -- > type TestApi =
-- > "hello" :> Capture "name" Text :> QueryParam "capital" Bool :> Get Greet -- > "hello" :> Capture "name" Text :> QueryParam "capital" Bool :> Get Greet
-- > :<|> "greet" :> RQBody Greet :> Post Greet -- > :<|> "greet" :> RQBody Greet :> Post Greet
-- > :<|> "delete" :> Capture "greetid" Text :> Delete -- > :<|> "delete" :> Capture "greetid" Text :> Delete
@ -83,10 +83,10 @@
-- > greetDocs = docs testApi -- > greetDocs = docs testApi
-- > -- >
-- > main :: IO () -- > main :: IO ()
-- > main = printMarkdown greetDocs -- > main = putStrLn $ markdown greetDocs
module Servant.Docs module Servant.Docs
( -- * 'HasDocs' class and key functions ( -- * 'HasDocs' class and key functions
HasDocs(..), docs, markdown, printMarkdown HasDocs(..), docs, markdown
, -- * Classes you need to implement for your types , -- * Classes you need to implement for your types
ToSample(..) ToSample(..)
@ -355,11 +355,8 @@ class ToParam t where
class ToCapture c where class ToCapture c where
toCapture :: Proxy c -> DocCapture toCapture :: Proxy c -> DocCapture
-- | Print documentation in Markdown format for -- | Generate documentation in Markdown format for
-- the given 'API', on standard output. -- the given 'API'.
printMarkdown :: API -> IO ()
printMarkdown = print . markdown
markdown :: API -> String markdown :: API -> String
markdown = unlines . concat . map (uncurry printEndpoint) . HM.toList markdown = unlines . concat . map (uncurry printEndpoint) . HM.toList