Projects tagged ‘engine’, ‘generation’, and ‘template’


Jump to tag:

Projects tagged ‘engine’, ‘generation’, and ‘template’

Filtered by Project Tags engine generation template

Refine results Project Tags code (2) simple (1) performance (1) c (1) simpletemplate (1) generator (1) tools (1) .net (1) string (1) codegeneration (1) generators (1) tool (1)

[2 total ]

0 Users

A simple, light weight template engine which is designed to be embedded in a larger program. The template language is very simple, yet highly flexible. It can be used to generate C#, VB.Net, HTML ... [More] , XML and pretty much any other kind of text based output. [Less]
Created about 1 year ago.

0 Users

Introduction This project implements a simple templating system in C# using the Django style {{ varName }}, double curly notation. The class was implemented specifically for templatizing ... [More] html/javascript but can be used with any file type. The templates only do replacements. Unlike Django, there are no conditional statements, for loops etc.. This can all be accomplished within C# itself and keeps layout nicely separated from logic. Points of Interest Unlike StringTemplate from www.stringtemplate.org (which seems to be the best open source template engine written in c#) this template engine indexes the variable locations within the template instead of breaking the template into multiple chunks and putting them back together for output. The indexing occurs only once when the template is first used. It's then stored in a global dictionary with the filename as its key. The reason for indexing is the same reason you would use a StringBuilder rather than concatenation operators i.e. ("asdf" + "ghjk") to build strings. It keeps everything in one string, lowering the copy time and memory use associated with separating the template into many different strings and putting it back together for output. The only trade-off here is that you have to recalculate the indicies above an inserted variable by adding the length of the value inserted. I assumed this trade-off would be well worth it. These templates are currently in use on SpyFu.com. Background The real driver for me to create this was the frustration that came from trying to replicate the same ASP.NET user control several times on a page. While this can be done, I've only got it to work by putting all the code in markup and pasting the same markup (user control) over and over, or by putting all the code in code-behind files and creating all the HTML elements in C#...uck. While the first option is probably the best since the HTML is actually editable in its native format and the need for pagination usually means a limited number of controls, I knew that templates, after using Google App Engine and Django, would offer a more elegant solution. Note The tests included run within Visual Studio itself and to my knowledge are a new feature in Visual Studio 2008. Please download the source using the link on the right. There are tests as well as an example website to show you how to use templates. [Less]
Created 11 months ago.