Awesome
Cottle: Compact Object to Text Transform Language
Overview
Cottle is an open-source (MIT) templating engine for C# .NET designed to be light (no external dependency & simple API), fast (see benchmark) and extensible (see advanced features).
Sample
Hello, {name}!
{if len(messages) > 0:
You have {len(messages)} new message{if len(messages) > 1:s} in your mailbox!
|else:
You have no new message.
}
var document = Document.CreateDefault(template).DocumentOrThrow;
return document.Render(Context.CreateBuiltin(new Dictionary<Value, Value>
{
["messages"] = GetMessages(),
["name"] = "JC Denton"
}));
Resource
- Home page: https://r3c.github.io/cottle/
- Documentation: https://cottle.readthedocs.io/
- Benchmark: https://r3c.github.io/cottle/benchmark.html
- NuGet package: https://www.nuget.org/packages/Cottle
- Contact: v.github.com+cottle [at] mirari [dot] fr
- License: license.md