mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-28 17:20:47 +08:00
Fix regression in section numbering.
Starting with pandoc 3.1.12, unnumbered sections incremented the section number. Closes #9516.
This commit is contained in:
@@ -529,7 +529,7 @@ makeSections numbering mbBaseLevel bs =
|
||||
| otherwise = 0
|
||||
let newnum = zipWith adjustNum [minLevel..level]
|
||||
(lastnum ++ repeat 0)
|
||||
unless (null newnum) $ S.put newnum
|
||||
unless (null newnum || "unnumbered" `elem` classes) $ S.put newnum
|
||||
let (sectionContents, rest) = break (headerLtEq level) xs
|
||||
sectionContents' <- go sectionContents
|
||||
rest' <- go rest
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
```
|
||||
% pandoc --number-sections
|
||||
# One {-}
|
||||
|
||||
# Two
|
||||
|
||||
# Three {-}
|
||||
|
||||
# Four
|
||||
^D
|
||||
<h1 class="unnumbered" id="one">One</h1>
|
||||
<h1 data-number="1" id="two"><span
|
||||
class="header-section-number">1</span> Two</h1>
|
||||
<h1 class="unnumbered" id="three">Three</h1>
|
||||
<h1 data-number="2" id="four"><span
|
||||
class="header-section-number">2</span> Four</h1>
|
||||
```
|
||||
Reference in New Issue
Block a user