From 1ec6a19223a2466075fd4dadd7428d01475f5d77 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 9 Mar 2017 10:30:57 +0100 Subject: Changed display format for messages. --- src/Text/Pandoc/Class.hs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/Class.hs b/src/Text/Pandoc/Class.hs index c45249257..1afa64c10 100644 --- a/src/Text/Pandoc/Class.hs +++ b/src/Text/Pandoc/Class.hs @@ -77,6 +77,7 @@ import Text.Pandoc.Logging import Text.Parsec (ParsecT) import qualified Text.Pandoc.Compat.Time as IO (getCurrentTime) import Text.Pandoc.MIME (MimeType, getMimeType) +import Data.Char (toLower) import Data.Time.Clock.POSIX ( utcTimeToPOSIXSeconds , posixSecondsToUTCTime , POSIXTime ) @@ -106,7 +107,6 @@ import System.IO.Error import System.IO (stderr) import qualified Data.Map as M import Text.Pandoc.Error -import Text.Printf (printf) class (Functor m, Applicative m, Monad m, MonadError PandocError m) => PandocMonad m where @@ -251,17 +251,17 @@ instance PandocMonad PandocIO where getCommonState = PandocIO $ lift get putCommonState x = PandocIO $ lift $ put x logOutput msg = liftIO $ do - UTF8.hPutStr stderr $ printf "%-7s " (show (messageVerbosity msg)) - hangingIndent 2 $ lines $ showLogMessage msg + UTF8.hPutStr stderr $ "[" ++ + (map toLower $ show (messageVerbosity msg)) ++ "] " + alertIndent $ lines $ showLogMessage msg -hangingIndent :: Int -> [String] -> IO () -hangingIndent _level [] = return () -hangingIndent level (l:ls) = do +alertIndent :: [String] -> IO () +alertIndent [] = return () +alertIndent (l:ls) = do UTF8.hPutStrLn stderr l mapM_ go ls - where go l' = do UTF8.hPutStr stderr ind + where go l' = do UTF8.hPutStr stderr "! " UTF8.hPutStrLn stderr l' - ind = replicate level ' ' -- | Specialized version of parseURIReference that disallows -- single-letter schemes. Reason: these are usually windows absolute -- cgit v1.2.3