Binder levels can break auto-ToC for EPub3

Hi, if I have 3 levels in the binder, the HTML of the auto-generated contents.xhtml is invalid:

<!DOCTYPE html>
<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">
<head>
	<meta charset="utf-8"/>
	<title>Contents</title>
	<link type="text/css" rel="stylesheet" href="css/stylesheet.css"/>
</head>
<body>

<nav epub:type="toc" id="toc">
<h2 class="title">Contentz</h2>
<ol>
<p style="text-align: left"><li><a href="body.xhtml">Chapter One - Methods</a></p>
<ol>
<p style="text-align: left"><li><a href="body1.xhtml">Chapter Two - General Details</a></p>
<ol>
<p style="text-align: left"><li><a href="body2.xhtml">Chapter Three - Analysis—1</a></li></p>
<p style="text-align: left"><li><a href="body3.xhtml">Chapter Four - Analysis—2</a></li></p>
<p style="text-align: left"><li><a href="body4.xhtml">Chapter Five - Analysis—3</a></li></p>
</ol>

<p></li></p>
</ol>

<p></li></p>
</ol>
</nav>

</body>
</html>

The problem is the

  • elements are wrapped in

    elements but you close the

    before you close the
  • . The

    is triggered by some compile setting…

    I can’t reproduce this. Can you please attach a sample project showing the issue?

    Attached. This seems to be triggered by some setting in the Project Compile format “Ebook Code” (which was duplicated from the standard “Ebook” format, which doesn’t trigger this rogue

    code). I’ve tried toggling things around in that format but can’t find what triggers it…

    Blank3.scriv.zip (732 KB)

    This should be fixed for 3.0.1.