diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-06-09 11:50:26 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-06-09 11:50:42 -0700 |
commit | d577552850f46afe056ed4a7a2bf3a1a62ade9af (patch) | |
tree | 7206614953481c47a63f023f729f22889fe2d1c2 | |
parent | 814c3af4dff4c99dd29b24037be42a92aca61257 (diff) | |
download | pandoc-d577552850f46afe056ed4a7a2bf3a1a62ade9af.tar.gz |
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.
-rw-r--r-- | src/Text/Pandoc/Logging.hs | 6 |
1 files changed, 6 insertions, 0 deletions
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 |