Skip to content

Commit

Permalink
Modifying exports
Browse files Browse the repository at this point in the history
  • Loading branch information
zerious committed Apr 22, 2014
1 parent ec04b63 commit b1c7423
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
20 changes: 10 additions & 10 deletions ltl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* ltl is a template language designed to be simple, beautiful and fast.
*/

var ltl = (function () {
(function () {

// Allow leniency with tabs and spaces.
var tabWidth = 4;
Expand All @@ -13,7 +13,7 @@ var ltl = (function () {
var partsVar = 'p';

// Some HTML tags won't have end tags.
var selfClosePattern = /^(!DOCTYPE|br|hr|img|input|-|\/\/)(\b|$)/;
var selfClosePattern = /^(!DOCTYPE|area|base|br|hr|img|input|link|meta|-|\/\/)(\b|$)/;

// Supported control keywords (usage appears like tags).
var controlPattern = /^(for|if|else|else if)\b/;
Expand Down Expand Up @@ -621,12 +621,12 @@ var ltl = (function () {
return template;
}
};
return ltl;
})();

if (typeof window == 'undefined') {
module.exports = ltl;
}
else {
window.ltl = ltl;
}
if (typeof window == 'undefined') {
module.exports = ltl;
}
else {
window.ltl = ltl;
}

})();
5 changes: 3 additions & 2 deletions perf/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var ltlCode =
' li ={item}\n';

var jadeCode =
'doctype html\n' +
'html\n' +
' head\n' +
' title Hello World\n' +
Expand All @@ -22,13 +23,13 @@ var jadeCode =
' each item in items\n' +
' li #{item}\n';

var dotCode = '<html><head><title>Hello World</title></head>' +
var dotCode = '<!DOCTYPE html><html><head><title>Hello World</title></head>' +
'<body><div id="hey" class="a b" style="display:block;width:100px">' +
'Here\'s my message: {{=it.message}}</div><ul>{{' +
'for(var i=0;i<it.items.length;++i){it.item=it.items[i]; }}' +
'<li>{{=it.item}}</li>{{ } }}</ul></body></html>';

var context = {message: 'hello', items: ['apple', 'banana', 'orange', 'pear']};
var context = {message: 'hello', items: ['apples', 'apricots', 'bananas', 'cherries', 'grapes', 'kiwis', 'mangoes', 'oranges', 'pears', 'plums']};

console.log('');
console.log('doT:');
Expand Down

0 comments on commit b1c7423

Please sign in to comment.