From fcfdc8210f2376f99fdefb29833ae051e196a13e Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 6 Oct 2019 21:31:28 -0700 Subject: Text.Pandoc.App.Opt: Remove optBaseHeaderLevel from Opt. We now just use optShiftHeadingLevelBy, to avoid redundancy. --- src/Text/Pandoc/App.hs | 5 +---- src/Text/Pandoc/App/CommandLineOptions.hs | 2 +- src/Text/Pandoc/App/Opt.hs | 2 -- 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 = [] -- cgit v1.2.3