Skip to content

Commit

Permalink
Allow --number-sections to take an optional true|false argument.
Browse files Browse the repository at this point in the history
This was omitted when we allowed this for other boolean flags.
  • Loading branch information
jgm committed Jul 28, 2024
1 parent 6c43c03 commit d299328
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion MANUAL.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ header when requesting a document from a URL:
headings to become `\part{..}`, while second-level headings
remain as their default type.

`-N`, `--number-sections`
`-N`, `--number-sections=[true|false]`

: Number section headings in LaTeX, ConTeXt, HTML, Docx, ms, or EPUB
output. By default, sections are not numbered. Sections with class
Expand Down
7 changes: 5 additions & 2 deletions src/Text/Pandoc/App/CommandLineOptions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,11 @@ options =
"" -- "Number of levels to include in TOC"

, Option "N" ["number-sections"]
(NoArg
(\opt -> return opt { optNumberSections = True }))
(OptArg
(\arg opt -> do
boolValue <- readBoolFromOptArg "--number-sections/-N" arg
return opt { optNumberSections = boolValue })
"true|false")
"" -- "Number sections"

, Option "" ["number-offset"]
Expand Down

0 comments on commit d299328

Please sign in to comment.