Project Description
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, XML and pretty much any other kind of text based output.

HappyTemplate is feature-complete and is fully functional now. This is the first beta release, so there are probably a few minor bugs, however the author is currently unemployed and has lots of free time and therefore welcomes all of your bug reports, feature requests and feedback.

2/18/2009: I am making good progress on the next release. I've even checked in a (mostly) functional version of it which will include the aforementioned 30+ built-in functions for manipulating strings and comparing values, as well as a simple method of exposing your own custom built-in functions to HappyTemplate. Download the latest source code and check out the BuiltInFunctionBase class.

2/12/2009: The next release will include 30+ built-in functions for manipulating strings and comparing values, etc as well as a method for making your own built-in functions accessible to your template sets. It's currently in development and will be checked in soon.

2/8/2009: Pre-built binaries and complete documentation for version 0.1 has been released. Click here to download


HappyTemplate example:

main()  /* Template output starts here! */
<{ 
<$
	foreach(table in database.Tables)
		createTable(table)
	next
$>
}>

lookup typeLookup
{
	"Integer" = "INT",
	"String" = "NVARCHAR",
	"DateTime" = "DATETIME"
}

columnType(column)
<{<$
	typeLookup[column.DataType]
	if(column.Length)
		"(" column.Length ")"
	endif
$>}>
 
tableName(table) <{<$ "[" table.Schema "].[" table.Name "]" $>}>

createTable(table)
<{
IF OBJECT_ID('<$tableName(table)$>') IS NOT NULL DROP TABLE <$tableName(table)$>
GO
CREATE TABLE <$tableName(table)$>
(
	<$foreach(column in table.Columns between ",\n\t")
		column.Name " " columnType(column)
		if(column.Identity)
			" IDENTITY"
		endif
		if(column.PrimaryKey)
			" PRIMARY KEY"
		endif
	next	
	$>
)
GO
}>

Last edited Feb 19, 2009 at 5:16 AM by psydave, version 10