Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #8

Merged
merged 3 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# Ministache

A spec-complete implementation of the [Mustache](https://mustache.github.io/) templating language for Arduino. A sane alternative to building up complex strings via concatenation and custom code. Very useful for embedded web servers!
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

Expand Down
18 changes: 12 additions & 6 deletions examples/partials/partials.ino
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,24 @@ void setup() {
JsonDocument data;
deserializeJson(data, json);

// Create a template string that renders the data for a single person. This is a *partial*.
String personString = "Name: {{name}}\tRole: {{role}}\n";
// Create a template that renders the data for a single person. This is a *partial*.
auto personTemplate = "Name: {{name}}\tRole: {{role}}\n";

// Create a template string that renders the data for all people. This is the main template.
// Note that it loops over a field called "people" and includes the partial "person" for each of
// Create a template that renders the data for all people. This is the main template.
// Note that it loops over a data field called "people", and includes the partial "person" for each of
// them.
String reportString = "People report:\n{{#people}}{{> person}}{{/people}}";
auto reportTemplate = R"""(
People report:
{{#people}}
{{> person}}
{{/people}}
)""";

// Render the template with the data. The third argument is the partials list. This
// defines how to map a partial reference like "person" to a particular template
// ("personString").
String output = ministache::render(reportString, data, {{"person", personString}});
ministache::PartialList partials = {{"person", personTemplate}};
auto output = ministache::render(reportTemplate, data, partials);

// Print the result
Serial.println(output);
Expand Down
4 changes: 2 additions & 2 deletions library.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Ministache",
"version": "1.0.0",
"description": "Ministache is a small, fast and spec-complete implementation of the Mustache templating language for Arduino. All core Mustache tags are supported: interpolation, partials, sections, inverted sections, custom delimiters, and comments.",
"version": "1.0.1",
"description": "A small, fast and spec-complete implementation of the Mustache template language for Arduino, supporting interpolation, partials, sections, inverted sections, custom delimiters, and comments.",
"keywords": ["mustache", "moustache", "text", "text processor", "template", "logic-less", "html"],
"repository": {
"type": "git",
Expand Down
6 changes: 3 additions & 3 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name=Ministache
version=1.0.0
version=1.0.1
author=Brian Sharon <brian@floatplane.us>
maintainer=Brian Sharon <brian@floatplane.us>
sentence=Complete implementation of a Mustache template processor for Arduino
paragraph=Ministache is a small, fast and spec-complete implementation of the Mustache templating language for Arduino. All core Mustache tags are supported: interpolation, partials, sections, inverted sections, custom delimiters, and comments.
sentence=Mustache template engine for Arduino and ESP32 - render HTML templates dynamically
paragraph=A small, fast and spec-complete implementation of the Mustache template language for Arduino, supporting interpolation, partials, sections, inverted sections, custom delimiters, and comments.
category=Data Processing
url=https://github.com/floatplane/ministache
architectures=*
Expand Down
Loading