aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-10-09 21:54:41 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2019-10-09 21:54:41 -0700
commitff1df241a9fcacec8c897cc0f01f691ee5b49a22 (patch)
tree8a05a7073b5f30bc6d05a8d1392bf266e7c5821d /src
parent070e098b48bfed41b703eec7c62c91c82ad66d26 (diff)
downloadpandoc-ff1df241a9fcacec8c897cc0f01f691ee5b49a22.tar.gz
T.P.App.Opt: rename optReader, optWriter as optFrom, optTo.
This will allow to: and from: in defaults.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/App.hs2
-rw-r--r--src/Text/Pandoc/App/CommandLineOptions.hs4
-rw-r--r--src/Text/Pandoc/App/Opt.hs8
-rw-r--r--src/Text/Pandoc/App/OutputSettings.hs4
4 files changed, 9 insertions, 9 deletions
diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs
index 38a469669..ed5963f1a 100644
--- a/src/Text/Pandoc/App.hs
+++ b/src/Text/Pandoc/App.hs
@@ -136,7 +136,7 @@ convertWithOpts opts = do
setOutputFile (optOutputFile opts)
-- assign reader and writer based on options and filenames
- readerName <- case optReader opts of
+ readerName <- case optFrom opts of
Just f -> return f
Nothing -> case formatFromFilePaths sources of
Just f' -> return f'
diff --git a/src/Text/Pandoc/App/CommandLineOptions.hs b/src/Text/Pandoc/App/CommandLineOptions.hs
index 8ff7c70e3..e23452b3b 100644
--- a/src/Text/Pandoc/App/CommandLineOptions.hs
+++ b/src/Text/Pandoc/App/CommandLineOptions.hs
@@ -131,14 +131,14 @@ options =
, Option "fr" ["from","read"]
(ReqArg
- (\arg opt -> return opt { optReader =
+ (\arg opt -> return opt { optFrom =
Just (map toLower arg) })
"FORMAT")
""
, Option "tw" ["to","write"]
(ReqArg
- (\arg opt -> return opt { optWriter = Just arg })
+ (\arg opt -> return opt { optTo = Just arg })
"FORMAT")
""
diff --git a/src/Text/Pandoc/App/Opt.hs b/src/Text/Pandoc/App/Opt.hs
index 09086659d..c491d8ae2 100644
--- a/src/Text/Pandoc/App/Opt.hs
+++ b/src/Text/Pandoc/App/Opt.hs
@@ -45,8 +45,8 @@ data Opt = Opt
{ optTabStop :: Int -- ^ Number of spaces per tab
, optPreserveTabs :: Bool -- ^ Preserve tabs instead of converting to spaces
, optStandalone :: Bool -- ^ Include header, footer
- , optReader :: Maybe String -- ^ Reader format
- , optWriter :: Maybe String -- ^ Writer format
+ , optFrom :: Maybe String -- ^ Reader format
+ , optTo :: Maybe String -- ^ Writer format
, optTableOfContents :: Bool -- ^ Include table of contents
, optShiftHeadingLevelBy :: Int -- ^ Shift heading level by
, optTemplate :: Maybe FilePath -- ^ Custom template
@@ -119,8 +119,8 @@ defaultOpts = Opt
{ optTabStop = 4
, optPreserveTabs = False
, optStandalone = False
- , optReader = Nothing
- , optWriter = Nothing
+ , optFrom = Nothing
+ , optTo = Nothing
, optTableOfContents = False
, optShiftHeadingLevelBy = 0
, optTemplate = Nothing
diff --git a/src/Text/Pandoc/App/OutputSettings.hs b/src/Text/Pandoc/App/OutputSettings.hs
index 6e430a76e..bdfb4cde2 100644
--- a/src/Text/Pandoc/App/OutputSettings.hs
+++ b/src/Text/Pandoc/App/OutputSettings.hs
@@ -68,8 +68,8 @@ optToOutputSettings opts = do
let pdfOutput = map toLower (takeExtension outputFile) == ".pdf"
(writerName, maybePdfProg) <-
if pdfOutput
- then liftIO $ pdfWriterAndProg (optWriter opts) (optPdfEngine opts)
- else case optWriter opts of
+ then liftIO $ pdfWriterAndProg (optTo opts) (optPdfEngine opts)
+ else case optTo opts of
Nothing
| outputFile == "-" -> return ("html", Nothing)
| otherwise ->