I have a need for something similar, but in my case more general. I'd like to be able to render a template filled with struct data as many times on a page as there are instances stored in struct data. I'd thought of writing a new plugin that has a syntax as follows:
<struct template>
---- struct lookup ----
schema: X
cols: Y, Z
----
* {{$X.Y}}
* {{$X.Z}}
</struct template>
This would also produce your lists, but I ran into problems working out the best way to do it.
One way would be to consume everything in the tags, do the replacements, then call p_render()
on the result, but that fires up a whole new parser for each row then, and if you had a lot of rows, the performance would be terrible.
Another, which I started researching, would be to use the lines down to ----
as the entry pattern for a syntax container, but then the plugin needs to let the parser get the instructions inside for the Wiki mark-up the tag and replace them after the fact. In the handle()
method of a syntax plugin there is a call handler that seems like it might have this information, but because the output of a syntax plugin's handler can be cached, I need to do the struct search in the render step. The renderer doesn't have access to the call stack as far as I can tell, though, so it can't go back and get what was rendered.
@andi Assuming I want to render the same Wiki mark-up as many times as there are rows in a Struct search, is there a way to do this without calling a whole new render step each time?