gengle / cottle

High performance template engine for C#

Home Page:https://r3c.github.io/cottle/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cottle: Compact Object to Text Transform Language

Build Status NuGet license

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

About

High performance template engine for C#

https://r3c.github.io/cottle/

License:MIT License


Languages

Language:C# 99.7%Language:Shell 0.3%