HTML writer: fix bug with --number-offset.

This formerly caused section divs to be produced, even
when `--section-divs` was not specified.  Closes #8097.
This commit is contained in:
John MacFarlane 2022-06-02 08:46:26 -07:00
parent f53977e295
commit 98a1b921e3
2 changed files with 11 additions and 0 deletions

View file

@ -743,6 +743,8 @@ adjustNumbers opts doc =
then doc
else walk go doc
where
go (Div (ident,"section":classes,kvs) lst) =
Div (ident,"section":classes,map fixnum kvs) lst
go (Header level (ident,classes,kvs) lst) =
Header level (ident,classes,map fixnum kvs) lst
go x = x

9
test/command/8097.md Normal file
View file

@ -0,0 +1,9 @@
```
% pandoc --number-sec --number-offset=2 --wrap=none
# One
# two
^D
<h1 data-number="3" id="one"><span class="header-section-number">3</span> One</h1>
<h1 data-number="4" id="two"><span class="header-section-number">4</span> two</h1>
```