git.iko.soy/typeable/pandoc
on master help sign in
T.P.App.Opt: rename optReader, optWriter as optFrom, optTo.

This will allow to: and from: in defaults.

commitff1df241a9fcacec8c897cc0f01f691ee5b49a22 authorJohn MacFarlane <jgm@berkeley.edu> dateWed 9 Oct 2019, 21:54 (7 years ago) parent070e098
4 files changed+9−9
src/Text/Pandoc/App.hs+1−1 src/Text/Pandoc/App/CommandLineOptions.hs+2−2 src/Text/Pandoc/App/Opt.hs+4−4 src/Text/Pandoc/App/OutputSettings.hs+2−2
src/Text/Pandoc/App.hs+1−1
@@ -136,7 +136,7 @@ convertWithOpts opts = do
136136 setOutputFile (optOutputFile opts)
137137
138138 -- assign reader and writer based on options and filenames
139− readerName <- case optReader opts of
139+ readerName <- case optFrom opts of
140140 Just f -> return f
141141 Nothing -> case formatFromFilePaths sources of
142142 Just f' -> return f'
src/Text/Pandoc/App/CommandLineOptions.hs+2−2
@@ -131,14 +131,14 @@ options =
131131
132132 , Option "fr" ["from","read"]
133133 (ReqArg
134− (\arg opt -> return opt { optReader =
134+ (\arg opt -> return opt { optFrom =
135135 Just (map toLower arg) })
136136 "FORMAT")
137137 ""
138138
139139 , Option "tw" ["to","write"]
140140 (ReqArg
141− (\arg opt -> return opt { optWriter = Just arg })
141+ (\arg opt -> return opt { optTo = Just arg })
142142 "FORMAT")
143143 ""
144144
src/Text/Pandoc/App/Opt.hs+4−4
@@ -45,8 +45,8 @@ data Opt = Opt
4545 { optTabStop :: Int -- ^ Number of spaces per tab
4646 , optPreserveTabs :: Bool -- ^ Preserve tabs instead of converting to spaces
4747 , optStandalone :: Bool -- ^ Include header, footer
48− , optReader :: Maybe String -- ^ Reader format
49− , optWriter :: Maybe String -- ^ Writer format
48+ , optFrom :: Maybe String -- ^ Reader format
49+ , optTo :: Maybe String -- ^ Writer format
5050 , optTableOfContents :: Bool -- ^ Include table of contents
5151 , optShiftHeadingLevelBy :: Int -- ^ Shift heading level by
5252 , optTemplate :: Maybe FilePath -- ^ Custom template
@@ -119,8 +119,8 @@ defaultOpts = Opt
119119 { optTabStop = 4
120120 , optPreserveTabs = False
121121 , optStandalone = False
122− , optReader = Nothing
123− , optWriter = Nothing
122+ , optFrom = Nothing
123+ , optTo = Nothing
124124 , optTableOfContents = False
125125 , optShiftHeadingLevelBy = 0
126126 , optTemplate = Nothing
src/Text/Pandoc/App/OutputSettings.hs+2−2
@@ -68,8 +68,8 @@ optToOutputSettings opts = do
6868 let pdfOutput = map toLower (takeExtension outputFile) == ".pdf"
6969 (writerName, maybePdfProg) <-
7070 if pdfOutput
71− then liftIO $ pdfWriterAndProg (optWriter opts) (optPdfEngine opts)
72− else case optWriter opts of
71+ then liftIO $ pdfWriterAndProg (optTo opts) (optPdfEngine opts)
72+ else case optTo opts of
7373 Nothing
7474 | outputFile == "-" -> return ("html", Nothing)
7575 | otherwise ->