Open
Description
I have a partial..
partial.mustache
---
{{!...includes other things, but for simplicity...}}
{{! OptionalMarker}}
And an outer context which has a lambda...
{"ReplaceOptionalMarkers", mstch::lambda([](const std::string& text) -> mstch::node {
auto result = text;
boost::replace_all(result, "{{! OptionalMarker}}", "Rendered Optional!");
return result;
})}
I want to be able to do something like...
complete.mustache
---
{{#context:ReplaceOptionalMarkers}}{{> partial}}{{/context:ReplaceOptionalMarkers}}
Ideally, this would work even if partial includes other partials, and the marker is in those dependencies.
The feature I am asking for is to have a lambda function which "partially" realizes the partial. Rather than fully rendering the partial (which would lose the comment markers), it would replace the {{> partial}}
in the string passed to the lambda with whatever is actually within partial, and recursively do so. User will need to avoid infinite loops.
The only alternative way I can imagine implementing something like this is by using global state and objects, which feels like the wrong pattern.
Metadata
Metadata
Assignees
Labels
No labels