aboutsummaryrefslogtreecommitdiff
path: root/lib/mstch/src/mstch.cpp
blob: 4d84e97c582d2b71bf27f8c3520817ccd333271f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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);
}