From d577552850f46afe056ed4a7a2bf3a1a62ade9af Mon Sep 17 00:00:00 2001 From: John MacFarlane <jgm@berkeley.edu> Date: Sun, 9 Jun 2019 11:50:26 -0700 Subject: [PATCH] Logging: Added IgnoredElement constructor for LogMessage. SkippedContent doesn't work for some of the XML-based readers, which don't have access to source positions. --- src/Text/Pandoc/Logging.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Text/Pandoc/Logging.hs b/src/Text/Pandoc/Logging.hs index 2fb648b12..188702367 100644 --- a/src/Text/Pandoc/Logging.hs +++ b/src/Text/Pandoc/Logging.hs @@ -54,6 +54,7 @@ instance FromJSON Verbosity where data LogMessage = SkippedContent String SourcePos + | IgnoredElement String | CouldNotParseYamlMetadata String SourcePos | DuplicateLinkReference String SourcePos | DuplicateNoteReference String SourcePos @@ -99,6 +100,8 @@ instance ToJSON LogMessage where "source" .= Text.pack (sourceName pos), "line" .= sourceLine pos, "column" .= sourceColumn pos] + IgnoredElement s -> + ["contents" .= Text.pack s] CouldNotParseYamlMetadata s pos -> ["message" .= Text.pack s, "source" .= Text.pack (sourceName pos), @@ -224,6 +227,8 @@ showLogMessage msg = case msg of SkippedContent s pos -> "Skipped '" ++ s ++ "' at " ++ showPos pos + IgnoredElement s -> + "Ignored element " ++ s CouldNotParseYamlMetadata s pos -> "Could not parse YAML metadata at " ++ showPos pos ++ if null s then "" else ": " ++ s @@ -310,6 +315,7 @@ messageVerbosity:: LogMessage -> Verbosity messageVerbosity msg = case msg of SkippedContent{} -> INFO + IgnoredElement{} -> INFO CouldNotParseYamlMetadata{} -> WARNING DuplicateLinkReference{} -> WARNING DuplicateNoteReference{} -> WARNING