UI Templating: very basic.

UI Templating: very basic.


Okay, so after trying to work out uber complicated templates for the
UI, i ended up just going for my own simple method. I've written it as
a UI plugin, because there's no need for it elsewhere at this stage.
API below.
$.ui.tbTemplate(template, keys, values) // Returns string.
@@ template:
String or Array of template.
@@ keys:
Keys to access objects in the template.
@@ values:
Values to replace keys with when found.
eg:
                var id = 'hello'; var text = 'hello2';
                var toolbarBtn_tpl = new Array();
                toolbarBtn_tpl.push(
                    '<li id="{{id}}">',
                        '<span> {{text}} <'+'/span>',
                    '</li>'
                );
                template = $.ui.tbTemplate(toolbarBtn_tpl, ['id', 'text'], [id,
text]);
returns:
                '<li id="hello"><span> hello2 </span></li>'
You can grab the code here:
http://pastie.caboo.se/91713