git.iko.soy/typeable/pandoc
on master help sign in
Logging: Added NoTitleElement constructor for LogMessage.
87764b1John MacFarlane
src/Text/Pandoc/Logging.hs+9
@@ -75,6 +75,7 @@ data LogMessage =
75 | CouldNotConvertTeXMath String String
75 | CouldNotConvertTeXMath String String
76 | CouldNotParseCSS String
76 | CouldNotParseCSS String
77 | Fetching String
77 | Fetching String
78+ | NoTitleElement String
78 deriving (Show, Eq, Data, Ord, Typeable, Generic)
79 deriving (Show, Eq, Data, Ord, Typeable, Generic)
79
80
80instance ToJSON LogMessage where
81instance ToJSON LogMessage where
@@ -168,6 +169,9 @@ instance ToJSON LogMessage where
168 Fetching fp ->
169 Fetching fp ->
169 ["type" .= String "CouldNotParseCSS",
170 ["type" .= String "CouldNotParseCSS",
170 "path" .= Text.pack fp]
171 "path" .= Text.pack fp]
172+ NoTitleElement fallback ->
173+ ["type" .= String "NoTitleElement",
174+ "fallback" .= Text.pack fallback]
171
175
172showPos :: SourcePos -> String
176showPos :: SourcePos -> String
173showPos pos = sn ++ "line " ++
177showPos pos = sn ++ "line " ++
@@ -228,6 +232,10 @@ showLogMessage msg =
228 "Could not parse CSS" ++ if null m then "" else (':':'\n':m)
232 "Could not parse CSS" ++ if null m then "" else (':':'\n':m)
229 Fetching fp ->
233 Fetching fp ->
230 "Fetching " ++ fp ++ "..."
234 "Fetching " ++ fp ++ "..."
235+ NoTitleElement fallback ->
236+ "This document format requires a nonempty <title> element.\n" ++
237+ "Please specify either 'title' or 'pagetitle' in the metadata.\n" ++
238+ "Falling back to '" ++ fallback ++ "'"
231
239
232messageVerbosity:: LogMessage -> Verbosity
240messageVerbosity:: LogMessage -> Verbosity
233messageVerbosity msg =
241messageVerbosity msg =
@@ -251,3 +259,4 @@ messageVerbosity msg =
251 CouldNotConvertTeXMath{} -> WARNING
259 CouldNotConvertTeXMath{} -> WARNING
252 CouldNotParseCSS{} -> WARNING
260 CouldNotParseCSS{} -> WARNING
253 Fetching{} -> INFO
261 Fetching{} -> INFO
262+ NoTitleElement{} -> WARNING