Code Monkey home page Code Monkey logo

Comments (31)

ProgramFan avatar ProgramFan commented on June 3, 2024 1

You can now use v0.6.0 from rubygems where the bug is fixed.

from asciidoctor-bibtex.

CharlesTBetz avatar CharlesTBetz commented on June 3, 2024

If someone provides some basic pointers on using the Ruby debugger, we might be able to work this more on our end.

from asciidoctor-bibtex.

mojavelinux avatar mojavelinux commented on June 3, 2024

@CharlesTBetz Thanks for taking the time to report this issue.

Can you explain how to use asciidoctor-bibtex? Where do I need to put the bibtex files that you cited and what AsciiDoc do I need so they get used? It's not clear to me from the README how to actually use this extension. (I understand how to load an extension in general, so I'm not asking about that part).

from asciidoctor-bibtex.

CharlesTBetz avatar CharlesTBetz commented on June 3, 2024

Sure! The inline syntax is cite:[refkey] with refkey being the Bibtex ID (e.g. Landis2011).

Install via gem install as you probably know, and syntax for using is simply

asciidoctor-pdf --trace -v -r asciidoctor-bibtex -D outputdir -o filename.pdf spineFile.adoc

References show up wherever you put bibliography::[].

Spine file commands:

:bibtex-file: somefile.bib
:bibtex-style: ieee
//:bibtex-style: harvard1
:bibtex-order: alphabetical

from asciidoctor-bibtex.

mojavelinux avatar mojavelinux commented on June 3, 2024

Perfect! Just what I needed to know. I'll give that a try. That should give me enough to figure out what the issue is, even if I don't get the error (I can just imagine what might go wrong).

from asciidoctor-bibtex.

mojavelinux avatar mojavelinux commented on June 3, 2024

As for the Ruby debugger, I don't use one myself. I guess you could say I run it in my head. But I know I'm weird like that.

The best Ruby debugger to my knowledge is RubyMine. I have used it once before and I remember it being rather easy to set up.

from asciidoctor-bibtex.

CharlesTBetz avatar CharlesTBetz commented on June 3, 2024

well, I'm open to going down that road if it makes sense

from asciidoctor-bibtex.

mojavelinux avatar mojavelinux commented on June 3, 2024

I'd say go for it.

from asciidoctor-bibtex.

ProgramFan avatar ProgramFan commented on June 3, 2024

Have you tried this on asciidoctor-bibtex 0.4.1? It seems you are using asciidoctor-bibtex 0.3.1.

from asciidoctor-bibtex.

ProgramFan avatar ProgramFan commented on June 3, 2024

I would suggest upgrading to ruby 2.6 and try the latest master. A similar issue happened before (#20) but disappears in master with ruby 2.6.0 on macOS.

from asciidoctor-bibtex.

ProgramFan avatar ProgramFan commented on June 3, 2024

Closed as being not reproducible. Re-open if needed.

from asciidoctor-bibtex.

CharlesTBetz avatar CharlesTBetz commented on June 3, 2024

from asciidoctor-bibtex.

mojavelinux avatar mojavelinux commented on June 3, 2024

We should expect this to continue failing until CI is set up. I just activated it on the repository, but there is no CI configuration file, so no tests are going to run until that's in place.

from asciidoctor-bibtex.

mojavelinux avatar mojavelinux commented on June 3, 2024

Although they don't run in CI, the tests do seem to work locally using rake test. Can you propose a failing test?

from asciidoctor-bibtex.

CharlesTBetz avatar CharlesTBetz commented on June 3, 2024

from asciidoctor-bibtex.

CharlesTBetz avatar CharlesTBetz commented on June 3, 2024

from asciidoctor-bibtex.

ajosey avatar ajosey commented on June 3, 2024

I also checked with asciidoctor-bibtex-0.5.2 and the same problem occurs still.

I've now running the builds in a docker image, which may help to isolate/reproduce. We need to reduce what we are building to the minimum to show the error.

Are there any ways to switch on more trace/debug within asciidoctor-bibtex?

This is what we get
/usr/lib/ruby/gems/2.5.0/gems/asciidoctor-bibtex-0.5.2/lib/asciidoctor-bibtex/Processor.rb:91:in sort_by': asciidoctor: FAILED: /documents/_OG-full-pdf.adoc: Failed to load AsciiDoc document - comparison of Array with Array failed (ArgumentError) from /usr/lib/ruby/gems/2.5.0/gems/asciidoctor-bibtex-0.5.2/lib/asciidoctor-bibtex/Processor.rb:91:in finalize_macro_processing'
from /usr/lib/ruby/gems/2.5.0/gems/asciidoctor-bibtex-0.5.2/lib/asciidoctor-bibtex/extensions.rb:107:in process' from /usr/lib/ruby/gems/2.5.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:556:in []'
from /usr/lib/ruby/gems/2.5.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:556:in block in parse' from /usr/lib/ruby/gems/2.5.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:555:in each'
from /usr/lib/ruby/gems/2.5.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:555:in parse' from /usr/lib/ruby/gems/2.5.0/gems/asciidoctor-2.0.10/lib/asciidoctor/load.rb:83:in load'
from /usr/lib/ruby/gems/2.5.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:78:in convert' from /usr/lib/ruby/gems/2.5.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in block in convert_file'
from /usr/lib/ruby/gems/2.5.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in open' from /usr/lib/ruby/gems/2.5.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in convert_file'
from /usr/lib/ruby/gems/2.5.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:128:in block in invoke!' from /usr/lib/ruby/gems/2.5.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in each'
from /usr/lib/ruby/gems/2.5.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in invoke!' from /usr/lib/ruby/gems/2.5.0/gems/asciidoctor-pdf-1.5.0.beta.3/bin/asciidoctor-pdf:32:in <top (required)>'
from /usr/bin/asciidoctor-pdf:23:in load' from /usr/bin/asciidoctor-pdf:23:in

'

Environment:

uname -a
Linux e87033ff6b78 4.9.184-linuxkit #1 SMP Tue Jul 2 22:58:16 UTC 2019 x86_64 Linux

ruby -v
ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux-musl]

