From 52cfeae248ec52e4214ebe6d11ee7f250f8aa852 Mon Sep 17 00:00:00 2001 From: Matthias Devlamynck Date: Sun, 7 Oct 2018 16:02:19 +0200 Subject: [PATCH] Fix #454, Remove (..) from types in @docs --- src/ElmFormat/Render/Box.hs | 13 ++++++++++++- tests/test-files/transform/DocCommentAtDocs.elm | 3 ++- .../transform/DocCommentAtDocs.formatted.elm | 2 ++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/ElmFormat/Render/Box.hs b/src/ElmFormat/Render/Box.hs index e1d59fc45..927a432b5 100644 --- a/src/ElmFormat/Render/Box.hs +++ b/src/ElmFormat/Render/Box.hs @@ -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 diff --git a/tests/test-files/transform/DocCommentAtDocs.elm b/tests/test-files/transform/DocCommentAtDocs.elm index e7e61bef5..424405c55 100644 --- a/tests/test-files/transform/DocCommentAtDocs.elm +++ b/tests/test-files/transform/DocCommentAtDocs.elm @@ -1,4 +1,4 @@ -module DocCommentAtDocs exposing (x, y, z) +module DocCommentAtDocs exposing (x, y, z, T(..)) {-| @@ -6,6 +6,7 @@ module DocCommentAtDocs exposing (x, y, z) x, y, z +@docs T(..) @docs a , b , c @docs d diff --git a/tests/test-files/transform/DocCommentAtDocs.formatted.elm b/tests/test-files/transform/DocCommentAtDocs.formatted.elm index dc23cf063..3a8c15471 100644 --- a/tests/test-files/transform/DocCommentAtDocs.formatted.elm +++ b/tests/test-files/transform/DocCommentAtDocs.formatted.elm @@ -2,6 +2,7 @@ module DocCommentAtDocs exposing ( x , y , z + , T(..) ) {-| @@ -9,6 +10,7 @@ module DocCommentAtDocs exposing @docs x @docs y @docs z +@docs T @docs a, b, c @docs d