Login  Register

Re: Interpret links (or other AsciiDoc syntax) only in specific lines of a [source] block

Posted by Oblomov on Feb 16, 2021; 7:01am
URL: https://discuss.asciidoctor.org/Interpret-links-or-other-AsciiDoc-syntax-only-in-specific-lines-of-a-source-block-tp8499p8501.html

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