Skip to content

Commit

Permalink
Fix avh4#454, Remove (..) form types in @docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mdevlamynck committed Oct 7, 2018
1 parent 188d397 commit faee36d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
13 changes: 12 additions & 1 deletion src/ElmFormat/Render/Box.hs
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,18 @@ formatModuleDocs elmVersion importInfo blocks =

content :: String
content =
ElmFormat.Render.Markdown.formatMarkdown (fmap format . parse) blocks
ElmFormat.Render.Markdown.formatMarkdown (fmap format . parse) $ fmap cleanBlock blocks

cleanBlock :: Markdown.Block -> Markdown.Block
cleanBlock block =
case block of
Markdown.ElmDocs docs ->
Markdown.ElmDocs $
(fmap . fmap)
(Text.replace (Text.pack "(..)") (Text.pack ""))
docs
_ ->
block
in
formatDocComment content

Expand Down
3 changes: 2 additions & 1 deletion tests/test-files/transform/DocCommentAtDocs.elm
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
module DocCommentAtDocs exposing (x, y, z)
module DocCommentAtDocs exposing (x, y, z, T(..))

{-|
@docs
x,
y,
z
@docs T(..)
@docs a , b , c
@docs d
Expand Down
2 changes: 2 additions & 0 deletions tests/test-files/transform/DocCommentAtDocs.formatted.elm
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ module DocCommentAtDocs exposing
( x
, y
, z
, T(..)
)

{-|
@docs x
@docs y
@docs z
@docs T
@docs a, b, c
@docs d
Expand Down

0 comments on commit faee36d

Please sign in to comment.