asciidoctor / asciidoctor-epub3

:blue_book: Asciidoctor EPUB3 is a set of Asciidoctor extensions for converting AsciiDoc to EPUB3
https://asciidoctor.org
MIT License
213 stars 68 forks source link

Support for asciidoctor-latex #111

Closed tribut closed 4 years ago

tribut commented 7 years ago

Are there any plans for interoperability with asciidoctor-latex? It does support outputting to html, so I think it should be possible. But when I try to run

asciidoctor-epub3 -r asciidoctor-latex file.adoc

it results in an error:

± asciidoctor-epub3 -r asciidoctor-latex --trace file.adoc 
/home/felix/.gem/ruby/2.3.0/gems/asciidoctor-latex-1.5.0.17.dev/lib/asciidoctor/latex/inject_html.rb:13:in `process': undefined method `gsub' for #<Asciidoctor::Epub3::Packager:0x0055bd0e6a3af8> (NoMethodError)
    from /home/felix/.gem/ruby/2.3.0/gems/asciidoctor-1.5.6/lib/asciidoctor/document.rb:1066:in `[]'
    from /home/felix/.gem/ruby/2.3.0/gems/asciidoctor-1.5.6/lib/asciidoctor/document.rb:1066:in `block in convert'
    from /home/felix/.gem/ruby/2.3.0/gems/asciidoctor-1.5.6/lib/asciidoctor/document.rb:1065:in `each'
    from /home/felix/.gem/ruby/2.3.0/gems/asciidoctor-1.5.6/lib/asciidoctor/document.rb:1065:in `convert'
    from /home/felix/.gem/ruby/2.3.0/gems/asciidoctor-1.5.6/lib/asciidoctor.rb:1501:in `convert'
    from /home/felix/.gem/ruby/2.3.0/gems/asciidoctor-1.5.6/lib/asciidoctor.rb:1572:in `block in convert_file'
    from /home/felix/.gem/ruby/2.3.0/gems/asciidoctor-1.5.6/lib/asciidoctor.rb:1572:in `open'
    from /home/felix/.gem/ruby/2.3.0/gems/asciidoctor-1.5.6/lib/asciidoctor.rb:1572:in `convert_file'
    from /home/felix/.gem/ruby/2.3.0/gems/asciidoctor-1.5.6/lib/asciidoctor/cli/invoker.rb:108:in `block in invoke!'
    from /home/felix/.gem/ruby/2.3.0/gems/asciidoctor-1.5.6/lib/asciidoctor/cli/invoker.rb:102:in `each'
    from /home/felix/.gem/ruby/2.3.0/gems/asciidoctor-1.5.6/lib/asciidoctor/cli/invoker.rb:102:in `invoke!'
    from /home/felix/.gem/ruby/2.3.0/gems/asciidoctor-epub3-1.5.0.alpha.8.dev/bin/asciidoctor-epub3:32:in `<top (required)>'
    from /home/felix/.gem/ruby/2.3.0/bin/asciidoctor-epub3:22:in `load'
    from /home/felix/.gem/ruby/2.3.0/bin/asciidoctor-epub3:22:in `<main>'
mojavelinux commented 7 years ago

This would really be the responsibility of asciidoctor-latex to guarantee. If there is something that Asciidoctor EPUB3 is doing that breaking compatibility, we can definitely address it, but Asciidoctor EPUB3 shouldn't know anything specific about Asciidoctor LaTeX.

tribut commented 7 years ago

Right, I'll try and find out what is breaking later tonight. Good opportunity to jump into asciidoctor code, I guess.

mojavelinux commented 7 years ago

I'll be happy to answer any questions. I'm sure we can get to the bottom of it.

tribut commented 7 years ago

It seems that the Postprocessor-Hooks from asciidoctor-latex expect output to be a string (consistent with the docs, as far as I can see), but asciidoctor-epub3's convert returns a Epub3::Packager which is further processed in write.

Not sure what the best course of action would be. Implementing gsub on the Packager object feels like a dirty hack.

slonopotamus commented 4 years ago

I don't see how asciidoctor-epub3 is supposed to play together with asciidoctor-latex. Output is either EPUB or HTML or LaTeX, period. You can't choose more than one at the same time.

mojavelinux commented 4 years ago

Asciidoctor LaTeX has two components. One is LaTeX output. The other is additional shorthand syntax for writing scientific content in AsciiDoc. But I'm not really happy about where those enhancements ended up. Those should have been in a dedicated extension. So until that happens, I'm not in favor of spreading that support around. Plus, the project has stalled and supporting it sends the wrong message that it's in good working order.