Generate valid first level table of content for ebook

This commit is contained in:
Samy Pessé
2014-05-29 17:28:18 +02:00
parent 46321fffd9
commit 5c3b345fa6
2 changed files with 4 additions and 29 deletions
+2 -1
View File
@@ -34,7 +34,8 @@ Generator.prototype.finish = function() {
}
var _options = {
"--cover": that.options.cover
"--cover": that.options.cover,
"--chapter": "\"descendant-or-self::*[contains(concat(' ', normalize-space(@class), ' '), ' book-chapter ')]\""
};
var command = [
+2 -28
View File
@@ -39,32 +39,6 @@
{% endif %}
</section>
{# Summary #}
<section id="summary">
<h1>Table of Contents</h1>
<ol>
<li>
<a href="#README.md">
<h2>Introduction</h2>
</a>
</li>
{% for item in summary.chapters %}
<li>
<h2><span>{{ item.level }}.</span> <a href="#{{ item.path }}">{{ item.title }}</a></h2>
{% if item.articles.length > 0 %}
<ol>
{% for article in item.articles %}
<li>
<span>{{ article.level }}</span> <a href="#{{ article.path }}">{{ article.title }}</a>
</li>
{% endfor %}
</ol>
{% endif %}
</li>
{% endfor %}
</ol>
</section>
{# Pages content #}
<section>
<article id="README.md">
@@ -74,7 +48,7 @@
{% for item in summary.chapters %}
<section>
<article id="{{ item.path }}" class="new-chapter">
<h1>{{ item.title }}</h1>
<h1 class="book-chapter">{{ item.title }}</h1>
</article>
{% if pages[item.path] %}
@@ -101,7 +75,7 @@
{% set exercise = 1 %}
<section>
<article class="new-chapter">
<h1>Exercise Solutions</h1>
<h1 class="book-chapter">Exercise Solutions</h1>
</article>
<article>
{% for item in summary.chapters %}