Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Section offset plugin fails when creating PDF #122

Closed
arosien opened this issue Sep 10, 2020 · 4 comments
Closed

Section offset plugin fails when creating PDF #122

arosien opened this issue Sep 10, 2020 · 4 comments
Assignees
Milestone

Comments

@arosien
Copy link

arosien commented Sep 10, 2020

The sectnumoffset extension works for me when outputting HTML, but gives me this error when outputting PDF:

/usr/lib/ruby/gems/2.6.0/gems/rouge-3.15.0/lib/rouge.rb:55:in `block in <top (required)>': asciidoctor: FAILED: /documents/book/excerpt-concurrent-state.adoc: Failed to load AsciiDoc document - uninitialized constant Rouge::Lexers (NameError)
        from /usr/lib/ruby/gems/2.6.0/gems/rouge-3.15.0/lib/rouge.rb:55:in `each'
        from /usr/lib/ruby/gems/2.6.0/gems/rouge-3.15.0/lib/rouge.rb:55:in `<top (required)>'
        from /usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `require'
        from /usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `rescue in require'
        from /usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:34:in `require'
        from /usr/lib/ruby/gems/2.6.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/rouge_ext.rb:2:in `<top (required)>'
        from /usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /usr/lib/ruby/gems/2.6.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/helpers.rb:27:in `require_library'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/syntax_highlighter/rouge.rb:78:in `load_library'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/syntax_highlighter/rouge.rb:74:in `library_available?'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/syntax_highlighter/rouge.rb:12:in `highlight?'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/substitutors.rb:1288:in `commit_subs'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/parser.rb:918:in `next_block'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/parser.rb:379:in `next_section'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/parser.rb:364:in `next_section'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/parser.rb:364:in `next_section'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/parser.rb:364:in `next_section'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/parser.rb:97:in `parse'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:549:in `parse'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/load.rb:83:in `load'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:78:in `convert'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `block in convert_file'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `open'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `convert_file'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:128:in `block in invoke!'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in `each'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in `invoke!'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/bin/asciidoctor:15:in `<top (required)>'
        from /usr/bin/asciidoctor:23:in `load'
        from /usr/bin/asciidoctor:23:in `<main>'
/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- rouge (LoadError)
        from /usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /usr/lib/ruby/gems/2.6.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/rouge_ext.rb:2:in `<top (required)>'
        from /usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /usr/lib/ruby/gems/2.6.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/helpers.rb:27:in `require_library'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/syntax_highlighter/rouge.rb:78:in `load_library'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/syntax_highlighter/rouge.rb:74:in `library_available?'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/syntax_highlighter/rouge.rb:12:in `highlight?'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/substitutors.rb:1288:in `commit_subs'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/parser.rb:918:in `next_block'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/parser.rb:379:in `next_section'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/parser.rb:364:in `next_section'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/parser.rb:364:in `next_section'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/parser.rb:364:in `next_section'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/parser.rb:97:in `parse'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:549:in `parse'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/load.rb:83:in `load'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:78:in `convert'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `block in convert_file'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `open'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `convert_file'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:128:in `block in invoke!'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in `each'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in `invoke!'
        from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/bin/asciidoctor:15:in `<top (required)>'
        from /usr/bin/asciidoctor:23:in `load'
        from /usr/bin/asciidoctor:23:in `<main>'

I use docker-asciidoctor and am running asciidoctor-pdf with additional flags -r ./lib/sectnumoffset-treeprocessor.rb -a sectnums -a sectnumoffset=9 --trace.

If I remove those extra flags the PDF renders fine, so somehow this extension is interfering somehow, maybe some ordering issue?

(originally posted in asciidoctor/asciidoctor-pdf#166)

@mojavelinux
Copy link
Member

mojavelinux commented Sep 10, 2020

This is due to a conflict between Asciidoctor core and an older version of Rouge when the include Asciidoctor statement is used (by the extension). You can fix it by upgrading Rouge to the latest version (see https://rubygems.org/gems/rouge). A corresponding fix in Asciidoctor will be in the 2.0.11 release. See asciidoctor/asciidoctor#3623

@mojavelinux mojavelinux added this to the support milestone Sep 10, 2020
@mojavelinux mojavelinux self-assigned this Sep 10, 2020
@arosien
Copy link
Author

arosien commented Sep 10, 2020

Thanks!

I'm also a bit out of date with the docker image:

REPOSITORY                       TAG                 IMAGE ID            CREATED             SIZE
asciidoctor/docker-asciidoctor   latest              0c383e26e3d9        7 months ago        428MB

so I'll see if updating that fixes it.

@arosien
Copy link
Author

arosien commented Sep 10, 2020

so I'll see if updating that fixes it.

It does... excellent. Thanks for being so responsive!

@mojavelinux
Copy link
Member

Great news! Glad to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants