]> Creatis software - cpPlugins.git/blobdiff - lib/mstch/mstch.cpp
Moved to version 1.0
[cpPlugins.git] / lib / mstch / mstch.cpp
diff --git a/lib/mstch/mstch.cpp b/lib/mstch/mstch.cpp
new file mode 100644 (file)
index 0000000..4d84e97
--- /dev/null
@@ -0,0 +1,20 @@
+#include <iostream>
+
+#include "mstch/mstch.hpp"
+#include "render_context.hpp"
+
+using namespace mstch;
+
+std::function<std::string(const std::string&)> mstch::config::escape;
+
+std::string mstch::render(
+    const std::string& tmplt,
+    const node& root,
+    const std::map<std::string,std::string>& partials)
+{
+  std::map<std::string, template_type> partial_templates;
+  for (auto& partial: partials)
+    partial_templates.insert({partial.first, {partial.second}});
+
+  return render_context(root, partial_templates).render(tmplt);
+}