Re: Interpret links (or other AsciiDoc syntax) only in specific lines of a [source] block
Posted by
David Jencks on
Feb 16, 2021; 8:08am
URL: https://discuss.asciidoctor.org/Interpret-links-or-other-AsciiDoc-syntax-only-in-specific-lines-of-a-source-block-tp8499p8502.html
I can’t say I really understand what you are trying to do, but….
I wonder if having a block processor and the tree processor in the same extension would be useful. The block processor can come up with a table of interesting locations, which would be accessible to the tree processor because it’s in the same processor. It’s also possible that you can do everything you need in the tree processor just as easily.
As you can see I’m happy to make suggestions based on the slimmest of knowledge… seeing a fairly concrete example of what you are trying to do could be very helpful.
David Jencks
On Feb 15, 2021, at 11:01 PM, Oblomov [via Asciidoctor :: Discussion] <
[hidden email]> wrote:
Hello David,
thanks for the link! I'll give it a good read (and see if I can contribute too).
However, I'm not entirely sure a block processor is what I want. Or rather, I can see why it might be appropriate, but I find myself in a peculiar situation, in that the data necessary to modify the block content may only be available _after_ the tree processor (that I've presently implemented) completes its work, and my understanding is that the block processors run _before_ the tree processors.
For the block title, I'm currently running a function at the end of the `process` step of the tree processor that takes the gathered data and adds prev/next link to the title (simply by appending the corresponding syntax to the title), which seems to work correctly in the limited testing I've given it so far. I was hoping to be able to something similar with the in-block links, possibly manipulating the block lines and subs/attributes.
Cheers,
GB