Description
It would be a great improvement, in my opinion, if the mstch::object daughter class could accept one std::string argument as a lambda function would.
Here i created a silly example where i want only the Chris to be bold other names does not deserves such a good treatment. In the current state of the code base this code would not compile.
`class example: public mstch::object {
public:
example(): m_value(1) {
register_methods(this, {
{"count", &example::count},
{"names", &example::names},
{"boldify", &example::boldify}
});
}
mstch::node count() {
return m_value++;
}
mstch::node boldify(const std::string& input) {
return input == "Chris" ? " + input + " : input;
}
mstch::node names() {
return mstch::array{
std::string{"Chris"}, std::string{"Mark"}, std::string{"Scott"}};
}
private:
int m_value;
};
std::string view{"{{#names}}{{#boldify}}{count}}{{/boldify}}: {{.}}\n{{/names}}"};
const auto context = std::make_shared();
std::cout << mstch::render(view, context) << std::endl;`