asciidoctor/kramdown-asciidoc

Error on lists with items with only spaces

sebelk opened this issue · 0 comments

I've installed the gem kramdown-asciidocbut if fails:

 ~/bin/kramdoc --output=Apuntes.adoc Apuntes.md 
Traceback (most recent call last):
        21: from /home/sergio/bin/kramdoc:23:in `<main>'
        20: from /home/sergio/bin/kramdoc:23:in `load'
        19: from /home/sergio/.gem/ruby/gems/kramdown-asciidoc-1.0.1/bin/kramdoc:12:in `<top (required)>'
        18: from /home/sergio/.gem/ruby/gems/kramdown-asciidoc-1.0.1/lib/kramdown-asciidoc/cli.rb:117:in `run'
        17: from /home/sergio/.gem/ruby/gems/kramdown-asciidoc-1.0.1/lib/kramdown-asciidoc/api.rb:104:in `convert_file'
        16: from /home/sergio/.gem/ruby/gems/kramdown-asciidoc-1.0.1/lib/kramdown-asciidoc/api.rb:52:in `convert'
        15: from /home/sergio/.gem/ruby/gems/kramdown-1.17.0/lib/kramdown/document.rb:117:in `method_missing'
        14: from /home/sergio/.gem/ruby/gems/kramdown-1.17.0/lib/kramdown/converter/base.rb:105:in `convert'
        13: from /home/sergio/.gem/ruby/gems/kramdown-asciidoc-1.0.1/lib/kramdown-asciidoc/converter.rb:99:in `convert'
        12: from /home/sergio/.gem/ruby/gems/kramdown-asciidoc-1.0.1/lib/kramdown-asciidoc/converter.rb:105:in `convert_root'
        11: from /home/sergio/.gem/ruby/gems/kramdown-asciidoc-1.0.1/lib/kramdown-asciidoc/converter.rb:645:in `traverse'
        10: from /home/sergio/.gem/ruby/gems/kramdown-asciidoc-1.0.1/lib/kramdown-asciidoc/converter.rb:645:in `each_with_index'
         9: from /home/sergio/.gem/ruby/gems/kramdown-asciidoc-1.0.1/lib/kramdown-asciidoc/converter.rb:645:in `each'
         8: from /home/sergio/.gem/ruby/gems/kramdown-asciidoc-1.0.1/lib/kramdown-asciidoc/converter.rb:646:in `block in traverse'
         7: from /home/sergio/.gem/ruby/gems/kramdown-asciidoc-1.0.1/lib/kramdown-asciidoc/converter.rb:99:in `convert'
         6: from /home/sergio/.gem/ruby/gems/kramdown-asciidoc-1.0.1/lib/kramdown-asciidoc/converter.rb:299:in `convert_ul'
         5: from /home/sergio/.gem/ruby/gems/kramdown-asciidoc-1.0.1/lib/kramdown-asciidoc/converter.rb:645:in `traverse'
         4: from /home/sergio/.gem/ruby/gems/kramdown-asciidoc-1.0.1/lib/kramdown-asciidoc/converter.rb:645:in `each_with_index'
         3: from /home/sergio/.gem/ruby/gems/kramdown-asciidoc-1.0.1/lib/kramdown-asciidoc/converter.rb:645:in `each'
         2: from /home/sergio/.gem/ruby/gems/kramdown-asciidoc-1.0.1/lib/kramdown-asciidoc/converter.rb:646:in `block in traverse'
         1: from /home/sergio/.gem/ruby/gems/kramdown-asciidoc-1.0.1/lib/kramdown-asciidoc/converter.rb:99:in `convert'
/home/sergio/.gem/ruby/gems/kramdown-asciidoc-1.0.1/lib/kramdown-asciidoc/converter.rb:312:in `convert_li': undefined method `type' for nil:NilClass (NoMethodError)

Versions:

  • gem environment version
    3.1.4

  • ruby
    ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]

The problem as far I tested is due to items containing only spaces on a item of a list, for example the convertion will fail:

# Ejemplo

- item 1
- item 2
- item 3
- item 4
- item 5
- item 6
- item 7
- 
- item 8

Simply deleting empty items prevents this issue.

It would be nice that kramdoc print a nicer error message in such a cases.

Thanks in advance!