asciidoctor --version
Asciidoctor 2.0.10 [https://asciidoctor.org]
Runtime Environment (ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux-musl]) (lc:UTF-8 fs:UTF-8 in:UTF-8 ex:UTF-8)

asciidoctor-pdf --version
Asciidoctor PDF 1.5.0.beta.3 using Asciidoctor 2.0.10 [https://asciidoctor.org]
Runtime Environment (ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux-musl]) (lc:UTF-8 fs:UTF-8 in:UTF-8 ex:UTF-8)

from asciidoctor-bibtex.

ProgramFan avatar ProgramFan commented on June 3, 2024

The error looks strange. Line 91 of Processor.rb does not compare array with arrays, it just sorts an array of string. And no errors are found on ruby 2.6.

from asciidoctor-bibtex.

ajosey avatar ajosey commented on June 3, 2024

I get the same issue with ruby 2.6

$ /usr/local/bin/ruby --version
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
$ export PATH=/usr/local/bin/:pwd/gems/bin:$PATH
$ mkdir gems
$ export GEM_HOME=pwd/gems
$ gem install asciidoctor
Successfully installed asciidoctor-2.0.10
Parsing documentation for asciidoctor-2.0.10
Installing ri documentation for asciidoctor-2.0.10
Done installing documentation for asciidoctor after 2 seconds
1 gem installed
$ gem install asciidoctor-bibtex
Successfully installed asciidoctor-bibtex-0.5.2
Parsing documentation for asciidoctor-bibtex-0.5.2
Installing ri documentation for asciidoctor-bibtex-0.5.2
Done installing documentation for asciidoctor-bibtex after 0 seconds
1 gem installed
$ gem install asciidoctor-pdf --pre
Successfully installed prawn-icon-2.4.0
Successfully installed asciidoctor-pdf-1.5.0.beta.3
Parsing documentation for prawn-icon-2.4.0
Installing ri documentation for prawn-icon-2.4.0
Parsing documentation for asciidoctor-pdf-1.5.0.beta.3
Installing ri documentation for asciidoctor-pdf-1.5.0.beta.3
Done installing documentation for prawn-icon, asciidoctor-pdf after 1 seconds
2 gems installed
$ gem install unicode_utils
Successfully installed unicode_utils-1.4.0
Parsing documentation for unicode_utils-1.4.0
Installing ri documentation for unicode_utils-1.4.0
Done installing documentation for unicode_utils after 0 seconds
1 gem installed
$ asciidoctor --version
Asciidoctor 2.0.10 [https://asciidoctor.org]
Runtime Environment (ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]) (lc:UTF-8 fs:UTF-8 in:UTF-8 ex:UTF-8)
$ find gems/bin -print
gems/bin
gems/bin/asciidoctor
gems/bin/asciidoctor-pdf
$ asciidoctor-pdf --version
Asciidoctor PDF 1.5.0.beta.3 using Asciidoctor 2.0.10 [https://asciidoctor.org]
Runtime Environment (ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]) (lc:UTF-8 fs:UTF-8 in:UTF-8 ex:UTF-8)

$ asciidoctor-pdf --trace -v -r asciidoctor-bibtex -D output/pdf -o DPBoK.pdf _OG-full-pdf.adoc

