Fix regression in section numbering.

Starting with pandoc 3.1.12, unnumbered sections incremented
the section number.

Closes #9516.
This commit is contained in:
John MacFarlane
2024-02-28 11:27:34 -08:00
parent 87b07c699a
commit cd460ec9c7
2 changed files with 18 additions and 1 deletions
+1 -1
View File
@@ -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
+17
View File
@@ -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>
```