Lightweight & extensible template library for .NET 3.5 and above.
C#
Latest commit 7ff6baf Jan 30, 2017 @r3c Add packaging script.
Permalink
Failed to load latest commit information.
Cottle.Demo Coding style: remove variable alignment. Jan 29, 2017
Cottle.Test Fix and add tests to format() builtin function. Jan 29, 2017
Cottle Add packaging script. Jan 30, 2017
.gitignore
.travis.yml Inline Travis CI configuration & remove unused settings. Dec 10, 2016
Cottle.sln Rename DefaultScope to BuiltinScope, improve compiler locals, add tests. Jun 4, 2014
LICENSE.md Add abstractions to Document & Scope, simplify common functions usage… May 1, 2013
README.md Fix README.md file. Feb 20, 2016
TODO.md Reorder some instructions in dynamic compiler, update assembly version. Jun 10, 2014
global.json Add basic support for coreclr (#3) Aug 8, 2016
icon.png

README.md

Cottle: Compact Object to Text Transform Language

Build Status

Overview

Cottle is an open-source (MIT) templating engine for C# .NET designed to be light, fast and extensible. If you never used a templating engine before, here is a simple example about how it could be used:

  • A program of yours generated some structured data, for example a list of products with associated name, description, quantity and price for each of them.
  • You want to make out an invoice from this list, meaning you want to render them as a formatted output like an HTML page, an XML document or a plain text file.
  • By writing a template, which is a file that describes how your inputs should be rendered to produce the final invoice, Cottle allows you to manage this data transform. Once your template is ready, it can be re-used with any products list as long as it keeps the same structure (to keep with our example, products with names, descriptions, quantities and prices).

Template files must be written using Cottle's template language as explained in user manual (see "Installation" section).

Installation

This repository contains a Visual Studio 2010 C# solution with two projects:

  • Cottle, the library itself, which is the project you'll include in your own solution if you want to use it. It is compatible with .NET 3.5 and above.
  • Demo, a simple Windows Form test program that allows you to write templates directly in a text box and render them using predefined data.

User manual is available at http://r3c.github.io/cottle/ (or in "gh-pages" branch of this repository) and explains how to use the library with many code snippets and examples.

Licence

This project is open-source, released under MIT licence. See "LICENSE" file for more information. Any contribution would be of course highly welcomed!

Author

Rémi Caput (cottle [at] mirari [dot] fr) http://remi.caput.fr/

If you use my library, please drop me a line!