summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarat Radchenko <marat@slonopotamus.org>2020-04-18 16:04:06 +0300
committerGitHub <noreply@github.com>2020-04-18 16:04:06 +0300
commit861afde5b6af28d43da62970f8a6c8aadd934cd6 (patch)
treec2024f1d7f2fb7d0aeffc5857f2f030175f498b5
parent1fa8d7c40e1098c9875752fd7ed295350054d3f6 (diff)
resolves #327 fix chapter files added twice to TOC when epub-chapter-level > 1 (#329)
-rw-r--r--data/samples/sample-book.adoc1
-rw-r--r--lib/asciidoctor-epub3/converter.rb11
2 files changed, 2 insertions, 10 deletions
diff --git a/data/samples/sample-book.adoc b/data/samples/sample-book.adoc
index db91ee2..3cf2aea 100644
--- a/data/samples/sample-book.adoc
+++ b/data/samples/sample-book.adoc
@@ -4,6 +4,7 @@ v1.0, 2014-04-15
:series-name: Asciidoctor EPUB3 Series
:series-volume: 2
:doctype: book
+:epub-chapter-level: 2
:producer: Asciidoctor
:keywords: Asciidoctor, samples, e-book, EPUB3, KF8, MOBI, Asciidoctor.js
:copyright: CC-BY-SA 3.0
diff --git a/lib/asciidoctor-epub3/converter.rb b/lib/asciidoctor-epub3/converter.rb
index 9ecd7fc..d970c58 100644
--- a/lib/asciidoctor-epub3/converter.rb
+++ b/lib/asciidoctor-epub3/converter.rb
@@ -142,14 +142,6 @@ module Asciidoctor
title
end
- def collect_toc_items node, into
- node.sections.each do |section|
- next if get_chapter_name(section).nil?
- into << section
- collect_toc_items section, into
- end
- end
-
def convert_document node
@format = node.attr('ebook-format').to_sym
@@ -231,8 +223,7 @@ module Asciidoctor
add_front_matter_page node
if node.doctype == 'book'
- toc_items = []
- collect_toc_items node, toc_items
+ toc_items = node.sections
node.content
else
toc_items = [node]