diff options
| author | John MacFarlane <jgm@berkeley.edu> | 2019-09-10 23:16:13 -0700 |
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2019-09-10 23:16:13 -0700 |
| commit | 88dc6fac5d2d6f494e9c334261ecb40d3e156667 (patch) | |
| tree | b4786323d43f44433a41bddc5b85433af34bfcb4 /src/Text/Pandoc/App/CommandLineOptions.hs | |
| parent | a64b3ab61ff34dca25f04f4f97b283dc5159ac87 (diff) | |
Add --shift-heading-level-by option.
Deprecate --base-heading-level.
The new option does everything the old one does, but also
allows negative shifts. It also promotes the document
metadata (if not null) to a level-1 heading with a +1 shift,
and demotes an initial level-1 heading to document metadata
with a -1 shift. This supports converting documents that
use an initial level-1 heading for the document title.
Closes #5615.
Diffstat (limited to 'src/Text/Pandoc/App/CommandLineOptions.hs')
| -rw-r--r-- | src/Text/Pandoc/App/CommandLineOptions.hs | 17 |
1 files changed, 15 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" |
