Logging: added MacroAlreadyDefined.

This commit is contained in:
John MacFarlane 2017-07-03 12:36:12 +02:00
parent 8300b3fbda
commit 1dd769e558

View file

@ -77,6 +77,7 @@ data LogMessage =
| CircularReference String SourcePos | CircularReference String SourcePos
| ParsingUnescaped String SourcePos | ParsingUnescaped String SourcePos
| CouldNotLoadIncludeFile String SourcePos | CouldNotLoadIncludeFile String SourcePos
| MacroAlreadyDefined String SourcePos
| InlineNotRendered Inline | InlineNotRendered Inline
| BlockNotRendered Block | BlockNotRendered Block
| DocxParserWarning String | DocxParserWarning String
@ -150,6 +151,11 @@ instance ToJSON LogMessage where
"source" .= Text.pack (sourceName pos), "source" .= Text.pack (sourceName pos),
"line" .= toJSON (sourceLine pos), "line" .= toJSON (sourceLine pos),
"column" .= toJSON (sourceColumn pos)] "column" .= toJSON (sourceColumn pos)]
MacroAlreadyDefined name pos ->
["name" .= Text.pack name,
"source" .= Text.pack (sourceName pos),
"line" .= toJSON (sourceLine pos),
"column" .= toJSON (sourceColumn pos)]
InlineNotRendered il -> InlineNotRendered il ->
["contents" .= toJSON il] ["contents" .= toJSON il]
BlockNotRendered bl -> BlockNotRendered bl ->
@ -224,6 +230,8 @@ showLogMessage msg =
"Parsing unescaped '" ++ s ++ "' at " ++ showPos pos "Parsing unescaped '" ++ s ++ "' at " ++ showPos pos
CouldNotLoadIncludeFile fp pos -> CouldNotLoadIncludeFile fp pos ->
"Could not load include file '" ++ fp ++ "' at " ++ showPos pos "Could not load include file '" ++ fp ++ "' at " ++ showPos pos
MacroAlreadyDefined name pos ->
"Macro '" ++ name ++ "' already defined, ignoring at " ++ showPos pos
InlineNotRendered il -> InlineNotRendered il ->
"Not rendering " ++ show il "Not rendering " ++ show il
BlockNotRendered bl -> BlockNotRendered bl ->
@ -277,6 +285,7 @@ messageVerbosity msg =
ReferenceNotFound{} -> WARNING ReferenceNotFound{} -> WARNING
CircularReference{} -> WARNING CircularReference{} -> WARNING
CouldNotLoadIncludeFile{} -> WARNING CouldNotLoadIncludeFile{} -> WARNING
MacroAlreadyDefined{} -> WARNING
ParsingUnescaped{} -> INFO ParsingUnescaped{} -> INFO
InlineNotRendered{} -> INFO InlineNotRendered{} -> INFO
BlockNotRendered{} -> INFO BlockNotRendered{} -> INFO