owenh000/asciidoctor-multipage

Lists in tables cause NPE

veselov opened this issue · 1 comments

With these files:
index.adoc

= Pirate Product Documentation

:toc:

:leveloffset: +1

include::index2.adoc[]

:leveloffset: -1

index2.adoc

= Pirate Backend
:leveloffset: +1

include::Configuration.adoc[]

:leveloffset: -1

Configuration.adoc

= Pirate Configuration Reference

== Value Specification

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

|===

Multipage, when invoked as:

$ asciidoctor -a multipage-level=2 --trace -v  -r asciidoctor-multipage -r asciidoctor-diagram -b multipage_html5 -D. -o index.html index.adoc

throws an NPE:

Traceback (most recent call last):
23: from /usr/bin/asciidoctor:23:in <main>' 22: from /usr/bin/asciidoctor:23:in load'
21: from /home/vps/.gem/ruby/gems/asciidoctor-2.0.15/bin/asciidoctor:15:in <top (required)>' 20: from /home/vps/.gem/ruby/gems/asciidoctor-2.0.15/lib/asciidoctor/cli/invoker.rb:113:in invoke!'
19: from /home/vps/.gem/ruby/gems/asciidoctor-2.0.15/lib/asciidoctor/cli/invoker.rb:113:in each' 18: from /home/vps/.gem/ruby/gems/asciidoctor-2.0.15/lib/asciidoctor/cli/invoker.rb:130:in block in invoke!'
17: from /home/vps/.gem/ruby/gems/asciidoctor-2.0.15/lib/asciidoctor/convert.rb:189:in convert_file' 16: from /home/vps/.gem/ruby/gems/asciidoctor-2.0.15/lib/asciidoctor/convert.rb:189:in open'
15: from /home/vps/.gem/ruby/gems/asciidoctor-2.0.15/lib/asciidoctor/convert.rb:189:in block in convert_file' 14: from /home/vps/.gem/ruby/gems/asciidoctor-2.0.15/lib/asciidoctor/convert.rb:123:in convert'
13: from /home/vps/.gem/ruby/gems/asciidoctor-2.0.15/lib/asciidoctor/document.rb:971:in write' 12: from /home/vps/.gem/ruby/gems/asciidoctor-multipage-0.0.9/lib/asciidoctor-multipage.rb:541:in write'
11: from /home/vps/.gem/ruby/gems/asciidoctor-multipage-0.0.9/lib/asciidoctor-multipage.rb:541:in each' 10: from /home/vps/.gem/ruby/gems/asciidoctor-multipage-0.0.9/lib/asciidoctor-multipage.rb:544:in block in write'
9: from /home/vps/.gem/ruby/gems/asciidoctor-multipage-0.0.9/lib/asciidoctor-multipage.rb:544:in open' 8: from /home/vps/.gem/ruby/gems/asciidoctor-multipage-0.0.9/lib/asciidoctor-multipage.rb:545:in block (2 levels) in write'
7: from /home/vps/.gem/ruby/gems/asciidoctor-2.0.15/lib/asciidoctor/document.rb:944:in convert' 6: from /home/vps/.gem/ruby/gems/asciidoctor-2.0.15/lib/asciidoctor/converter/html5.rb:84:in convert'
5: from /home/vps/.gem/ruby/gems/asciidoctor-multipage-0.0.9/lib/asciidoctor-multipage.rb:126:in convert_document' 4: from /home/vps/.gem/ruby/gems/asciidoctor-2.0.15/lib/asciidoctor/converter/html5.rb:218:in convert_document'
3: from /home/vps/.gem/ruby/gems/asciidoctor-2.0.15/lib/asciidoctor/converter/html5.rb:88:in convert' 2: from /home/vps/.gem/ruby/gems/asciidoctor-2.0.15/lib/asciidoctor/converter.rb:389:in convert'
1: from /home/vps/.gem/ruby/gems/asciidoctor-multipage-0.0.9/lib/asciidoctor-multipage.rb:408:in convert_outline' /home/vps/.gem/ruby/gems/asciidoctor-multipage-0.0.9/lib/asciidoctor-multipage.rb:252:in generate_outline': undefined method `level' for nil:NilClass (NoMethodError)

$ asciidoctor -v
Asciidoctor 2.0.15 [https://asciidoctor.org]
Runtime Environment (ruby 2.7.3p183 (2021-04-05 revision 6847ee089d) [x86_64-linux]) (lc:UTF-8 fs:UTF-8 in:UTF-8 ex:UTF-8)

Unfortunately, the fix is not complete. At least I think so. Anyway, I'll open another issue for this once I have a clear cut test case.

In short, what I observe so far is that the ToC that is expected to be displayed at the top of the document gets cut off once viewing the section that had the offending nesting, or any sections that follow it.