#include #include #include #include #include "crow/json.h" #include "crow/mustache.h" using namespace std; using namespace crow; using namespace crow::mustache; string read_all(const string& filename) { ifstream is(filename); return {istreambuf_iterator(is), istreambuf_iterator()}; } int main() { auto data = json::load(read_all("data")); auto templ = compile(read_all("template")); auto partials = json::load(read_all("partials")); set_loader([&](std::string name) -> std::string { if (partials.count(name)) { return partials[name].s(); } return ""; }); context ctx(data); cerr << dump(ctx) << endl; cout << templ.render(ctx); return 0; }