asciidoctor / asciidoctor-latex

:triangular_ruler: Add LaTeX features to AsciiDoc & convert AsciiDoc to LaTeX
http://asciidoctor.org
Other
111 stars 26 forks source link

asciidoctor-latex - undefined method gsub #59

Closed cschneiker closed 6 years ago

cschneiker commented 6 years ago

I'm submitting that at the suggestion of Dan Allen (quoted below).

Main discussion of this issue is here: (http://discuss.asciidoctor.org/asciidoctor-latex-undefined-method-gsub-td5752.html#a5754)

"I see the problem now. Asciidoctor LaTeX is assuming that the reference text is not nil. However, since Asciidoctor 1.5.6(.1), the converter is now responsible for providing a fallback value. So the LaTeX converter needs to check for a nil value. Can you report this in the Asciidoctor LaTeX project?"

The test file was called x.adoc in the main discussion. Wasn't allowed to use that name here. test-file.txt

Conrad

mojavelinux commented 6 years ago

Thanks for reporting. I have issued a PR to fix it. See #60.

mojavelinux commented 6 years ago

@jxxcarlson we could avoid these sorts of breakages in the future if we got the test suite running in Travis CI (a continuous integration environment). I'd be happy to submit the configuration to get that setup. However, it seems that the tests are currently failing. Could you run the test suite on your end and confirm you can get all the tests running? Also, can you let me know what your test command is so I know which command to tell the CI job to run?

mojavelinux commented 6 years ago

What's interesting about this issue is that it actually comes from bibliography. But the bibliography ref is being treated as a normal ref and not a bib ref. You can work around this issue in your case by adding the bibliography style to the bibliography section.

[bibliography]
== Bibliography

- [[[taoup]]] Eric Steven Raymond. 'The Art of Unix
  Programming'. Addison-Wesley. ISBN 0-13-142901-9.
- [[[walsh-muellner]]] Norman Walsh & Leonard Muellner.
  'DocBook - The Definitive Guide'. O'Reilly & Associates. 1999.
  ISBN 1-56592-580-7.

Asciidoctor LaTeX currently discards bibliography labels.

mojavelinux commented 6 years ago

This is now fixed. However, I think we should get the test suite fixed before another release is pushed out. The tests are now running in Travis, so we can see when errors are introduced.

See https://travis-ci.org/asciidoctor/asciidoctor-latex

jxxcarlson commented 6 years ago

I will look at this later today. Thanks.

On Jul 26, 2017, at 12:12 AM, Dan Allen notifications@github.com wrote:

What's interesting about this issue is that it actually comes from bibliography. But the bibliography ref is being treated as a normal ref and not a bib ref. You can work around this issue in your case by adding the bibliography style to the bibliography section.

[bibliography] == Bibliography

jxxcarlson commented 6 years ago

Dan, Jakub,

I have been inactive on this project for a while, and will need some help getting back up to speed.

I merged the pull request, then pulled the current version of the repo to my laptop, ran bundle, etc., and then tried rake test. Below is the error log. Could you give me some guidance so that I can get the tests running again (and also passing :-)

— Jim

— $ rake test corefines: Your Ruby doesn't support refinements, so I'll fake them using plain monkey-patching (not scoped!). /Library/Ruby/Gems/2.0.0/gems/corefines-1.0.0/lib/corefines/support/fake_refinements.rb:26: warning: Refinements are experimental, and the behavior may change in future versions of Ruby! rake aborted! NameError: uninitialized constant Asciidoctor::DocTest::Latex /Users/carlson/dev/apps/asciidoctor-latex/Rakefile:45:in block (2 levels) in <top (required)>' /Library/Ruby/Gems/2.0.0/gems/asciidoctor-doctest-1.5.2.0/lib/asciidoctor/doctest/generator_task.rb:67:ininitialize' /Users/carlson/dev/apps/asciidoctor-latex/Rakefile:42:in new' /Users/carlson/dev/apps/asciidoctor-latex/Rakefile:42:inblock in <top (required)>' /Users/carlson/dev/apps/asciidoctor-latex/Rakefile:40:in `<top (required)>' (See full trace by running task with —trace)

On Jul 26, 2017, at 2:00 AM, Dan Allen notifications@github.com wrote:

This is now fixed. However, I think we should get the test suite fixed before another release is pushed out. The tests are now running in Travis, so we can see when errors are introduced.

See https://travis-ci.org/asciidoctor/asciidoctor-latex

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

mojavelinux commented 6 years ago

Jim,

I got the CI job set up and the doctests running. See

https://travis-ci.org/asciidoctor/asciidoctor-latex/builds

I'm using "rake doctest". I'm not sure what "rake test" does in this project. My impression was that it was just a work in progress and the "doctest" is the official test task.

jxxcarlson commented 6 years ago

Excellent news about Travis CI — I will have to learn how to use it.

Meanwhile, still having trouble with errors — am on a new machine. Fixed some by upgrading to latest ruby:

ruby --version ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]

— but am having trouble with this:

(1) $ rake doctest

rake aborted! LoadError: cannot load such file -- bundler/gem_tasks /Users/carlson/dev/apps/asciidoctor-latex/Rakefile:5:in <top (required)>' /usr/local/lib/ruby/gems/2.4.0/gems/rake-12.0.0/exe/rake:27:in<top (required)>' (See full trace by running task with —trace)

(2) $ bundle exec rake doctest

Run bundle install to install missing gems.

(3) $ gem install rake-10.5.0 ERROR: Could not find a valid gem 'rake-10.5.0' (>= 0) in any repository

On Jul 26, 2017, at 3:40 PM, Dan Allen notifications@github.com wrote:

Jim,

I got the CI job set up and the doctests running. See

https://travis-ci.org/asciidoctor/asciidoctor-latex/builds

I'm using "rake doctest". I'm not sure what "rake test" does in this project. My impression was that it was just a work in progress and the "doctest" is the official test task.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

mojavelinux commented 6 years ago

If you are starting out from scratch, here's what you should do:

rm -f Gemfile.lock
bundle --path=.bundle/gems
bundle exec rake doctest

I like using bundle this way because it puts the dependencies into .bundle/gems, so everything is self-contained. No gems running around the system in weird places. This is how I've configured the Travis CI job to work.

mojavelinux commented 6 years ago

The "bundle exec" command tells whatever comes after it to run in the context of the dependencies for the project. If you drop this part, then you are running the command "bundleless" which means it won't see any of your installed dependencies.

cschneiker commented 6 years ago

Thanks much for the work-around.

jxxcarlson commented 6 years ago

Got the doctests working — it was some funny business (ha ha) with my old version of ruby & old gems.

I have some things to propose that might be breaking changes. How should these be best discussed?

On Jul 26, 2017, at 3:40 PM, Dan Allen notifications@github.com wrote:

Jim,

I got the CI job set up and the doctests running. See

https://travis-ci.org/asciidoctor/asciidoctor-latex/builds https://travis-ci.org/asciidoctor/asciidoctor-latex/builds I'm using "rake doctest". I'm not sure what "rake test" does in this project. My impression was that it was just a work in progress and the "doctest" is the official test task.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/asciidoctor/asciidoctor-latex/issues/59#issuecomment-318160217, or mute the thread https://github.com/notifications/unsubscribe-auth/AApgN17V9MkJIda5_gbpRQzs4b1Va4WVks5sR5YxgaJpZM4OjD1y.

mojavelinux commented 6 years ago

I recommend filing an issue for a feature request just like a community member would, then making a case for what you will change. No doubt people will jump in to give feedback and ideas.