From ebe4072bd9f1b76e4cc9abe7ae654cb0130fd775 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 15 Feb 2017 17:35:29 +0100 Subject: Add CircularReference constructor to LogMessage. --- src/Text/Pandoc/Logging.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/Logging.hs b/src/Text/Pandoc/Logging.hs index 65ba9783a..1f98d019e 100644 --- a/src/Text/Pandoc/Logging.hs +++ b/src/Text/Pandoc/Logging.hs @@ -61,6 +61,7 @@ data LogMessage = | DuplicateLinkReference String SourcePos | DuplicateNoteReference String SourcePos | ReferenceNotFound String SourcePos + | CircularReference String SourcePos | ParsingUnescaped String SourcePos | CouldNotLoadIncludeFile String SourcePos | ParsingTrace String SourcePos @@ -106,6 +107,12 @@ instance ToJSON LogMessage where "source" .= Text.pack (sourceName pos), "line" .= toJSON (sourceLine pos), "column" .= toJSON (sourceColumn pos)] + CircularReference s pos -> + ["type" .= String "CircularReference", + "contents" .= Text.pack s, + "source" .= Text.pack (sourceName pos), + "line" .= toJSON (sourceLine pos), + "column" .= toJSON (sourceColumn pos)] ParsingUnescaped s pos -> ["type" .= String "ParsingUnescaped", "contents" .= Text.pack s, @@ -176,6 +183,8 @@ showLogMessage msg = "Duplicate note reference '" ++ s ++ "' at " ++ showPos pos ReferenceNotFound s pos -> "Reference not found for '" ++ s ++ "' at " ++ showPos pos + CircularReference s pos -> + "Circular reference '" ++ s ++ "' at " ++ showPos pos ParsingUnescaped s pos -> "Parsing unescaped '" ++ s ++ "' at " ++ showPos pos CouldNotLoadIncludeFile fp pos -> @@ -208,6 +217,7 @@ messageVerbosity msg = DuplicateLinkReference{} -> WARNING DuplicateNoteReference{} -> WARNING ReferenceNotFound{} -> WARNING + CircularReference{} -> WARNING CouldNotLoadIncludeFile{} -> WARNING ParsingUnescaped{} -> INFO ParsingTrace{} -> DEBUG -- cgit v1.2.3