mstch is a complete implementation of {{mustache}} templates using modern C++
Find a file
2015-04-24 01:35:29 +02:00
include/mstch full lambda support 2015-04-23 15:55:18 +02:00
src rewrite html_escape without boost replace 2015-04-24 01:02:25 +02:00
test refactor tokenizer with delimiter change support 2015-04-24 00:35:13 +02:00
.gitignore moved to lambda tests 2015-04-12 17:12:52 +02:00
.travis.yml use gcc 4.9 2015-04-22 12:35:34 +02:00
CMakeLists.txt reformat 2015-04-23 12:54:08 +02:00
LICENSE Initial commit 2015-04-09 20:14:44 +02:00
README.md update readme 2015-04-24 01:35:29 +02:00

mstch - {{mustache}} templates in C++11

mstch is a complete implementation of {{mustache}} templates using modern C++. Build Status

Basic usage

#include <iostream>

#include <mstch/mstch.hpp>

int main() {
  std::string view{"{{#names}}Hi {{name}}!\n{{/names}}"};
  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) << std::endl;
  
  return 0;
}

The output of this example will be:

Hi chris!
Hi mark!
Hi scott!

Requirements

  • A C++ compiler with decent C++11 support. Currently only tested with GCC 4.9.
  • Boost 1.54
  • CMake for building

Building

From the root of the source tree:

 $ mkdir build
 $ cd build
 $ cmake ..
 $ make

Building with unit tests:

 $ mkdir build
 $ cd build
 $ cmake -DWITH_UNIT_TESTS=ON ..
 $ make
 $ make test

Advanced usage

TODO