Skip to content

Commit

Permalink
Command line options: use normalizePath in more places.
Browse files Browse the repository at this point in the history
See #5127.  It is now used everywhere a file argument can be used.

Closes #5127.
  • Loading branch information
jgm committed Sep 20, 2020
1 parent ba9bede commit 26ed7fb
Showing 1 changed file with 25 additions and 14 deletions.
39 changes: 25 additions & 14 deletions src/Text/Pandoc/App/CommandLineOptions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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"

Expand Down Expand Up @@ -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"

Expand All @@ -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"

Expand Down Expand Up @@ -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"

Expand Down Expand Up @@ -651,7 +659,8 @@ options =
, Option "" ["bibliography"]
(ReqArg
(\arg opt -> return opt{ optMetadata =
addMeta "bibliography" arg $
addMeta "bibliography"
(normalizePath arg) $
optMetadata opt })
"FILE")
""
Expand All @@ -660,16 +669,17 @@ options =
(ReqArg
(\arg opt ->
return opt{ optMetadata =
addMeta "csl" arg $ optMetadata opt })
addMeta "csl" (normalizePath arg) $
optMetadata opt })
"FILE")
""

, Option "" ["citation-abbreviations"]
(ReqArg
(\arg opt ->
return opt{ optMetadata =
addMeta "citation-abbreviations" arg $
optMetadata opt })
addMeta "citation-abbreviations"
(normalizePath arg) $ optMetadata opt })
"FILE")
""

Expand Down Expand Up @@ -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."

Expand Down

0 comments on commit 26ed7fb

Please sign in to comment.