Archived
1
0
This repository has been archived on 2023-08-12. You can view files and clone it, but cannot push or open issues or pull requests.
nntpchan/contrib/backends/nntpchan-daemon/libmustache/mstch.cpp

19 lines
548 B
C++
Raw Normal View History

2017-10-11 18:48:27 +05:00
#include <iostream>
#include "mstch/mstch.hpp"
#include "render_context.hpp"
using namespace mstch;
2018-05-06 17:10:20 +05:00
std::function<std::string(const std::string &)> mstch::config::escape;
2017-10-11 18:48:27 +05:00
2018-05-06 17:10:20 +05:00
std::string mstch::render(const std::string &tmplt, const node &root,
const std::map<std::string, std::string> &partials)
2017-10-11 18:48:27 +05:00
{
std::map<std::string, template_type> partial_templates;
2018-05-06 17:10:20 +05:00
for (auto &partial : partials)
2017-10-11 18:48:27 +05:00
partial_templates.insert({partial.first, {partial.second}});
return render_context(root, partial_templates).render(tmplt);
}