@@ -11,6 +11,7 @@ module Language.PureScript.Docs.Convert.Single
12import Prelude ()
12import Prelude ()
13import Prelude.Compat
13import Prelude.Compat
14+import Data.Maybe (catMaybes)
15import Control.Monad
16import Control.Monad
16import Control.Category ((>>>))
17import Control.Category ((>>>))
@@ -200,21 +201,22 @@ convertDeclaration _ _ = Nothing
200convertComments :: [P.Comment] -> Maybe String
201convertComments :: [P.Comment] -> Maybe String
201convertComments cs = do
202convertComments cs = do
202 let raw = concatMap toLines cs
203 let raw = concatMap toLines cs
204+ let docs = catMaybes (map stripPipe raw)
203− guard (all hasPipe raw && not (null raw))
205+ guard (not (null docs))
204− return (go raw)
206+ pure (unlines docs)
206− go = unlines . map stripPipes
208 toLines (P.LineComment s) = [s]
209 toLines (P.LineComment s) = [s]
209 toLines (P.BlockComment s) = lines s
210 toLines (P.BlockComment s) = lines s
211− hasPipe s = case dropWhile (== ' ') s of { ('|':_) -> True; _ -> False }
213+ case dropWhile (== ' ') s' of
213− stripPipes = dropPipe . dropWhile (== ' ')
215+ Just s
215− dropPipe ('|':' ':s) = s
217+ Just s
216− dropPipe ('|':s) = s
218+ _ ->
217− dropPipe s = s
219+ Nothing
219-- | Go through a PureScript module and extract a list of Bookmarks; references
221-- | Go through a PureScript module and extract a list of Bookmarks; references
220-- to data types or values, to be used as a kind of index. These are used for
222-- to data types or values, to be used as a kind of index. These are used for