Login  Register

Re: Chain processors - can we ?

Posted by LightGuardjp on Apr 09, 2020; 7:38pm
URL: https://discuss.asciidoctor.org/Chain-processors-can-we-tp7870p7879.html

A preprocessor will be the first step in the chain of processors regardless.

On Thu, Apr 9, 2020 at 1:17 PM David Jencks [via Asciidoctor :: Discussion] <[hidden email]> wrote:
If registering objects rather than classes is supported, I would use a single object implementing both interfaces.

You may not want to do it, but the sequence suggested by Dan of having a block processor first do something to locate where the table is going to be, either by inserting a table or, much easier, as I did, locating an existing table, and then having the tree processor add rows, will definitely work and IMO would be considerably simpler and more reliable than using a preprocessor.  If you use a tree processor you can rely on asciidoctor actually correctly finding the structure of your document; if you use a preprocessor you are rewriting the parser, probably with bugs.  I’m not sure what problem you see with this structure.

David Jencks

On Apr 9, 2020, at 11:50 AM, ch007m [via Asciidoctor :: Discussion] <[hidden email]> wrote:

I can share the HashMap using a static method between the classes. But, as we cannot define the order of the execution of the processors, then I must try to use another approach where I will use first a preprocessor to calculate the hashmap and next using a Blockprocessor to generate the table with the hashmap values

asciidoctor.javaExtensionRegistry()
                .preprocessor(FindRolesPreProcessor.class)
                .block(GenerateTableBlockProcessor.class);

Remark: the problem that I have is that we cannot use a document AST tree with the preprocessor but instead read lines to navigate ...
Charles Moulliard
Apache Committer / Technologist Evangelist / Blogger / MiddleWare Specialist
Twitter : @cmoulliard



If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/Chain-processors-can-we-tp7870p7876.html
To start a new topic under Asciidoctor :: Discussion, [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML




If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/Chain-processors-can-we-tp7870p7878.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--