Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/floatplane/ministache

Spec-complete implementation of Mustache templates for Arduino
https://github.com/floatplane/ministache

arduino mustache mustache-templating text-templating text-templating-engine

Last synced: about 2 months ago
JSON representation

Spec-complete implementation of Mustache templates for Arduino

Awesome Lists containing this project

README

        

[![PlatformIO Registry](https://badges.registry.platformio.org/packages/floatplane/library/Ministache.svg)](https://registry.platformio.org/libraries/floatplane/Ministache)
[![.github/workflows/build.yml](https://github.com/floatplane/ministache/actions/workflows/build.yml/badge.svg)](https://github.com/floatplane/ministache/actions/workflows/build.yml)
[![.github/workflows/test.yml](https://github.com/floatplane/ministache/actions/workflows/test.yml/badge.svg)](https://github.com/floatplane/ministache/actions/workflows/test.yml)
[![.github/workflows/static_analysis.yml](https://github.com/floatplane/ministache/actions/workflows/static_analysis.yml/badge.svg)](https://github.com/floatplane/ministache/actions/workflows/static_analysis.yml)
[![.github/workflows/clangformat.yml](https://github.com/floatplane/ministache/actions/workflows/clangformat.yml/badge.svg)](https://github.com/floatplane/ministache/actions/workflows/clangformat.yml)
[![BuyMeACoffee](https://raw.githubusercontent.com/pachadotdev/buymeacoffee-badges/main/bmc-donate-yellow.svg)](https://www.buymeacoffee.com/floatplane)

# Ministache

A spec-complete implementation of the [Mustache](https://mustache.github.io/) template language for Arduino. The best way to generate complex text content such as HTML, with full support for all Mustache features and 100% test coverage. A sane alternative to building up complex strings via concatenation and custom code. Very useful for embedded web servers!

## Features

Complete support for all elements of the [Mustache core specification](https://github.com/mustache/spec) version 1.4.1, with 100% of tests passing. Supported features:

- Interpolation
- Sections
- Iteration
- Partials
- Comments
- Custom delimiters

See the [mustache documentation](https://mustache.github.io/mustache.5.html) for more details on these features.

## Basics

```c++
ArduinoJson::JsonDocument data;
data[F("subject")] = F("world");
const String output = ministache::render(F("Hello, {{subject}}!"), data);
Serial.println(output); // Hello, world!
```

See [basic.ino](examples/basic/basic.ino) for a sketch demonstrating basic Ministache usage.

## Partials

Partials are a powerful Mustache feature, allowing you to define a chunk of template code and use it in a loop. See [partials.ino](examples/partials/partials.ino) for a sketch demonstrating how to use partials with Ministache.

## Projects using Ministache

- [floatplane/MitsuQTT](https://github.com/floatplane/MitsuQTT)

## Support

I hope this is useful to you! If it is, then maybe you'd like to buy me a coffee? :blush:

Buy Me A Coffee