]> Creatis software - cpPlugins.git/blob - lib/mstch/mstch.cpp
Moved to version 1.0
[cpPlugins.git] / lib / mstch / mstch.cpp
1 #include <iostream>
2
3 #include "mstch/mstch.hpp"
4 #include "render_context.hpp"
5
6 using namespace mstch;
7
8 std::function<std::string(const std::string&)> mstch::config::escape;
9
10 std::string mstch::render(
11     const std::string& tmplt,
12     const node& root,
13     const std::map<std::string,std::string>& partials)
14 {
15   std::map<std::string, template_type> partial_templates;
16   for (auto& partial: partials)
17     partial_templates.insert({partial.first, {partial.second}});
18
19   return render_context(root, partial_templates).render(tmplt);
20 }