Closed agiletortoise closed 2 years ago
I should probably clarify more, that I do not want what HTMLEscape does, intervening in individual tags, but want the section
to have the final rendering of its child content to manipulate, not just modify each sub tag as it is renderered.
Hello @agiletortoise,
Please check the Advanced Boxes documentation chapter, and probably one of the render
, willRender
or didRender
initializers.
You will have to read the documentation.
Great, thanks for the pointer...the below seems to accomplish what I need by processing the inner tags, then making the modifications...putting here for future visitors, or if you happen to see any clear problems with this approach.
final class TestHelper : MustacheBoxable {
var mustacheBox: MustacheBox {
return MustacheBox(
value: self,
filter: Filter(filter),
render: render)
}
private func filter(_ rendering: Rendering) throws -> Rendering {
// do my thing here...
return Rendering("New Value")
}
private func render(_ info: RenderingInfo) throws -> Rendering {
let rendering = try info.tag.render(info.context)
return try self.filter(rendering)
}
}
Apologies if I'm missing it, but is there a way to have a lambda/filter/whatever that post-processes the rendering of its nested content. I want to have something like:
But where the
section
has access to and post-processes the renderer result of its nested content. Right now the Lambda get{{value}}
as its string input. I want it to get the post-rendered version to process.