aboutsummaryrefslogtreecommitdiff
path: root/lib/mstch/src/mstch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mstch/src/mstch.cpp')
-rw-r--r--lib/mstch/src/mstch.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/mstch/src/mstch.cpp b/lib/mstch/src/mstch.cpp
new file mode 100644
index 0000000..4d84e97
--- /dev/null
+++ b/lib/mstch/src/mstch.cpp
@@ -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);
+}