aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2020-09-19 22:32:31 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2020-09-19 22:35:50 -0700
commit26ed7fb4f9e95a00607ab9cfddc48267c717d24b (patch)
treecd725e9762c9f4715d71903650bfe3f5c14bf7c5 /src
parentba9bedef23faff253737723d1b79330cdf105d8f (diff)
downloadpandoc-26ed7fb4f9e95a00607ab9cfddc48267c717d24b.tar.gz
Command line options: use normalizePath in more places.
See #5127. It is now used everywhere a file argument can be used. Closes #5127.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/App/CommandLineOptions.hs39
1 files changed, 25 insertions, 14 deletions
diff --git a/src/Text/Pandoc/App/CommandLineOptions.hs b/src/Text/Pandoc/App/CommandLineOptions.hs
index 4b9e691ed..99dba4613 100644
--- a/src/Text/Pandoc/App/CommandLineOptions.hs
+++ b/src/Text/Pandoc/App/CommandLineOptions.hs
@@ -283,21 +283,24 @@ options =
, Option "H" ["include-in-header"]
(ReqArg
(\arg opt -> return opt{ optIncludeInHeader =
- optIncludeInHeader opt ++ [arg] })
+ optIncludeInHeader opt ++
+ [normalizePath arg] })
"FILE")
"" -- "File to include at end of header (implies -s)"
, Option "B" ["include-before-body"]
(ReqArg
(\arg opt -> return opt{ optIncludeBeforeBody =
- optIncludeBeforeBody opt ++ [arg] })
+ optIncludeBeforeBody opt ++
+ [normalizePath arg] })
"FILE")
"" -- "File to include before document body"
, Option "A" ["include-after-body"]
(ReqArg
(\arg opt -> return opt{ optIncludeAfterBody =
- optIncludeAfterBody opt ++ [arg] })
+ optIncludeAfterBody opt ++
+ [normalizePath arg] })
"FILE")
"" -- "File to include after document body"
@@ -309,7 +312,8 @@ options =
, Option "" ["highlight-style"]
(ReqArg
(\arg opt ->
- return opt{ optHighlightStyle = Just $ T.pack arg })
+ return opt{ optHighlightStyle = Just $
+ T.pack $ normalizePath arg })
"STYLE|FILE")
"" -- "Style for highlighted code"
@@ -397,7 +401,7 @@ options =
, Option "" ["reference-doc"]
(ReqArg
(\arg opt ->
- return opt { optReferenceDoc = Just arg })
+ return opt { optReferenceDoc = Just $ normalizePath arg })
"FILE")
"" -- "Path of custom reference doc"
@@ -422,7 +426,8 @@ options =
, Option "" ["abbreviations"]
(ReqArg
- (\arg opt -> return opt { optAbbreviations = Just arg })
+ (\arg opt -> return opt { optAbbreviations =
+ Just $ normalizePath arg })
"FILE")
"" -- "Specify file for custom abbreviations"
@@ -607,21 +612,24 @@ options =
(ReqArg
(\arg opt ->
return opt { optVariables =
- setVariable "epub-cover-image" (T.pack arg) $
+ setVariable "epub-cover-image"
+ (T.pack $ normalizePath arg) $
optVariables opt })
"FILE")
"" -- "Path of epub cover image"
, Option "" ["epub-metadata"]
(ReqArg
- (\arg opt -> return opt { optEpubMetadata = Just arg })
+ (\arg opt -> return opt { optEpubMetadata = Just $
+ normalizePath arg })
"FILE")
"" -- "Path of epub metadata file"
, Option "" ["epub-embed-font"]
(ReqArg
(\arg opt ->
- return opt{ optEpubFonts = arg : optEpubFonts opt })
+ return opt{ optEpubFonts = normalizePath arg :
+ optEpubFonts opt })
"FILE")
"" -- "Directory of fonts to embed"
@@ -651,7 +659,8 @@ options =
, Option "" ["bibliography"]
(ReqArg
(\arg opt -> return opt{ optMetadata =
- addMeta "bibliography" arg $
+ addMeta "bibliography"
+ (normalizePath arg) $
optMetadata opt })
"FILE")
""
@@ -660,7 +669,8 @@ options =
(ReqArg
(\arg opt ->
return opt{ optMetadata =
- addMeta "csl" arg $ optMetadata opt })
+ addMeta "csl" (normalizePath arg) $
+ optMetadata opt })
"FILE")
""
@@ -668,8 +678,8 @@ options =
(ReqArg
(\arg opt ->
return opt{ optMetadata =
- addMeta "citation-abbreviations" arg $
- optMetadata opt })
+ addMeta "citation-abbreviations"
+ (normalizePath arg) $ optMetadata opt })
"FILE")
""
@@ -752,7 +762,8 @@ options =
, Option "" ["log"]
(ReqArg
- (\arg opt -> return opt{ optLogFile = Just arg })
+ (\arg opt -> return opt{ optLogFile = Just $
+ normalizePath arg })
"FILE")
"" -- "Log messages in JSON format to this file."