mstch/src/mstch.cpp

19 lines
461 B
C++
Raw Normal View History

2015-04-10 02:41:27 +08:00
#include <iostream>
2015-04-12 21:35:13 +08:00
#include "mstch/mstch.hpp"
#include "render_context.hpp"
2015-04-10 02:41:27 +08:00
using namespace mstch;
std::string mstch::render(
2015-04-23 18:54:08 +08:00
const std::string& tmplt,
const node& root,
const std::map<std::string,std::string>& partials)
2015-04-10 02:41:27 +08:00
{
2015-04-23 21:55:18 +08:00
std::map<std::string, template_type> partial_templates;
2015-04-23 18:54:08 +08:00
for (auto& partial: partials)
2015-04-23 21:55:18 +08:00
partial_templates.insert({partial.first, {partial.second}});
2015-04-27 20:14:21 +08:00
2015-04-23 21:55:18 +08:00
return render_context(root, partial_templates).render(tmplt);
2015-04-10 02:41:27 +08:00
}