@@ -13,7 +13,8 @@ import Data.Aeson ((.=))
13import qualified Data.Aeson.Types as Json
13import qualified Data.Aeson.Types as Json
14import System.IO (Handle)
14import System.IO (Handle)
15import Text.PrettyPrint.ANSI.Leijen
15import Text.PrettyPrint.ANSI.Leijen
16− ( Doc, (<>), displayS, displayIO, dullcyan, fillSep, hardline, renderPretty, text
16+ ( Doc, SimpleDoc(..), (<>), displayS, displayIO, dullcyan, fillSep
17+ , hardline, renderPretty, text
19import qualified Reporting.Region as R
20import qualified Reporting.Region as R
@@ -83,15 +84,38 @@ messageBar tag location =
83-- RENDER DOCS
84-- RENDER DOCS
87+toHandle :: Handle -> String -> R.Region -> Report -> String -> IO ()
88+toHandle handle location region rprt source =
91+ (renderPretty 1 80 (toDoc location region rprt source))
86toString :: String -> R.Region -> Report -> String -> String
94toString :: String -> R.Region -> Report -> String -> String
87toString location region rprt source =
95toString location region rprt source =
89− (renderPretty 1 80 (toDoc location region rprt source))
97+ (stripAnsi (renderPretty 1 80 (toDoc location region rprt source)))
93−toHandle :: Handle -> String -> R.Region -> Report -> String -> IO ()
101+stripAnsi :: SimpleDoc -> SimpleDoc
94−toHandle handle location region rprt source =
102+stripAnsi simpleDoc =
95− displayIO
103+ case simpleDoc of
97− (renderPretty 1 80 (toDoc location region rprt source))
105+ SFail
111+ SChar chr (stripAnsi subDoc)
113+ SText n str subDoc ->
114+ SText n str (stripAnsi subDoc)
117+ SLine n (stripAnsi subDoc)