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-12 22:19:55 +08:00
|
|
|
#include "utils.hpp"
|
2015-04-10 02:41:27 +08:00
|
|
|
|
|
|
|
using namespace mstch;
|
|
|
|
|
|
|
|
std::string mstch::render(
|
2015-04-11 22:29:12 +08:00
|
|
|
const std::string& tmplt,
|
2015-04-17 03:05:59 +08:00
|
|
|
const node& root,
|
2015-04-10 02:41:27 +08:00
|
|
|
const std::map<std::string,std::string>& partials)
|
|
|
|
{
|
2015-04-16 06:49:45 +08:00
|
|
|
std::map<std::string,template_type> partial_templts;
|
|
|
|
for(auto& partial: partials)
|
|
|
|
partial_templts.insert({partial.first, {partial.second}});
|
|
|
|
return render_context(root, partial_templts).render(tmplt);
|
2015-04-10 02:41:27 +08:00
|
|
|
}
|