summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-03-04 11:13:54 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2017-03-04 11:13:54 +0100
commit87764b1c46b68de556698bad797fd46dedd4dc96 (patch)
treea1238506426e81e608bc8164aace3e1db958f5a5
parent9925739ba9365fbc8a395af463df426986d0638d (diff)
Logging: Added NoTitleElement constructor for LogMessage.
-rw-r--r--src/Text/Pandoc/Logging.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Logging.hs b/src/Text/Pandoc/Logging.hs
index a58e25074..32695f03d 100644
--- a/src/Text/Pandoc/Logging.hs
+++ b/src/Text/Pandoc/Logging.hs
@@ -75,6 +75,7 @@ data LogMessage =
| CouldNotConvertTeXMath String String
| CouldNotParseCSS String
| Fetching String
+ | NoTitleElement String
deriving (Show, Eq, Data, Ord, Typeable, Generic)
instance ToJSON LogMessage where
@@ -168,6 +169,9 @@ instance ToJSON LogMessage where
Fetching fp ->
["type" .= String "CouldNotParseCSS",
"path" .= Text.pack fp]
+ NoTitleElement fallback ->
+ ["type" .= String "NoTitleElement",
+ "fallback" .= Text.pack fallback]
showPos :: SourcePos -> String
showPos pos = sn ++ "line " ++
@@ -228,6 +232,10 @@ showLogMessage msg =
"Could not parse CSS" ++ if null m then "" else (':':'\n':m)
Fetching fp ->
"Fetching " ++ fp ++ "..."
+ NoTitleElement fallback ->
+ "This document format requires a nonempty <title> element.\n" ++
+ "Please specify either 'title' or 'pagetitle' in the metadata.\n" ++
+ "Falling back to '" ++ fallback ++ "'"
messageVerbosity:: LogMessage -> Verbosity
messageVerbosity msg =
@@ -251,3 +259,4 @@ messageVerbosity msg =
CouldNotConvertTeXMath{} -> WARNING
CouldNotParseCSS{} -> WARNING
Fetching{} -> INFO
+ NoTitleElement{} -> WARNING