aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Logging.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Logging.hs b/src/Text/Pandoc/Logging.hs
index c49726040..bb2fb5d36 100644
--- a/src/Text/Pandoc/Logging.hs
+++ b/src/Text/Pandoc/Logging.hs
@@ -105,6 +105,7 @@ data LogMessage =
| ATXHeadingInLHS Int Text
| EnvironmentVariableUndefined Text
| DuplicateAttribute Text Text
+ | NotUTF8Encoded FilePath
deriving (Show, Eq, Data, Ord, Typeable, Generic)
instance ToJSON LogMessage where
@@ -244,6 +245,8 @@ instance ToJSON LogMessage where
DuplicateAttribute attr val ->
["attribute" .= attr
,"value" .= val]
+ NotUTF8Encoded src ->
+ ["source" .= src]
showPos :: SourcePos -> Text
showPos pos = Text.pack $ sn ++ "line " ++
@@ -370,6 +373,9 @@ showLogMessage msg =
"Undefined environment variable " <> var <> " in defaults file."
DuplicateAttribute attr val ->
"Ignoring duplicate attribute " <> attr <> "=" <> tshow val <> "."
+ NotUTF8Encoded src ->
+ Text.pack src <>
+ " is not UTF-8 encoded: falling back to latin1."
messageVerbosity :: LogMessage -> Verbosity
messageVerbosity msg =
@@ -420,3 +426,4 @@ messageVerbosity msg =
ATXHeadingInLHS{} -> WARNING
EnvironmentVariableUndefined{}-> WARNING
DuplicateAttribute{} -> WARNING
+ NotUTF8Encoded{} -> WARNING