I was using asciidoctor 1.5.4 quite happily, and doing `Asciidoctor.render_file(fname, options)` with a custom backend. It worked fine and spat out `file.adoc` to `file.html` just as I needed. When upgrading to asciidoctor 2.0 I found that unless I used `:to_file => true` in the options the output didn't come to a file any more. But once I fixed that the filename is wrong because the extension is not "html". How do I change the output filename?
|
Update: looks like `Asciidoctor::DEFAULT_EXTENSIONS['<backend>'] = '.html'` was what I needed, where `<backend>` is the id of the backend.
|
Administrator
|
It depends on how your custom backend / converter works, but the simplest way to solve this without hacking Asciidoctor core is to set the outfilesuffix attribute. The outfilesuffix is what is used to determine what suffix to put on the output file. You can specify this attribute via the API. I'm curious to know if that solves your issue. There's also a way for a custom backend / converter to self register an outfilesuffix. But that may be more intricate than you need. Cheers, -Dan On Tue, Apr 2, 2019 at 8:35 AM dsyer [via Asciidoctor :: Discussion] <[hidden email]> wrote: Update: looks like `Asciidoctor::DEFAULT_EXTENSIONS['<backend>'] = '.html'` was what I needed, where `<backend>` is the id of the backend. -- Dan Allen | @mojavelinux | https://twitter.com/mojavelinux |
Administrator
|
I also want to point out that you can set the inherited backend now when you set the backend. This was done explicitly to deal with the situation where the basebackend (and thus outfilesuffix) cannot be guessed from the backend, which is your case. Set the backend as follows: backend: 'slides:html' Then, to_file: true will work (because your custom backend will inherit from the html backend). Let me know if that works out for you. Cheers, -Dan On Tue, Apr 2, 2019 at 12:31 PM mojavelinux [via Asciidoctor :: Discussion] <[hidden email]> wrote:
-- Dan Allen | @mojavelinux | https://twitter.com/mojavelinux |
Free forum by Nabble | Edit this page |