More pleasing presentation of warnings and info messages.

!! warning
-- info
This commit is contained in:
John MacFarlane 2017-10-23 15:00:11 -07:00
parent a27dc79073
commit 1a82ecbb68
4 changed files with 10 additions and 9 deletions

View file

@ -111,7 +111,6 @@ import Text.Parsec (ParsecT, getPosition, sourceLine, sourceName)
import qualified Text.Pandoc.Compat.Time as IO (getCurrentTime)
import Text.Pandoc.MIME (MimeType, getMimeType, extensionFromMimeType)
import Text.Pandoc.Definition
import Data.Char (toLower)
import Data.Digest.Pure.SHA (sha1, showDigest)
import Data.Maybe (fromMaybe)
import Data.Time.Clock.POSIX ( utcTimeToPOSIXSeconds
@ -513,8 +512,10 @@ instance PandocMonad PandocIO where
getCommonState = PandocIO $ lift get
putCommonState x = PandocIO $ lift $ put x
logOutput msg = liftIO $ do
UTF8.hPutStr stderr $ "[" ++
map toLower (show (messageVerbosity msg)) ++ "] "
UTF8.hPutStr stderr $
case messageVerbosity msg of
WARNING -> "!! "
_ -> ".. "
alertIndent $ lines $ showLogMessage msg
alertIndent :: [String] -> IO ()
@ -522,7 +523,7 @@ alertIndent [] = return ()
alertIndent (l:ls) = do
UTF8.hPutStrLn stderr l
mapM_ go ls
where go l' = do UTF8.hPutStr stderr "! "
where go l' = do UTF8.hPutStr stderr " "
UTF8.hPutStrLn stderr l'
-- | Specialized version of parseURIReference that disallows

View file

@ -6,6 +6,6 @@ Note[^1].
[^2]: the second, unused, note.
^D
[warning] Note with key '2' defined at line 5 column 1 but not used.
!! Note with key '2' defined at line 5 column 1 but not used.
[Para [Str "Note",Note [Para [Str "the",Space,Str "first",Space,Str "note."]],Str "."]]
```

View file

@ -36,7 +36,7 @@ Loop detection:
__ link1_
^D
[warning] Circular reference 'link1' at line 1 column 15
!! Circular reference 'link1' at line 1 column 15
<p><a href="">click here</a></p>
```

View file

@ -2,7 +2,7 @@
% pandoc -f latex -t icml
\includegraphics{command/corrupt.svg}
^D
[warning] Could not determine image size for 'command/corrupt.svg': could not determine image type
!! Could not determine image size for 'command/corrupt.svg': could not determine image type
<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
<CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
<Rectangle Self="uec" StrokeWeight="0" ItemTransform="1 0 0 1 150 -100">
@ -35,7 +35,7 @@
% pandoc -f latex -t icml
\includegraphics{command/SVG_logo.svg}
^D
[warning] Could not determine image size for 'command/SVG_logo.svg': could not determine SVG size
!! Could not determine image size for 'command/SVG_logo.svg': could not determine SVG size
<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
<CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
<Rectangle Self="uec" StrokeWeight="0" ItemTransform="1 0 0 1 150 -100">
@ -68,7 +68,7 @@
% pandoc -f latex -t icml
\includegraphics{command/SVG_logo-without-xml-declaration.svg}
^D
[warning] Could not determine image size for 'command/SVG_logo-without-xml-declaration.svg': could not determine SVG size
!! Could not determine image size for 'command/SVG_logo-without-xml-declaration.svg': could not determine SVG size
<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
<CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
<Rectangle Self="uec" StrokeWeight="0" ItemTransform="1 0 0 1 150 -100">