on master help sign in
Use style stripper from Text.PrettyPrint.ANSI.Leijen
commit2d92f01a42065d3ee42fc47344c93d8bf19cd001 authorEvan Czaplicki <info@elm-lang.org> dateFri 27 May 2016, 15:57 (10 years ago) parent05ce906
1 file changed+3−25
src/Reporting/Report.hs+3−25
src/Reporting/Report.hs+3−25
@@ -13,8 +13,8 @@ import Data.Aeson ((.=))
1313import qualified Data.Aeson.Types as Json
1414import System.IO (Handle)
1515import Text.PrettyPrint.ANSI.Leijen
16− ( Doc, SimpleDoc(..), (<>), displayS, displayIO, dullcyan, fillSep
17− , hardline, renderPretty, text
16+ ( Doc, (<>), displayS, displayIO, dullcyan, fillSep
17+ , hardline, plain, renderPretty, text
1818 )
1919
2020import qualified Reporting.Region as R
@@ -102,27 +102,5 @@ toString location region rprt source =
102102
103103nonAnsiRender :: Doc -> String
104104nonAnsiRender doc =
105− displayS (stripAnsi (renderPretty 1 80 doc)) ""
106−
107−
108−stripAnsi :: SimpleDoc -> SimpleDoc
109−stripAnsi simpleDoc =
110− case simpleDoc of
111− SFail ->
112− SFail
113−
114− SEmpty ->
115− SEmpty
116−
117− SChar chr subDoc ->
118− SChar chr (stripAnsi subDoc)
119−
120− SText n str subDoc ->
121− SText n str (stripAnsi subDoc)
122−
123− SLine n subDoc ->
124− SLine n (stripAnsi subDoc)
125−
126− SSGR _ subDoc ->
127− stripAnsi subDoc
105+ displayS (renderPretty 1 80 (plain doc)) ""
128106