Commit Graph

4 Commits

Author SHA1 Message Date
John MacFarlane 03bb426a4a Shared: makeSections behavior changes.
+ When the optional base level parameter is provided, we no
  longer ensure that the sequence of heading levels is gapless
  [behavior change]. Instead, we set the lowest heading level to
  the specified base level, and adjust the others accordingly. If
  an author wants to skip a level, e.g. from level 1 to level 3,
  they can do that. In general, the heading levels specified
  in the source document are preserved; `makeSections` only
  puts them into a hierarchical structure. Closes #9398.

+ Section numbers are now assigned so that the top level
  gets `1`, no matter what heading level is used. So, even
  if the top heading level is 2, numbers will be `1`, `2`, etc.
  rather than `0.1`, `0.2`, as in the past. Closes #5071.

+ We revert to the old behavior when the `--number-offset` option
  is used. So, for example, if a document begins with a level-3
  heading, and `--number-offset=1,2` is used, the top-level section
  numbers will be `1.2.1`, `1.2.2`, etc. This is mainly for
  backwards-compatibility.
2024-02-03 22:19:29 -08:00
John MacFarlane 32b6db15dc Update lua tests for change to toTOCTree. 2024-01-30 08:05:25 -08:00
John MacFarlane c6551433b2 T.P.Chunks changes.
+ Re-use `toTocTree` in constructing `chunkedTOC`.
  Previously we used an entirely different function toTOCTree'.
+ Improve `tocToList` so that it avoids empty lists of
  items that are omitted because they are below the toc depth.

pandoc-lua-engine:

+ Fix structure tests in light of last change.

T.P.Writers.ChunkedHTML:

+ Reuse `tocToList` in `buildTOC`.

T.P.Writers.EPUB:

+ Adjust EPUB writer for Chunks changes.
2023-01-15 22:32:16 -08:00
Albert Krewinkel cdf8c69fb9 Lua: add module pandoc.structure.
Adds support for table of contents and chunks handling. The function
`make_sections` has been given a friendlier interface and was moved to
the new module; the old `pandoc.utils.make_sections` has been
deprecated.
2023-01-15 10:47:54 -08:00