mstch/src/mstch.cpp

19 lines
461 B
C++
Raw Normal View History

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