git.iko.soy/typeable/pandoc
on master help sign in
Command line options: use normalizePath in more places.

See #5127. It is now used everywhere a file argument can be used. Closes #5127.

commit26ed7fb4f9e95a00607ab9cfddc48267c717d24b authorJohn MacFarlane <jgm@berkeley.edu> dateSat 19 Sep 2020, 22:32 (6 years ago) parentba9bede
1 file changed+25−14
src/Text/Pandoc/App/CommandLineOptions.hs+25−14
src/Text/Pandoc/App/CommandLineOptions.hs+25−14
@@ -283,21 +283,24 @@ options =
283283 , Option "H" ["include-in-header"]
284284 (ReqArg
285285 (\arg opt -> return opt{ optIncludeInHeader =
286− optIncludeInHeader opt ++ [arg] })
286+ optIncludeInHeader opt ++
287+ [normalizePath arg] })
287288 "FILE")
288289 "" -- "File to include at end of header (implies -s)"
289290
290291 , Option "B" ["include-before-body"]
291292 (ReqArg
292293 (\arg opt -> return opt{ optIncludeBeforeBody =
293− optIncludeBeforeBody opt ++ [arg] })
294+ optIncludeBeforeBody opt ++
295+ [normalizePath arg] })
294296 "FILE")
295297 "" -- "File to include before document body"
296298
297299 , Option "A" ["include-after-body"]
298300 (ReqArg
299301 (\arg opt -> return opt{ optIncludeAfterBody =
300− optIncludeAfterBody opt ++ [arg] })
302+ optIncludeAfterBody opt ++
303+ [normalizePath arg] })
301304 "FILE")
302305 "" -- "File to include after document body"
303306
@@ -309,7 +312,8 @@ options =
309312 , Option "" ["highlight-style"]
310313 (ReqArg
311314 (\arg opt ->
312− return opt{ optHighlightStyle = Just $ T.pack arg })
315+ return opt{ optHighlightStyle = Just $
316+ T.pack $ normalizePath arg })
313317 "STYLE|FILE")
314318 "" -- "Style for highlighted code"
315319
@@ -397,7 +401,7 @@ options =
397401 , Option "" ["reference-doc"]
398402 (ReqArg
399403 (\arg opt ->
400− return opt { optReferenceDoc = Just arg })
404+ return opt { optReferenceDoc = Just $ normalizePath arg })
401405 "FILE")
402406 "" -- "Path of custom reference doc"
403407
@@ -422,7 +426,8 @@ options =
422426
423427 , Option "" ["abbreviations"]
424428 (ReqArg
425− (\arg opt -> return opt { optAbbreviations = Just arg })
429+ (\arg opt -> return opt { optAbbreviations =
430+ Just $ normalizePath arg })
426431 "FILE")
427432 "" -- "Specify file for custom abbreviations"
428433
@@ -607,21 +612,24 @@ options =
607612 (ReqArg
608613 (\arg opt ->
609614 return opt { optVariables =
610− setVariable "epub-cover-image" (T.pack arg) $
615+ setVariable "epub-cover-image"
616+ (T.pack $ normalizePath arg) $
611617 optVariables opt })
612618 "FILE")
613619 "" -- "Path of epub cover image"
614620
615621 , Option "" ["epub-metadata"]
616622 (ReqArg
617− (\arg opt -> return opt { optEpubMetadata = Just arg })
623+ (\arg opt -> return opt { optEpubMetadata = Just $
624+ normalizePath arg })
618625 "FILE")
619626 "" -- "Path of epub metadata file"
620627
621628 , Option "" ["epub-embed-font"]
622629 (ReqArg
623630 (\arg opt ->
624− return opt{ optEpubFonts = arg : optEpubFonts opt })
631+ return opt{ optEpubFonts = normalizePath arg :
632+ optEpubFonts opt })
625633 "FILE")
626634 "" -- "Directory of fonts to embed"
627635
@@ -651,7 +659,8 @@ options =
651659 , Option "" ["bibliography"]
652660 (ReqArg
653661 (\arg opt -> return opt{ optMetadata =
654− addMeta "bibliography" arg $
662+ addMeta "bibliography"
663+ (normalizePath arg) $
655664 optMetadata opt })
656665 "FILE")
657666 ""
@@ -660,7 +669,8 @@ options =
660669 (ReqArg
661670 (\arg opt ->
662671 return opt{ optMetadata =
663− addMeta "csl" arg $ optMetadata opt })
672+ addMeta "csl" (normalizePath arg) $
673+ optMetadata opt })
664674 "FILE")
665675 ""
666676
@@ -668,8 +678,8 @@ options =
668678 (ReqArg
669679 (\arg opt ->
670680 return opt{ optMetadata =
671− addMeta "citation-abbreviations" arg $
672− optMetadata opt })
681+ addMeta "citation-abbreviations"
682+ (normalizePath arg) $ optMetadata opt })
673683 "FILE")
674684 ""
675685
@@ -752,7 +762,8 @@ options =
752762
753763 , Option "" ["log"]
754764 (ReqArg
755− (\arg opt -> return opt{ optLogFile = Just arg })
765+ (\arg opt -> return opt{ optLogFile = Just $
766+ normalizePath arg })
756767 "FILE")
757768 "" -- "Log messages in JSON format to this file."
758769