Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
32335dc630
2 changed files with 71 additions and 1 deletions
69
README.md
69
README.md
|
@ -1 +1,68 @@
|
|||
# mstch [![Build Status](https://travis-ci.org/no1msd/mstch.svg?branch=master)](https://travis-ci.org/no1msd/mstch)
|
||||
# mstch - {{mustache}} templates in C++11
|
||||
|
||||
mstch is a complete implementation of [{{mustache}}](http://mustache.github.io/) templates using modern C++.
|
||||
|
||||
[![Build Status](https://travis-ci.org/no1msd/mstch.svg?branch=master)](https://travis-ci.org/no1msd/mstch)
|
||||
|
||||
## Basic usage
|
||||
|
||||
```c++
|
||||
#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
|
||||
|
||||
## Installing
|
||||
|
||||
From the root of the source tree:
|
||||
|
||||
```bash
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
$ cmake ..
|
||||
$ make
|
||||
$ make install
|
||||
```
|
||||
|
||||
### Running the unit tests
|
||||
|
||||
```bash
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
$ cmake -DWITH_UNIT_TESTS=ON ..
|
||||
$ make
|
||||
$ make test
|
||||
```
|
||||
|
||||
## Advanced usage
|
||||
|
||||
TODO
|
|
@ -21,3 +21,6 @@ set(SRC
|
|||
utils.cpp)
|
||||
|
||||
add_library(mstch STATIC ${SRC})
|
||||
|
||||
install(TARGETS mstch DESTINATION lib)
|
||||
install(FILES ${CMAKE_SOURCE_DIR}/include/mstch/mstch.hpp DESTINATION include/mstch)
|
Loading…
Reference in a new issue