asciidoctor / asciidoctor-bibtex

Add bibtex citation support for asciidoc documents
Other
69 stars 27 forks source link

Bug concerning nested lists with version 2.6.0 #58

Closed pela9 closed 4 years ago

pela9 commented 5 years ago

Given the following input (which asciidoctor without asciidoctor-bibtex accepts)

FIRST ITEM ::
* This is a nested bullet1
* This is a nested bullet2
SECOND ITEM ::
1. This is a nested enumerated item
2. This is a nested enumerated item2

With asciidoctor-bibtex loaded it throws an error. Using the --trace option I get a stacktrace with last line:

/pela/.gem/ruby/2.6.0/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor- 
bibtex/extensions.rb:114:in  `block in process': asciidoctor: FAILED: 
/home/pela/svnroot/QAG/dcs-make/sample/sample.txt: 
Failed to load AsciiDoc document - undefined method `empty?' for nil:NilClass 
(NoMethodError)

So it seems there is a missing null test somewhere in this code?

mojavelinux commented 5 years ago

The model for a description list item is different than the model for a regular list item. That's likely the problem. Each description list entry is a 2-d array of list items. The code needs to account for this.

See https://github.com/asciidoctor/asciidoctor/blob/master/lib/asciidoctor/converter/html5.rb#L526-L535

pela9 commented 5 years ago

It would be really helpful if this bug could get some attention. Presently it hinders the use of all versions of asciidoctor-bibtex > 0.4.1. As @mojavelinux have commented above this should not be too serious to fix. I have for myself made a minimal fix in 0.6.0 that adds a simple null test and thereby avoids the exception (but don't find citations in the nested content), but my colleagues are dependent on gem install.

ProgramFan commented 5 years ago

An PR is welcome.

ghobona commented 3 years ago

I had the same issue and solved it by updating asciidoctor-bibtex through the following:

gem install asciidoctor-bibtex

I am running Asciidoctor 2.0.12 on macOS Catalina.