nlbdev / nordic-epub3-dtbook-migrator

Tools for converting between a strict subset of DTBook and EPUB3.
http://nlbdev.github.io/nordic-epub3-dtbook-migrator/
GNU Lesser General Public License v2.1
8 stars 7 forks source link

Parts in different files #532

Open kalaspuffar opened 1 year ago

kalaspuffar commented 1 year ago

Reported by MTM to Textalk:

When parts are included in epub-files the following error occurs:

[nordic_nav_references_2b] The nesting of headlines in the content does not match the nesting of headlines in the navigation document. The toc item `(<a href="V005259-011-chapter.xhtml#level2_1">)` in the navigation document is not nested at the correct level. The referenced document (V005259-011-chapter.xhtml) occurs in the navigation document at nesting depth 2 (it is contained inside "DEL 1 PLANERING"). The referenced headline (V005259-011-chapter.xhtml#level2_1) occurs in the navigation document at nesting depth 2 (it is contained inside "DEL 1 PLANERING"). The referenced headline (`<h2 id="h2_1">Vem skriver du f?r?</h2>) occurs in the content document V005259-011-chapter.xhtml as a `h2` which implies that it should be referenced at nesting depth 3 in the navigation document.

After some investigation, I noticed that the check between files was not correctly implemented. It seems to require us to restart the heading levels when we switch to a new level. Currently looking for a solution.

Example table of contents:

                <li>
                    <a href="C00000-13-part.xhtml#test-part">
                        <span>Part title</span>
                    </a>
                    <ol>
                        <li>
                            <a href="C00000-14-chapter.xhtml#test-chapter">
                                <span>Chapter title</span>
                            </a>
                        </li>
                    </ol>
                </li>

Today we only accept the two files to have similar construction

    <body epub:type="bodymatter part" id="test-part">
        <h1>Part title</h1>
        <p>Part testing in different files</p>
    </body>

and

    <body epub:type="bodymatter chapter" id="test-chapter">
        <h1>Chapter title</h1>
        <p>Chapter testing in different files</p>
    </body>

Notice that the chapter file should have a heading level of h2