asciidoctor / kramdown-asciidoc

A kramdown extension for converting Markdown documents to AsciiDoc.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NoMethodError in traverse

lzap opened this issue · comments

Hey, I am trying to document a single document, it is quite large tho.

I would like to dig into this but the error does not make much sense. I would like to see what element in the tree caused this. Any hint?

(NoMethodError)
Did you mean?  convert_a
               convert_br
               convert_hr
               convert_p
               convert_root
               convert_math
               convert_dd
               convert_dt
               convert_li
               convert_dl
               convert_ol
               convert_ul
               convert_em
               convert_img
	from /home/lzap/.gem/ruby/gems/kramdown-asciidoc-2.0.0/lib/kramdown-asciidoc/converter.rb:668:in `block in traverse'
	from /home/lzap/.gem/ruby/gems/kramdown-asciidoc-2.0.0/lib/kramdown-asciidoc/converter.rb:667:in `each'
	from /home/lzap/.gem/ruby/gems/kramdown-asciidoc-2.0.0/lib/kramdown-asciidoc/converter.rb:667:in `each_with_index'
	from /home/lzap/.gem/ruby/gems/kramdown-asciidoc-2.0.0/lib/kramdown-asciidoc/converter.rb:667:in `traverse'
	from /home/lzap/.gem/ruby/gems/kramdown-asciidoc-2.0.0/lib/kramdown-asciidoc/converter.rb:680:in `compose_text'
	from /home/lzap/.gem/ruby/gems/kramdown-asciidoc-2.0.0/lib/kramdown-asciidoc/converter.rb:562:in `convert_html_element'
	from /home/lzap/.gem/ruby/gems/kramdown-asciidoc-2.0.0/lib/kramdown-asciidoc/converter.rb:102:in `convert'
	from /home/lzap/.gem/ruby/gems/kramdown-asciidoc-2.0.0/lib/kramdown-asciidoc/converter.rb:668:in `block in traverse'
	from /home/lzap/.gem/ruby/gems/kramdown-asciidoc-2.0.0/lib/kramdown-asciidoc/converter.rb:667:in `each'
	from /home/lzap/.gem/ruby/gems/kramdown-asciidoc-2.0.0/lib/kramdown-asciidoc/converter.rb:667:in `each_with_index'
	from /home/lzap/.gem/ruby/gems/kramdown-asciidoc-2.0.0/lib/kramdown-asciidoc/converter.rb:667:in `traverse'
	from /home/lzap/.gem/ruby/gems/kramdown-asciidoc-2.0.0/lib/kramdown-asciidoc/converter.rb:108:in `convert_root'
	from /home/lzap/.gem/ruby/gems/kramdown-asciidoc-2.0.0/lib/kramdown-asciidoc/converter.rb:102:in `convert'
	from /home/lzap/.gem/ruby/gems/kramdown-2.3.1/lib/kramdown/converter/base.rb:107:in `convert'
	from /home/lzap/.gem/ruby/gems/kramdown-2.3.1/lib/kramdown/document.rb:116:in `method_missing'
	from /home/lzap/.gem/ruby/gems/kramdown-asciidoc-2.0.0/lib/kramdown-asciidoc/api.rb:55:in `convert'
	from /home/lzap/.gem/ruby/gems/kramdown-asciidoc-2.0.0/lib/kramdown-asciidoc/api.rb:107:in `convert_file'
	from /home/lzap/.gem/ruby/gems/kramdown-asciidoc-2.0.0/lib/kramdown-asciidoc/cli.rb:120:in `run'
	from /home/lzap/.gem/ruby/gems/kramdown-asciidoc-2.0.0/bin/kramdoc:13:in `<top (required)>'
	from /home/lzap/.gem/ruby/bin/kramdoc:23:in `load'
	from /home/lzap/.gem/ruby/bin/kramdoc:23:in `<main>'

manual.md

Attaching the input markdown file, it is essentially slightly modified: https://theforeman.org/manuals/3.0/index.html

For the record, this appears to be a vaid kramdown document, it does generate HTML with few warnings:

$ kramdown manual.md > manual.html
Warning: Found invalidly used HTML closing tag for 'span' on line 638
Warning: No link definition for link ID '[faq]' found on line 3791
Warning: No link definition for link ID 'faq' found on line 3791
Warning: No link definition for link ID '"fqdn", "hostgroup", "os", "domain"' found on line 3986
Warning: No link definition for link ID 'foreman' found on line 4007
Warning: No link definition for link ID 'puppetserver1.yourdomain.com, puppetserver2.yourdomain.com' found on line 4307
Warning: No link definition for link ID '' found on line 4308
Warning: No link definition for link ID 'master' found on line 4493
Warning: Found no end tag for 'realm-name' (line 10769) - auto-closing it
Warning: Found no end tag for 'keycloak.example.com' (line 10769) - auto-closing it
Warning: Found no end tag for 'realm-name' (line 10783) - auto-closing it
Warning: Found no end tag for 'keycloak.example.com' (line 10783) - auto-closing it
Warning: No link definition for link ID 'object event' found on line 10928
Warning: No link definition for link ID ':name' found on line 11115

The issue that is causing the converter to crash is that it is not handling the raw <script> tag. There are other elements it doesn't convert correctly in this content, but only this tag causes the converter to crash. I'll apply a patch.