mirror of
https://git.pumpin.online/funkpower/catena.git
synced 2026-10-23 03:07:13 +00:00
chunkmd, mdscrub: the chapter a converted book is actually divided by
Two things between a converted EPUB and its chapter titles.
The heading level taken as the chapter map was the shallowest present. Pandoc
writes the book's title as the only `#` and every real chapter as a `##`, so
the shallowest level had one heading in it and the whole book came back as a
single chapter. The dividing level is now the shallowest one used more than
once — a level used once is a title.
And an empty bracketed span survived the heading cleaner, because the pattern
wanted at least one character between the brackets. Pandoc writes an anchor
as exactly that: `## []{#link2H_INTR} Introduction`.
Gibbon's first volume, converted from the Project Gutenberg EPUB: 2 distinct
chapter titles before, 61 after, and none of them carrying an element id.
This commit is contained in:
@@ -93,6 +93,11 @@ library.
|
||||
The chapter a passage carries is the nearest heading above the point the
|
||||
passage *starts*, found by byte offset into the source.
|
||||
|
||||
The heading level that divides a document is the shallowest one used more
|
||||
than once, not simply the shallowest one present: a converted EPUB carries the
|
||||
book's title as a lone `#` above sixty-two `##` chapters, and a level used
|
||||
once is a title rather than a chapter map.
|
||||
|
||||
The offset has to be the passage's own. A document with no page markers is a
|
||||
single page beginning at zero, so asking where the *page* started puts every
|
||||
chunk in the book under whichever heading came first in the file — which also
|
||||
|
||||
Reference in New Issue
Block a user