kainjow / Mustache
Licence: bsl-1.0
Mustache text templates for modern C++
Stars: ✭ 248
Labels
Projects that are alternatives of or similar to Mustache
Inlets Pro
Secure TCP and HTTP tunnels that work anywhere
Stars: ✭ 179 (-27.82%)
Mutual labels: mustache
Gluebert
gluebert.js is a tiny helper lazy loading DOM Elements, StyleSheets and JavaScript files using dynamic import and code splitting
Stars: ✭ 194 (-21.77%)
Mutual labels: mustache
Helm Charts
Helm charts for Kubernetes curated by Kiwigrid
Stars: ✭ 151 (-39.11%)
Mutual labels: mustache
Apacheexpress
Reliable Server Side Swift ✭ Make Apache great again!
Stars: ✭ 170 (-31.45%)
Mutual labels: mustache
Ramhorns
Fast Mustache template engine implementation in pure Rust.
Stars: ✭ 172 (-30.65%)
Mutual labels: mustache
Milk
Milk is Mustache in CoffeeScript -- great with your browser or NodeJS!
Stars: ✭ 192 (-22.58%)
Mutual labels: mustache
Spring Boot Email Tools
A set of services and tools for sending emails in a Spring Boot 1.5.x application using a Template Engine
Stars: ✭ 164 (-33.87%)
Mutual labels: mustache
Swagger Codegen
swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
Stars: ✭ 13,859 (+5488.31%)
Mutual labels: mustache
Bbmustache
Binary pattern match Based Mustache template engine for Erlang/OTP.
Stars: ✭ 141 (-43.15%)
Mutual labels: mustache
Micromustache
Ⓜ An extremely fast and small sub-implementation of the {{mustache}} template engine for JavaScript
Stars: ✭ 186 (-25%)
Mutual labels: mustache
About
- Mustache implementation for modern C++ (requires C++11)
- Header only
- Zero dependencies
- Templated string type for compatibility with any STL-like string (std::string, std::wstring, etc)
- Boost license
Example usage
All examples assume using namespace kainjow::mustache
. Additional examples and usage can be found in the tests.cpp
file.
Example 1 - Hello World
mustache tmpl{"Hello {{what}}!"};
std::cout << tmpl.render({"what", "World"}) << std::endl;
// Hello World!
Example 2 - Lists
mustache tmpl{"{{#employees}}{{name}}, {{/employees}}"};
data employees{data::type::list};
employees << data{"name", "Steve"} << data{"name", "Bill"};
tmpl.render({"employees", employees}, std::cout);
// Steve, Bill,
Example 3 - Custom Render Handler
mustache tmpl("Hello {{what}}!");
std::stringstream ss;
tmpl.render({"what", "World"}, [&ss](const std::string& str) {
ss << str;
});
// ss.str() == "Hello World!"
Supported Features
This library supports all current Mustache features:
- Variables
- HTML escaping
- Sections
- Inverted Sections
- True/False
- Lists
- Lambdas
- Partials
- Comments
- Set Delimiter
Additional features:
- Custom escape function for use outside of HTML
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].