diff --git a/README.md b/README.md index 4f68f47..33f9f63 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,30 @@ if your compiler supports it. ### Partials -TODO +Partials can be passed in a `std::map` as the third parameter of the +`mstch::render` function: + +```c++ +std::string view{"{{#names}}{{> user}}{{/names}}"}; +std::string user_view{"{{name}}\n"}; +mstch::map context{ + {"names", mstch::array{ + mstch::map{{"name", std::string{"Chris"}}}, + mstch::map{{"name", std::string{"Mark"}}}, + mstch::map{{"name", std::string{"Scott"}}}, + }} +}; + +std::cout << mstch::render(view, context, {{"user", user_view}}) << std::endl; +``` + +The output will be: + +``` +Chris +Mark +Scott +``` ### Lambdas