asciidoctor / asciidoctor-bibtex

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

Error creating html for file with definition list #62

Closed habamax closed 5 years ago

habamax commented 5 years ago

With the following test.adoc:

= Test doc

== Test

DefList:: 
    * List item

and the command asciidoctor -r asciidoctor-bibtex test.adoc I get following record:

asciidoctor: FAILED: C:/Users/maksim.kim/docs/test.adoc: Failed to load AsciiDoc document - undefined method `empty?' for nil:NilClass
  Use --trace for backtrace

The same error is with asciidoctor-pdf.

PS

with --trace I get:

Traceback (most recent call last):
        17: from C:/prg/Ruby26-x64/bin/asciidoctor:23:in `<main>'
        16: from C:/prg/Ruby26-x64/bin/asciidoctor:23:in `load'
        15: from C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/bin/asciidoctor:15:in `<top (required)>'
        14: from C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in `invoke!'
        13: from C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in `each'
        12: from C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:128:in `block in invoke!'
        11: from C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `convert_file'
        10: from C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `open'
         9: from C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `block in convert_file'
         8: from C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:78:in `convert'
         7: from C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/load.rb:83:in `load'
         6: from C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:555:in `parse'
         5: from C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:555:in `each'
         4: from C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:556:in `block in parse'
         3: from C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:556:in `[]'
         2: from C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/extensions.rb:110:in `process'
         1: from C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/extensions.rb:110:in `each'
C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/extensions.rb:114:in `block in process': undefined method `empty?' for nil:NilClass (NoMethodError)
        17: from C:/prg/Ruby26-x64/bin/asciidoctor:23:in `<main>'
        16: from C:/prg/Ruby26-x64/bin/asciidoctor:23:in `load'
        15: from C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/bin/asciidoctor:15:in `<top (required)>'
        14: from C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in `invoke!'
        13: from C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in `each'
        12: from C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:128:in `block in invoke!'
        11: from C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `convert_file'
        10: from C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `open'
         9: from C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `block in convert_file'
         8: from C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:78:in `convert'
         7: from C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/load.rb:83:in `load'
         6: from C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:555:in `parse'
         5: from C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:555:in `each'
         4: from C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:556:in `block in parse'
         3: from C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:556:in `[]'
         2: from C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/extensions.rb:110:in `process'
         1: from C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/extensions.rb:110:in `each'
C:/prg/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/extensions.rb:114:in `block in process': asciidoctor: FAILED: C:/Users/maksim.kim/docs/test.adoc: Failed to load AsciiDoc document - undefined method `empty?' for nil:NilClass (NoMethodError)
habamax commented 5 years ago

There is no error if I add text to DefList line:

= Test doc

== Test

DefList:: hello
    * List item

Looks like block.instance_variable_get(:@text) is nil for a deflist without immediate text on the same line: https://github.com/asciidoctor/asciidoctor-bibtex/blob/1d1f66740bc059c22ade965cb6ec5a70ffea7519/lib/asciidoctor-bibtex/extensions.rb#L114-L115

habamax commented 5 years ago

and it is duplicate #58

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.