mstch/test/data/nested_higher_order_sections.hpp

21 lines
630 B
C++
Raw Normal View History

2015-04-16 19:05:59 +00:00
class nested_higher_order_sections: public mstch::object {
public:
nested_higher_order_sections() {
2015-04-21 13:04:11 +00:00
register_methods(this, {
{"bold", &nested_higher_order_sections::bold},
{"person", &nested_higher_order_sections::person}
});
2015-04-16 19:05:59 +00:00
}
mstch::node bold() {
2015-04-22 09:39:07 +00:00
return mstch::lambda{[](const std::string& text, mstch::renderer render) {
2015-04-16 19:05:59 +00:00
return std::string{"<b>"} + render(text) + std::string{"</b>"};
2015-04-22 09:39:07 +00:00
}};
2015-04-16 19:05:59 +00:00
};
mstch::node person() {
return mstch::map{{"name", std::string{"Jonas"}}};
}
};
const mstch::node nested_higher_order_sections_data = std::make_shared<nested_higher_order_sections>();