git.iko.soy/typeable/pandoc
on master help sign in
Add CircularReference constructor to LogMessage.
commitebe4072bd9f1b76e4cc9abe7ae654cb0130fd775 authorJohn MacFarlane <jgm@berkeley.edu> dateWed 15 Feb 2017, 17:35 (10 years ago) parent93f0a9c
1 file changed+10
src/Text/Pandoc/Logging.hs+10
src/Text/Pandoc/Logging.hs+10
@@ -61,6 +61,7 @@ data LogMessage =
6161 | DuplicateLinkReference String SourcePos
6262 | DuplicateNoteReference String SourcePos
6363 | ReferenceNotFound String SourcePos
64+ | CircularReference String SourcePos
6465 | ParsingUnescaped String SourcePos
6566 | CouldNotLoadIncludeFile String SourcePos
6667 | ParsingTrace String SourcePos
@@ -106,6 +107,12 @@ instance ToJSON LogMessage where
106107 "source" .= Text.pack (sourceName pos),
107108 "line" .= toJSON (sourceLine pos),
108109 "column" .= toJSON (sourceColumn pos)]
110+ CircularReference s pos ->
111+ ["type" .= String "CircularReference",
112+ "contents" .= Text.pack s,
113+ "source" .= Text.pack (sourceName pos),
114+ "line" .= toJSON (sourceLine pos),
115+ "column" .= toJSON (sourceColumn pos)]
109116 ParsingUnescaped s pos ->
110117 ["type" .= String "ParsingUnescaped",
111118 "contents" .= Text.pack s,
@@ -176,6 +183,8 @@ showLogMessage msg =
176183 "Duplicate note reference '" ++ s ++ "' at " ++ showPos pos
177184 ReferenceNotFound s pos ->
178185 "Reference not found for '" ++ s ++ "' at " ++ showPos pos
186+ CircularReference s pos ->
187+ "Circular reference '" ++ s ++ "' at " ++ showPos pos
179188 ParsingUnescaped s pos ->
180189 "Parsing unescaped '" ++ s ++ "' at " ++ showPos pos
181190 CouldNotLoadIncludeFile fp pos ->
@@ -208,6 +217,7 @@ messageVerbosity msg =
208217 DuplicateLinkReference{} -> WARNING
209218 DuplicateNoteReference{} -> WARNING
210219 ReferenceNotFound{} -> WARNING
220+ CircularReference{} -> WARNING
211221 CouldNotLoadIncludeFile{} -> WARNING
212222 ParsingUnescaped{} -> INFO
213223 ParsingTrace{} -> DEBUG