/home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-bibtex-0.5.2/lib/asciidoctor-bibtex/Processor.rb:91:in sort_by': asciidoctor: FAILED: /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/_OG-full-pdf.adoc: Failed to load AsciiDoc document - comparison of Array with Array failed (ArgumentError) from /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-bibtex-0.5.2/lib/asciidoctor-bibtex/Processor.rb:91:in finalize_macro_processing'
from /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-bibtex-0.5.2/lib/asciidoctor-bibtex/extensions.rb:107:in process' from /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:556:in []'
from /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:556:in block in parse' from /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:555:in each'
from /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:555:in parse' from /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/load.rb:83:in load'
from /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:78:in convert' from /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in block in convert_file'
from /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in open' from /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in convert_file'
from /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:128:in block in invoke!' from /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in each'
from /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in invoke!' from /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-pdf-1.5.0.beta.3/bin/asciidoctor-pdf:32:in <top (required)>'
from /usr/local/bin/asciidoctor-pdf:23:in load' from /usr/local/bin/asciidoctor-pdf:23:in

'
/home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-bibtex-0.5.2/lib/asciidoctor-bibtex/Processor.rb:91:in sort_by': comparison of Array with Array failed (ArgumentError) from /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-bibtex-0.5.2/lib/asciidoctor-bibtex/Processor.rb:91:in finalize_macro_processing'
from /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-bibtex-0.5.2/lib/asciidoctor-bibtex/extensions.rb:107:in process' from /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:556:in []'
from /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:556:in block in parse' from /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:555:in each'
from /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:555:in parse' from /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/load.rb:83:in load'
from /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:78:in convert' from /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in block in convert_file'
from /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in open' from /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in convert_file'
from /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:128:in block in invoke!' from /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in each'
from /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in invoke!' from /home/gitlab-runner/builds/PxJheMGA/0/digital-practitioner/DPBoK/gems/gems/asciidoctor-pdf-1.5.0.beta.3/bin/asciidoctor-pdf:32:in <top (required)>'
from /usr/local/bin/asciidoctor-pdf:23:in load' from /usr/local/bin/asciidoctor-pdf:23:in '

from asciidoctor-bibtex.

mojavelinux avatar mojavelinux commented on June 3, 2024

At the risk of stating the obvious, a sample document would go along way here.

Line 91 of Processor.rb does not compare array with arrays, it just sorts an array of string

Clearly, something else is getting into that Array that is throwing off the built-in sort logic.

from asciidoctor-bibtex.

mojavelinux avatar mojavelinux commented on June 3, 2024

I've now running the builds in a docker image, which may help to isolate/reproduce. We need to reduce what we are building to the minimum to show the error.

If you can't share the document publicly, consider sharing a private repo with @ProgramFan.

from asciidoctor-bibtex.

ajosey avatar ajosey commented on June 3, 2024

At the risk of stating the obvious, a sample document would go along way here.

Line 91 of Processor.rb does not compare array with arrays, it just sorts an array of string

Clearly, something else is getting into that Array that is throwing off the built-in sort logic.

Yes have been trying to isolate to a smaller fragment first. The original question I had was whether there was a way to get more diagnostics from asciidoctor-bibtex. I assume not.

from asciidoctor-bibtex.

mojavelinux avatar mojavelinux commented on June 3, 2024

from asciidoctor-bibtex.

CharlesTBetz avatar CharlesTBetz commented on June 3, 2024

from asciidoctor-bibtex.

ajosey avatar ajosey commented on June 3, 2024

I have managed to isolate the problem to just a .bib file and one other file.

Unwind the files , and run the run.sh script

bibtex-test.zip

I am able to see the error in many environments including ruby 2.5 and 2.6.
If you need some scripts to invoke a docker environment in let me know

from asciidoctor-bibtex.

ajosey avatar ajosey commented on June 3, 2024

Closed as being not reproducible. Re-open if needed.

How can it be re-opened? Is that just the reporter who can do that? @CharlesTBetz

from asciidoctor-bibtex.

mojavelinux avatar mojavelinux commented on June 3, 2024

I'm probing this to see what's wrong. It's tough since the error is coming from inside a Ruby routine.

from asciidoctor-bibtex.

mojavelinux avatar mojavelinux commented on June 3, 2024

The problem is that the sort_by method is returning an array value, when it should be returning a string. In certain circumstances, if the year is nil (the last value in the array), it cannot be compared.

The problematic entry is this one:

cite:[Morgan2018, Osterwalder2010, Morgan2006, Ward2014]

It's problematic because it ends up returning:

["MORGAN, JAMES M.", "LIKER, JEFFREY K.", nil]

The presence of the nil value breaks sort_by. And if it's not the nil value, it's the variable length array.

This can be fixed by coercing the return value to a string or leaving off the year if it's nil.

from asciidoctor-bibtex.

mojavelinux avatar mojavelinux commented on June 3, 2024

I'm preparing a test and PR.

from asciidoctor-bibtex.

mojavelinux avatar mojavelinux commented on June 3, 2024

Here's an even more minimal case

cite:[Morgan2018, Morgan2006]

So it's when all the authors are the same and it comes down to comparing the date. The comparison with nil fails. The error message is misleading.

from asciidoctor-bibtex.

CharlesTBetz avatar CharlesTBetz commented on June 3, 2024

from asciidoctor-bibtex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.