aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/App
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc/App')
-rw-r--r--src/Text/Pandoc/App/CommandLineOptions.hs17
-rw-r--r--src/Text/Pandoc/App/Opt.hs2
2 files changed, 17 insertions, 2 deletions
diff --git a/src/Text/Pandoc/App/CommandLineOptions.hs b/src/Text/Pandoc/App/CommandLineOptions.hs
index ae12ba42c..cffe69eca 100644
--- a/src/Text/Pandoc/App/CommandLineOptions.hs
+++ b/src/Text/Pandoc/App/CommandLineOptions.hs
@@ -436,10 +436,23 @@ options =
"SCRIPTPATH")
"" -- "Lua filter"
- , Option "" ["base-header-level"]
+ , Option "" ["shift-heading-level-by"]
(ReqArg
(\arg opt ->
case safeRead arg of
+ Just t ->
+ return opt{ optShiftHeadingLevel = t }
+ _ -> E.throwIO $ PandocOptionError
+ "shift-heading-level-by takes an integer argument")
+ "NUMBER")
+ "" -- "Shift heading level"
+
+ , Option "" ["base-header-level"]
+ (ReqArg
+ (\arg opt -> do
+ deprecatedOption "--base-header-level"
+ "Use --shift-heading-level-by instead."
+ case safeRead arg of
Just t | t > 0 && t < 6 ->
return opt{ optBaseHeaderLevel = t }
_ -> E.throwIO $ PandocOptionError
@@ -450,7 +463,7 @@ options =
, Option "" ["strip-empty-paragraphs"]
(NoArg
(\opt -> do
- deprecatedOption "--stripEmptyParagraphs"
+ deprecatedOption "--strip-empty-paragraphs"
"Use +empty_paragraphs extension."
return opt{ optStripEmptyParagraphs = True }))
"" -- "Strip empty paragraphs"
diff --git a/src/Text/Pandoc/App/Opt.hs b/src/Text/Pandoc/App/Opt.hs
index 0b7bb7f2c..1111a5457 100644
--- a/src/Text/Pandoc/App/Opt.hs
+++ b/src/Text/Pandoc/App/Opt.hs
@@ -50,6 +50,7 @@ data Opt = Opt
, optReader :: Maybe String -- ^ Reader format
, optWriter :: Maybe String -- ^ Writer format
, optTableOfContents :: Bool -- ^ Include table of contents
+ , optShiftHeadingLevel :: Int -- ^ Shift heading level by
, optBaseHeaderLevel :: Int -- ^ Base header level
, optTemplate :: Maybe FilePath -- ^ Custom template
, optVariables :: [(String,String)] -- ^ Template variables to set
@@ -124,6 +125,7 @@ defaultOpts = Opt
, optReader = Nothing
, optWriter = Nothing
, optTableOfContents = False
+ , optShiftHeadingLevel = 0
, optBaseHeaderLevel = 1
, optTemplate = Nothing
, optVariables = []