aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-10-06 21:31:28 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2019-10-06 21:31:28 -0700
commitfcfdc8210f2376f99fdefb29833ae051e196a13e (patch)
tree75cefa68447ebe888acbcae6bb7161a478031e46
parentcf1703396c626861fb1904bf5159e04d1ecc79b8 (diff)
downloadpandoc-fcfdc8210f2376f99fdefb29833ae051e196a13e.tar.gz
Text.Pandoc.App.Opt: Remove optBaseHeaderLevel from Opt.
We now just use optShiftHeadingLevelBy, to avoid redundancy.
-rw-r--r--src/Text/Pandoc/App.hs5
-rw-r--r--src/Text/Pandoc/App/CommandLineOptions.hs2
-rw-r--r--src/Text/Pandoc/App/Opt.hs2
3 files changed, 2 insertions, 7 deletions
diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs
index 47fb155eb..288fa7788 100644
--- a/src/Text/Pandoc/App.hs
+++ b/src/Text/Pandoc/App.hs
@@ -229,10 +229,7 @@ convertWithOpts opts = do
paths -> mapM readFileLazy paths >>= mapM (yamlToMeta readerOpts)
>>= return . (foldr1 (<>))
- let transforms = (case optBaseHeaderLevel opts of
- x | x > 1 -> (headerShift (x - 1) :)
- | otherwise -> id) .
- (case optShiftHeadingLevelBy opts of
+ let transforms = (case optShiftHeadingLevelBy opts of
0 -> id
x -> (headerShift x :)) .
(if optStripEmptyParagraphs opts
diff --git a/src/Text/Pandoc/App/CommandLineOptions.hs b/src/Text/Pandoc/App/CommandLineOptions.hs
index 43080c8c6..a6203accb 100644
--- a/src/Text/Pandoc/App/CommandLineOptions.hs
+++ b/src/Text/Pandoc/App/CommandLineOptions.hs
@@ -454,7 +454,7 @@ options =
"Use --shift-heading-level-by instead."
case safeRead arg of
Just t | t > 0 && t < 6 ->
- return opt{ optBaseHeaderLevel = t }
+ return opt{ optShiftHeadingLevelBy = t - 1 }
_ -> E.throwIO $ PandocOptionError
"base-header-level must be 1-5")
"NUMBER")
diff --git a/src/Text/Pandoc/App/Opt.hs b/src/Text/Pandoc/App/Opt.hs
index bbcc65395..126f5db4c 100644
--- a/src/Text/Pandoc/App/Opt.hs
+++ b/src/Text/Pandoc/App/Opt.hs
@@ -51,7 +51,6 @@ data Opt = Opt
, optWriter :: Maybe String -- ^ Writer format
, optTableOfContents :: Bool -- ^ Include table of contents
, optShiftHeadingLevelBy :: Int -- ^ Shift heading level by
- , optBaseHeaderLevel :: Int -- ^ Base header level
, optTemplate :: Maybe FilePath -- ^ Custom template
, optVariables :: [(String,String)] -- ^ Template variables to set
, optMetadata :: [(String, String)] -- ^ Metadata fields to set
@@ -126,7 +125,6 @@ defaultOpts = Opt
, optWriter = Nothing
, optTableOfContents = False
, optShiftHeadingLevelBy = 0
- , optBaseHeaderLevel = 1
, optTemplate = Nothing
, optVariables = []
, optMetadata = []