asciidoctor / asciidoctor-bibtex

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

Failed to load AsciiDoc document - undefined method `ref' #65

Closed ghobona closed 4 years ago

ghobona commented 4 years ago

Asciidoctor-bibtex version 0.6.0, on Mac, produces this error message for all errors, including when a cited document is not found in the bibles file.

$ asciidoctor -a stylesdir=./resources/stylesheets -a stylesheet=rocket-panda.css -r asciidoctor-bibtex --trace er.adoc
Traceback (most recent call last):
    29: from /Users/coder/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `<main>'
    28: from /Users/coder/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `eval'
    27: from /Users/coder/.rvm/gems/ruby-2.6.3/bin/asciidoctor:23:in `<main>'
    26: from /Users/coder/.rvm/gems/ruby-2.6.3/bin/asciidoctor:23:in `load'
    25: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/bin/asciidoctor:15:in `<top (required)>'
    24: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in `invoke!'
    23: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in `each'
    22: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:128:in `block in invoke!'
    21: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `convert_file'
    20: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `open'
    19: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `block in convert_file'
    18: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:78:in `convert'
    17: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/load.rb:83:in `load'
    16: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:555:in `parse'
    15: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:555:in `each'
    14: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:556:in `block in parse'
    13: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:556:in `[]'
    12: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/extensions.rb:110:in `process'
    11: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/extensions.rb:110:in `each'
    10: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/extensions.rb:119:in `block in process'
     9: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/extensions.rb:119:in `each_with_index'
     8: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/extensions.rb:119:in `each'
     7: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/extensions.rb:120:in `block (2 levels) in process'
     6: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/processor.rb:113:in `replace_citation_macros'
     5: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/processor.rb:113:in `each'
     4: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/processor.rb:114:in `block in replace_citation_macros'
     3: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/processor.rb:193:in `build_citation_text'
     2: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/processor.rb:193:in `each_with_index'
     1: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/processor.rb:193:in `each'
/Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/processor.rb:205:in `block in build_citation_text': undefined method `ref' for #<AsciidoctorBibtex::CitationItem:0x00007fec59b2a528> (NoMethodError)
Did you mean?  def
    29: from /Users/coder/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `<main>'
    28: from /Users/coder/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `eval'
    27: from /Users/coder/.rvm/gems/ruby-2.6.3/bin/asciidoctor:23:in `<main>'
    26: from /Users/coder/.rvm/gems/ruby-2.6.3/bin/asciidoctor:23:in `load'
    25: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/bin/asciidoctor:15:in `<top (required)>'
    24: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in `invoke!'
    23: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in `each'
    22: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:128:in `block in invoke!'
    21: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `convert_file'
    20: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `open'
    19: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `block in convert_file'
    18: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:78:in `convert'
    17: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/load.rb:83:in `load'
    16: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:555:in `parse'
    15: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:555:in `each'
    14: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:556:in `block in parse'
    13: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:556:in `[]'
    12: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/extensions.rb:110:in `process'
    11: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/extensions.rb:110:in `each'
    10: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/extensions.rb:119:in `block in process'
     9: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/extensions.rb:119:in `each_with_index'
     8: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/extensions.rb:119:in `each'
     7: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/extensions.rb:120:in `block (2 levels) in process'
     6: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/processor.rb:113:in `replace_citation_macros'
     5: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/processor.rb:113:in `each'
     4: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/processor.rb:114:in `block in replace_citation_macros'
     3: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/processor.rb:193:in `build_citation_text'
     2: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/processor.rb:193:in `each_with_index'
     1: from /Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/processor.rb:193:in `each'
/Users/coder/.rvm/gems/ruby-2.6.3/gems/asciidoctor-bibtex-0.6.0/lib/asciidoctor-bibtex/processor.rb:205:in `block in build_citation_text': asciidoctor: FAILED: /Users/coder/Documents/workspace/mydocument/er.adoc: Failed to load AsciiDoc document - undefined method `ref' for #<AsciidoctorBibtex::CitationItem:0x00007fec59b2a528> (NoMethodError)
Did you mean?  def

Ideally the error message should be more narrative and descriptive.

ghobona commented 4 years ago

I'm using asciidoctor 2.0.10

$ asciidoctor --version
Asciidoctor 2.0.10 [https://asciidoctor.org]
Runtime Environment (ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin16]) (lc:UTF-8 fs:UTF-8 in:UTF-8 ex:UTF-8)
mojavelinux commented 4 years ago

Ideally the error message should be more narrative and descriptive.

I don't necessarily agree. This is a program fault, which means it should not happen. So the stacktrace is exactly what you want because it should be reported (as you did), then fixed. Error messages only need to be narrative and descriptive when they are expected in the normal operation of the program.

ProgramFan commented 4 years ago

I will look into this issue.