Multiple backends in one session?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Multiple backends in one session?

aalmiray
I wonder, is it possible to instruct Asciidoctor to apply multiple backends (say html, docbook) during the same session? That is, once the sources are parsed Asciidcotor will simply delegate to the right backend for rendering. Or is it the case that Asciidoctor renders as it parses? (I honestly have no knowledge of Asciidoctor magiccal entrails ;-)

Cheers,
Andres
Reply | Threaded
Open this post in threaded view
|

Re: Multiple backends in one session?

mojavelinux
Administrator
Although this is an old question (hey, it's less than 1 year old, so there's that), it's still an important one to address.

The best practice answer is "no", you shouldn't convert to multiple backends from a single parse (i.e., load). There are two reasons for this, both which have to do with attributes.

Preprocessor directives::

While the document is parsed, Asciidoctor applies preprocessor directives like ifdef and include, which changes the parse tree and also requires it to evaluate certain attributes. Preprocessor directives are often used to filter content based on which backend is being used. Thus, a parse can set up the tree with a bias of converting to a particular output format.

Attributes::

Certain attributes are used to control how the output is generated for a given format. At times, these settings conflict from one backend to another. While it's possible to load the document then change the attributes, it's much trickier than if you can just set the up front.

FYI, Asciidoctor currently parses block content during load and inline content during conversion. Eventually, we'll switch that so that all the content is parsed during load.

In general, the backend should remain consistent while working on a pass of the document, at least until we tease apart some of the internals over time.

Cheers,

-Dan

On Tue, Oct 8, 2013 at 8:57 AM, aalmiray [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I wonder, is it possible to instruct Asciidoctor to apply multiple backends (say html, docbook) during the same session? That is, once the sources are parsed Asciidcotor will simply delegate to the right backend for rendering. Or is it the case that Asciidoctor renders as it parses? (I honestly have no knowledge of Asciidoctor magiccal entrails ;-)

Cheers,
Andres


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Multiple-backends-in-one-session-tp762.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--