git.iko.soy/typeable/pandoc
on master help sign in
Text.Pandoc.App.Opt: Remove optBaseHeaderLevel from Opt.

We now just use optShiftHeadingLevelBy, to avoid redundancy.

commitfcfdc8210f2376f99fdefb29833ae051e196a13e authorJohn MacFarlane <jgm@berkeley.edu> dateSun 6 Oct 2019, 21:31 (7 years ago) parentcf17033
3 files changed+2−7
src/Text/Pandoc/App.hs+1−4 src/Text/Pandoc/App/CommandLineOptions.hs+1−1 src/Text/Pandoc/App/Opt.hs−2
src/Text/Pandoc/App.hs+1−4
@@ -229,10 +229,7 @@ convertWithOpts opts = do
229229 paths -> mapM readFileLazy paths >>= mapM (yamlToMeta readerOpts)
230230 >>= return . (foldr1 (<>))
231231
232− let transforms = (case optBaseHeaderLevel opts of
233− x | x > 1 -> (headerShift (x - 1) :)
234− | otherwise -> id) .
235− (case optShiftHeadingLevelBy opts of
232+ let transforms = (case optShiftHeadingLevelBy opts of
236233 0 -> id
237234 x -> (headerShift x :)) .
238235 (if optStripEmptyParagraphs opts
src/Text/Pandoc/App/CommandLineOptions.hs+1−1
@@ -454,7 +454,7 @@ options =
454454 "Use --shift-heading-level-by instead."
455455 case safeRead arg of
456456 Just t | t > 0 && t < 6 ->
457− return opt{ optBaseHeaderLevel = t }
457+ return opt{ optShiftHeadingLevelBy = t - 1 }
458458 _ -> E.throwIO $ PandocOptionError
459459 "base-header-level must be 1-5")
460460 "NUMBER")
src/Text/Pandoc/App/Opt.hs−2
@@ -51,7 +51,6 @@ data Opt = Opt
5151 , optWriter :: Maybe String -- ^ Writer format
5252 , optTableOfContents :: Bool -- ^ Include table of contents
5353 , optShiftHeadingLevelBy :: Int -- ^ Shift heading level by
54− , optBaseHeaderLevel :: Int -- ^ Base header level
5554 , optTemplate :: Maybe FilePath -- ^ Custom template
5655 , optVariables :: [(String,String)] -- ^ Template variables to set
5756 , optMetadata :: [(String, String)] -- ^ Metadata fields to set
@@ -126,7 +125,6 @@ defaultOpts = Opt
126125 , optWriter = Nothing
127126 , optTableOfContents = False
128127 , optShiftHeadingLevelBy = 0
129− , optBaseHeaderLevel = 1
130128 , optTemplate = Nothing
131129 , optVariables = []
132130 , optMetadata = []