Skip to content
Browse files

Updated templayed.js (to v0.1.1)

  • Loading branch information...
1 parent c2caad7 commit d6e3d8836286ce71574b02d04e4b9617a7ee46e2 Paul Engel committed Mar 28, 2012
Showing with 9 additions and 9 deletions.
  1. +4 −4 README.textile
  2. +5 −5 templayed.js
View
8 README.textile
@@ -1,6 +1,6 @@
h1. templayed.js
-A micro (Mustache.js compliant) Javascript templating library
+A micro (Mustache.js compliant) Javascript templating library written in 1771 bytes (uncompressed)
h2. Introduction
@@ -12,9 +12,9 @@ h2. Introduction
So out of pure curiosity, I have written @templayed.js@ to see whether it can be written more compact with the following as result:
-* uncompressed: 1751 bytes
-* YUI compressed: 827 bytes
-* YUI compressed and gzipped: 490 bytes
+* uncompressed: 1771 bytes
+* YUI compressed: 846 bytes
+* YUI compressed and gzipped: 496 bytes
It does not have dependencies and it supports the following Mustache.js features:
View
10 templayed.js
@@ -1,14 +1,14 @@
if (typeof(templayed) == "undefined") {
// *
-// * templayed.js 0.1.0 (Uncompressed)
-// * A micro (Mustache.js compliant) Javascript templating library
+// * templayed.js 0.1.1 (Uncompressed)
+// * A micro (Mustache.js compliant) Javascript templating library written in 1751 bytes (uncompressed)
// *
// * (c) 2012 Paul Engel (Internetbureau Holder B.V.)
// * Except otherwise noted, templayed.js is licensed under
// * http://creativecommons.org/licenses/by-sa/3.0
// *
-// * $Date: 2012-03-03 01:41:29 +0100 (Sat, 03 March 2012) $
+// * $Date: 2012-03-28 21:13:11 +0100 (Wed, 28 March 2012) $
// *
templayed = function(template, vars) {
@@ -23,7 +23,7 @@ templayed = function(template, vars) {
}
};
- return template.replace(/{{(\^|#)(.*?)}}(.*?){{\/\2}}/g, function(match, operator, key, context) {
+ return template.replace(/\n/g, " ").replace(/{{(\^|#)(.*?)}}(.*?){{\/\2}}/g, function(match, operator, key, context) {
var string = "", entry = fetch(key, vars), dup, i;
if (operator == "^" || typeof(entry) == "boolean") {
return ((entry instanceof Array) && entry.length) || entry === false ? string : templayed(context, vars);
@@ -50,6 +50,6 @@ templayed = function(template, vars) {
};
-templayed.version = "0.1.0";
+templayed.version = "0.1.1";
}

0 comments on commit d6e3d88

Please sign in to comment.
Something went wrong with that request. Please try again.