summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Logging.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-02-24 13:48:07 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2017-02-24 14:15:10 +0100
commit1c84855aab5ddda3872e5b31d9a1bcbc14de7dca (patch)
treeeebdbe5dbf022da78d0d23edcffa9fdf5f9a9615 /src/Text/Pandoc/Logging.hs
parent693674779423c21305c483251915e918c9d6508e (diff)
Class: Add stResourcePath to CommonState, getResourcePath, setResourcePath.
To be used in implementing `\graphicspath` in LaTeX, and possibly in things like PDF production via context. Use resource path in fetchItem. Issue an info message if we get a resource from somewhere other than ".". Added UsingResourceFrom to log message.
Diffstat (limited to 'src/Text/Pandoc/Logging.hs')
-rw-r--r--src/Text/Pandoc/Logging.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Logging.hs b/src/Text/Pandoc/Logging.hs
index bf3e7cb4e..f995b6528 100644
--- a/src/Text/Pandoc/Logging.hs
+++ b/src/Text/Pandoc/Logging.hs
@@ -74,6 +74,7 @@ data LogMessage =
| CouldNotConvertTeXMath String String
| CouldNotParseCSS String
| Fetching String
+ | UsingResourceFrom FilePath FilePath
deriving (Show, Eq, Data, Ord, Typeable, Generic)
instance ToJSON LogMessage where
@@ -163,6 +164,10 @@ instance ToJSON LogMessage where
Fetching fp ->
["type" .= String "CouldNotParseCSS",
"path" .= Text.pack fp]
+ UsingResourceFrom resource dir ->
+ ["type" .= String "UsingResourceFrom",
+ "resource" .= Text.pack resource,
+ "path" .= Text.pack dir]
showPos :: SourcePos -> String
showPos pos = sn ++ "line " ++
@@ -220,6 +225,8 @@ showLogMessage msg =
"Could not parse CSS" ++ if null m then "" else (':':'\n':m)
Fetching fp ->
"Fetching " ++ fp ++ "..."
+ UsingResourceFrom fp dir ->
+ "Using " ++ fp ++ " from " ++ dir
messageVerbosity:: LogMessage -> Verbosity
messageVerbosity msg =
@@ -242,3 +249,4 @@ messageVerbosity msg =
CouldNotConvertTeXMath{} -> WARNING
CouldNotParseCSS{} -> WARNING
Fetching{} -> INFO
+ UsingResourceFrom{} -> INFO