Skip to content

Error "undefined method `attr?' for nil" if :doctype: book, :!sectids:, and plantuml with format=svg #452

@donparakin

Description

@donparakin

I'm getting a strange error that I've narrowed down to this document. I'm running Docker image asciidoctor/docker-asciidoctor:1.72.0 (haven't tried it with other images):

= Minimal Doc
:doctype: book
:!sectids:

== The Diagrams

[plantuml,,format=svg]
----
@startebnf
Command = "piku", "apps";
@endebnf
----

fails with error: undefined method `attr?' for nil

Strangely, the problem goes away if one of the following is done: 1) remove format=svg from the plantuml diagram, 2) remove the == The Diagrams section, 3) remove :!sectids:, or 4) remove :doctype: book. Is this a bug or PEBCAK?

The trace of the error is:

/usr/lib/ruby/gems/3.3.0/gems/asciidoctor-epub3-2.1.3/lib/asciidoctor-epub3/converter.rb:1029:in `register_media_file': undefined method `attr?' for nil (NoMethodError)

          chapter.set_attr 'epub-properties', [] unless chapter.attr? 'epub-properties'
                                                               ^^^^^^
        from /usr/lib/ruby/gems/3.3.0/gems/asciidoctor-epub3-2.1.3/lib/asciidoctor-epub3/converter.rb:1148:in `convert_image'
        from /usr/lib/ruby/gems/3.3.0/gems/asciidoctor-epub3-2.1.3/lib/asciidoctor-epub3/converter.rb:115:in `convert'
        from /usr/lib/ruby/gems/3.3.0/gems/asciidoctor-2.0.23/lib/asciidoctor/abstract_block.rb:76:in `convert'
        from /usr/lib/ruby/gems/3.3.0/gems/asciidoctor-2.0.23/lib/asciidoctor/abstract_block.rb:85:in `block in content'
        from /usr/lib/ruby/gems/3.3.0/gems/asciidoctor-2.0.23/lib/asciidoctor/abstract_block.rb:85:in `map'
        from /usr/lib/ruby/gems/3.3.0/gems/asciidoctor-2.0.23/lib/asciidoctor/abstract_block.rb:85:in `content'
        from /usr/lib/ruby/gems/3.3.0/gems/asciidoctor-epub3-2.1.3/lib/asciidoctor-epub3/converter.rb:485:in `convert_section'
        from /usr/lib/ruby/gems/3.3.0/gems/asciidoctor-epub3-2.1.3/lib/asciidoctor-epub3/converter.rb:115:in `convert'
        from /usr/lib/ruby/gems/3.3.0/gems/asciidoctor-2.0.23/lib/asciidoctor/abstract_block.rb:76:in `convert'
        from /usr/lib/ruby/gems/3.3.0/gems/asciidoctor-2.0.23/lib/asciidoctor/abstract_block.rb:85:in `block in content'
        from /usr/lib/ruby/gems/3.3.0/gems/asciidoctor-2.0.23/lib/asciidoctor/abstract_block.rb:85:in `map'
        from /usr/lib/ruby/gems/3.3.0/gems/asciidoctor-2.0.23/lib/asciidoctor/abstract_block.rb:85:in `content'
        from /usr/lib/ruby/gems/3.3.0/gems/asciidoctor-2.0.23/lib/asciidoctor/document.rb:1012:in `content'
        from /usr/lib/ruby/gems/3.3.0/gems/asciidoctor-epub3-2.1.3/lib/asciidoctor-epub3/converter.rb:258:in `convert_document'
        from /usr/lib/ruby/gems/3.3.0/gems/asciidoctor-epub3-2.1.3/lib/asciidoctor-epub3/converter.rb:115:in `convert'
        from /usr/lib/ruby/gems/3.3.0/gems/asciidoctor-2.0.23/lib/asciidoctor/document.rb:956:in `convert'
        from /usr/lib/ruby/gems/3.3.0/gems/asciidoctor-2.0.23/lib/asciidoctor/convert.rb:118:in `convert'
        from /usr/lib/ruby/gems/3.3.0/gems/asciidoctor-2.0.23/lib/asciidoctor/convert.rb:190:in `block in convert_file'
        from /usr/lib/ruby/gems/3.3.0/gems/asciidoctor-2.0.23/lib/asciidoctor/convert.rb:190:in `open'
        from /usr/lib/ruby/gems/3.3.0/gems/asciidoctor-2.0.23/lib/asciidoctor/convert.rb:190:in `convert_file'
        from /usr/lib/ruby/gems/3.3.0/gems/asciidoctor-2.0.23/lib/asciidoctor/cli/invoker.rb:129:in `block in invoke!'
        from /usr/lib/ruby/gems/3.3.0/gems/asciidoctor-2.0.23/lib/asciidoctor/cli/invoker.rb:112:in `each'
        from /usr/lib/ruby/gems/3.3.0/gems/asciidoctor-2.0.23/lib/asciidoctor/cli/invoker.rb:112:in `invoke!'
        from /usr/lib/ruby/gems/3.3.0/gems/asciidoctor-epub3-2.1.3/bin/asciidoctor-epub3:28:in `<top (required)>'
        from /usr/bin/asciidoctor-epub3:25:in `load'
        from /usr/bin/asciidoctor-epub3:25:in `<main>'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions