Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #13 #14

Merged
merged 1 commit into from
Jun 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/asciidoctor-multipage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def generate_nav_links(doc)
# Html5Converter convert_outline().
def generate_outline(node, opts = {})
# Do the same as Html5Converter convert_outline() here
return unless node.sections?
return unless node.sections? && node.sections.length > 0
sectnumlevels = opts[:sectnumlevels] || (node.document.attributes['sectnumlevels'] || 3).to_i
toclevels = opts[:toclevels] || (node.document.attributes['toclevels'] || 2).to_i
sections = node.sections
Expand Down
45 changes: 45 additions & 0 deletions test/black-box-docs/list-in-table/_oops.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<div id="toc" class="toc">
<div id="toctitle">Table of Contents</div>
<p><span class="toc-root"><a href="list-in-table.html">TOP</a></span></p><ul class="sectlevel1">
<li><a href="_second.html">SECOND</a>
<ul class="sectlevel2">
<li><a href="_oops.html"><span class="toc-current">OOPS</span></a>
</li>
</ul>
</li>
</ul>
</div>
<div class="sect2">
<h3 id="_oops">OOPS</h3>
<div class="sect3">
<h4 id="_danger">DANGER</h4>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">abc.${ext}</p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="ulist">
<ul>
<li>
<p>item</p>
</li>
</ul>
</div>
<div class="ulist">
<ul>
</ul>
</div>
<div class="paragraph nav-footer">
<p></p>
</div></div></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="paragraph nav-footer">
<p>↑ Up: <a href="_second.html">SECOND</a> | ⌂ Home: <a href="list-in-table.html">TOP</a></p>
</div>
19 changes: 19 additions & 0 deletions test/black-box-docs/list-in-table/_second.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<div id="toc" class="toc">
<div id="toctitle">Table of Contents</div>
<p><span class="toc-root"><a href="list-in-table.html">TOP</a></span></p>
</div>
<div class="sect1">
<h2 id="_second">SECOND</h2>
<div class="sectionbody">
<div class="ulist">
<ul>
<li>
<p><a href="_oops.html">OOPS</a></p>
</li>
</ul>
</div>
</div>
</div>
<div class="paragraph nav-footer">
<p>↑ Up: <a href="list-in-table.html">TOP</a> | Next: <a href="_oops.html">OOPS</a> →</p>
</div>
16 changes: 16 additions & 0 deletions test/black-box-docs/list-in-table/list-in-table.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
= TOP

:toc:

== SECOND

=== OOPS

==== DANGER

[cols=","]
|===
|abc.$\{ext} a|
* item

|===
1 change: 1 addition & 0 deletions test/black-box-docs/list-in-table/list-in-table.attr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
multipage-level: 2
17 changes: 17 additions & 0 deletions test/black-box-docs/list-in-table/list-in-table.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<div id="toc" class="toc">
<div id="toctitle">Table of Contents</div>
<p><span class="toc-root toc-current"><a href="list-in-table.html">TOP</a></span></p><ul class="sectlevel1">
<li><a href="_second.html">SECOND</a>
</li>
</ul>
</div>
<div class="ulist">
<ul>
<li>
<p><a href="_second.html">SECOND</a></p>
</li>
</ul>
</div>
<div class="paragraph nav-footer">
<p>Next: <a href="_second.html">SECOND</a> →</p>
</div>
10 changes: 9 additions & 1 deletion test/test_asciidoctor-multipage.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'minitest/autorun'
require 'asciidoctor'
require 'yaml'
require 'asciidoctor-multipage'

class AsciidoctorMultipageTest < Minitest::Test
Expand All @@ -8,12 +9,19 @@ def test_black_box_docs
Dir.foreach(dir) do |filename|
next if filename == '.' or filename == '..'
doc_path = File.join(dir, filename)
next if !File.directory?(doc_path)
next unless File.directory?(doc_path)
adoc_path = File.join(doc_path, filename + '.adoc')
attr_path = File.join(doc_path, filename + '.attr.yaml')
if File.exist?(attr_path)
attr = YAML.load_file(attr_path)
else
attr = {}
end
doc = Asciidoctor.convert_file(adoc_path,
:to_dir => 'test/out',
:to_file => true,
:header_footer => false,
:attributes => attr,
:backend => 'multipage_html5')
pages = [doc] + doc.converter.pages
pages.each do |page|
Expand Down