<?xml version="1.0" encoding="UTF-8"?>
<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1">
    <head>
        <meta name="dtb:uid" content="<%= id %>" />
        <meta name="dtb:generator" content="epub-gen"/>
        <meta name="dtb:depth" content="1"/>
        <meta name="dtb:totalPageCount" content="0"/>
        <meta name="dtb:maxPageNumber" content="0"/>
    </head>
    <docTitle>
        <text><%= title %></text>
    </docTitle>
    <docAuthor>
        <text><%= author %></text>
    </docAuthor>
    <navMap><% var _index = 0; %>
        <% content.forEach(function(content, index){ %><% if(!content.excludeFromToc && content.beforeToc){ %>
                <navPoint id="content_<%= index %>_<%= content.id %>" playOrder="<%= _index++ %>" class="chapter">
                    <navLabel>
                        <text><%= (1+index) + ". " + (content.title || "Chapter " + (1+index))%></text>
                    </navLabel>
                    <content src="<%= content.href %>"/>
                </navPoint>
            <% } %><% }) %>
        <navPoint id="toc" playOrder="<%= _index++ %>" class="chapter">
            <navLabel>
                <text><%= tocTitle %></text>
            </navLabel>
            <content src="toc.xhtml"/>
        </navPoint>
<% content.forEach(function(content, index){ %><% if(!content.excludeFromToc && !content.beforeToc){ %>
        <navPoint id="content_<%= index %>_<%= content.id %>" playOrder="<%= _index++ %>" class="chapter">
            <navLabel>
                <text><%= (1+index) + ". " + (content.title || "Chapter " + (1+index))%></text>
            </navLabel>
            <content src="<%= content.href %>"/><% if(content.childs || content.childTitles){ %>
        <% if(content.childTitles) { content.childTitles.forEach(function(child, childIndex){ %>
            <navPoint id="content_<%= index %>_<%= childIndex %>" playOrder="<%= _index++ %>" class="chapter">
                <navLabel>
                    <text><%= (1+index) +"_"+(1+childIndex) +". " + child.title%></text>
                </navLabel>
                <content src="<%= content.href %>#<%= child.anchor %>"/>
            </navPoint>
        <% }) }%>
        <% if(content.childs) { content.childs.forEach(function(child, childIndex){ %>
            <navPoint id="content_<%= index %>_<%= childIndex %>_<%= child.id %>" playOrder="<%= _index++ %>" class="chapter">
                <navLabel>
                    <text><%= (1+index) +"."+(1+childIndex) +". " + (child.title || "Chapter "+(1+index)+"_"+(1+childIndex))%></text>
                </navLabel>
                <content src="<%= child.href %>"/>
            </navPoint>
        <% }) }%><% } %>
        </navPoint>
    <% } %>
<% }) %>
    </navMap>
</ncx>