Comparing version 0.0.5 to 0.0.6
{ | ||
"name": "xsalt", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "A different kind of template engine", | ||
@@ -5,0 +5,0 @@ "main": "xsalt.js", |
@@ -7,3 +7,3 @@ # xsalt | ||
* I hate `{{value}}` style templating engines | ||
* I hate the phrase "syntactic sugar", so salt... | ||
* I hate the phrases "syntactic sugar" and "sugaring", so salt... | ||
* xsalt is a play on "XSLT", old school xml templating | ||
@@ -41,2 +41,3 @@ * once your templates are xsalt-ed, they are exalted | ||
var data = { | ||
@@ -66,2 +67,3 @@ users: [ | ||
var consoles = [ | ||
@@ -76,6 +78,24 @@ { text: "PS4", value: 1 }, | ||
// outputs: <option value="1">PS4</option><option value="2">XBOX One</option><option value="3">Wii U</option> | ||
// output: <option value="1">PS4</option><option value="2">XBOX One</option><option value="3">Wii U</option> | ||
console.log(options.compile(consoles)); | ||
// "wrapping" attributes | ||
var data = { | ||
users: [ | ||
{username: "bob", type: 1, id: 42}, | ||
{username: "lucy", type: 2, id: 98}, | ||
{username: "sandy", type: 1, id: 39}, | ||
{username: "jerry", type: 1, id: 74} | ||
] | ||
}; | ||
// output: <input type="text" value="bob" id="user_42"><input type="text" value="lucy" id="user_98"><input type="text" value="sandy" id="user_39"><input type="text" value="jerry" id="user_74"> | ||
var test = xsalt('<xs:input type="text" val="username" each="users">').compile(data, function( node, data ) { | ||
node.setAttribute("id", "user_" + data.id); | ||
}); | ||
### API | ||
Coming soon. For now see the examples. |
Sorry, the diff of this file is not supported yet
97
9765
180