Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
145 posts
|
This post was updated on Apr 09, 2020; 4:45pm.
Hi
Can we chain the processors in such a way that BlockProcessor will be processed after the TreeProcessor ? The reason why I'm asking this question is because I would like to pospulate a hashMap using TreeProcessor and reuse it with the BlockProcessor Example: // Include the Table extension asciidoctor.javaExtensionRegistry() .treeprocessor(FindRolesTreeProcessor.class) .block(GenerateTableBlockProcessor.class); ... Best Charles
Charles Moulliard
Apache Committer / Technologist Evangelist / Blogger / MiddleWare Specialist Twitter : @cmoulliard |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
68 posts
|
No. However the processors are registered has no effect on what stage of parsing they are called during.
David Jencks
... [show rest of quote] |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
145 posts
|
So, How can I share a HashMap created by the TreeProcessor with the BlockProcessor ?
Charles Moulliard
Apache Committer / Technologist Evangelist / Blogger / MiddleWare Specialist Twitter : @cmoulliard |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
68 posts
|
I’m not familiar with the java API for the extension registry. If you really can only register a class rather than an instance as a processor, then I think you’ll need to use a static variable in one class, accessed by the other.
David Jencks
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
48 posts
|
The API allows to register instances of classes as well. One solution could be
Alexander Schwartz (alexander.schwartz@gmx.net)
https://www.ahus1.de |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
145 posts
|
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 |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
68 posts
|
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
... [show rest of quote] |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
354 posts
|
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. ... [show rest of quote] -- |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
145 posts
|
In reply to this post by David Jencks
Can you share your example please where you locate an existing table using a BlockProcessor and then having the tree processor to add the rows ?
Question: Can we first use the treeProcessor to iterate through the document to create the HashMap and next use a BlockProcessor to insert a Table generated using the hashmap ?
Charles Moulliard
Apache Committer / Technologist Evangelist / Blogger / MiddleWare Specialist Twitter : @cmoulliard |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
68 posts
|
(moved to asciidoctor/asciidoctor gitter channel)
... [show rest of quote] |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
354 posts
|
In reply to this post by ch007m
I don't have an example that does that. Ah, a treeprocessor and a block processor, I thought you had said a preprocessor. I'm not sure the relationship of when those are called. What do you need from the tree processor? On Thu, Apr 9, 2020 at 1:51 PM ch007m [via Asciidoctor :: Discussion] <[hidden email]> wrote: Can you share your example please where you locate an existing table using a BlockProcessor and then having the tree processor to add the rows ? -- |
Free forum by Nabble | Edit this page |