Project Description
A text templating class library for .NET 3.5 and 4.0 written in C#.

This class library for.NET 3.5 and 4.0 allows you to write text templates containing code, and execute them at runtime, producing text. You can use these to produce code files, mail merge content, or just about any other text output.

Version 2.0 is out!

This release contains major new features, as well as all bugfixes that went into 1.1.

New features
  • Generic Template<T> class, for passing type-safe parameters to template execution
  • Ability to "unwrap" parameters, exposing the public properties as parameters instead of the wrapper parameter
  • {<%+} code block to add code outside of the generator method, in order to be able to add extra methods and nested classes

Breaking changes
  • Async methods have been removed

Issues fixed for this release
  • Invalid/unknown directives did not throw an exception during template parsing. (also in 1.1)
  • When {<%+} blocks have been started, the programmer cannot switch back to normal blocks, {<%} and {<%=} without having them ordered before the {<%+} blocks.
  • A percentage-sign on its own outside a code block breaks the template parser. (also in 1.1)
  • A less-than sign on its own outside a code block breaks the template parser. (also in 1.1)

Changes
  • ReSharper settings changed to avoid too much code reordering and reformatting to avoid merge conflicts during parallel development. (also in 1.1)
  • Introduced TemplateSyntaxException to replace InvalidOperationException for some problems related to template parsing. (also in 1.1)

Additions
  • Sandcastle project files for building online documentation. (also in 1.1)

Features
  • Language: C# 3.0
  • Runtime: .NET 3.5 Client Profile or .NET 4.0 Client Profile
  • NuGet package here: TextTemplate
  • Language in template is C# 3.0 or 4.0 (Will look into adding support for VB.NET or other languages later.)
  • Can reference other assemblies, like ones from your program
  • Generic parameterization, you can pass custom data structures to the template engine, to control the template execution and provide information to it
  • All source code available, fully documented (that is, all public types and methods will have full XML documentation, source itself hopefully won't need comments)
  • Online documentation
  • Build status

Last edited Apr 16, 2011 at 8:39 PM by lassevk, version 12