Permalink
Browse files

bugfix: whitespace in BLK should not be skipped

  • Loading branch information...
1 parent 66c7226 commit 1db1298176d904c4094900d24d987506aaca28c8 @kirbysayshi committed Mar 4, 2013
Showing with 297 additions and 100 deletions.
  1. +31 −2 build/vash-runtime-all.js
  2. +2 −2 build/vash-runtime-all.min.js
  3. +26 −2 build/vash-runtime.js
  4. +2 −2 build/vash-runtime.min.js
  5. +194 −84 build/vash.js
  6. +2 −2 build/vash.min.js
  7. +1 −1 package.json
  8. +0 −5 src/vparser.js
  9. +39 −0 test/vows/vash.test.js
View
@@ -1,5 +1,5 @@
/**
- * Vash - JavaScript Template Parser, v0.6.0-2085
+ * Vash - JavaScript Template Parser, v0.6.1-2481
*
* https://github.com/kirbysayshi/vash
*
@@ -28,6 +28,7 @@
var Helpers = function ( model ) {
this.buffer = new Buffer();
this.model = model;
+ this.options = null; // added at render time
this.vl = 0;
this.vc = 0;
@@ -157,7 +158,25 @@
Buffer.prototype.indexOf = function( str ){
for( var i = 0; i < this._vo.length; i++ ){
- if( this._vo[i] == str ){
+ if(
+ ( str.test && this._vo[i].search(str) > -1 )
+ || this._vo[i] == str
+ ){
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ Buffer.prototype.lastIndexOf = function( str ){
+ var i = this._vo.length;
+
+ while( --i >= 0 ){
+ if(
+ ( str.test && this._vo[i].search(str) > -1 )
+ || this._vo[i] == str
+ ){
return i;
}
}
@@ -386,6 +405,11 @@
delete model.onRenderEnd;
}
+ // ensure options can be referenced
+ if( !opts ){
+ opts = {};
+ }
+
return opts;
}
@@ -441,6 +465,11 @@
var helpers = vash.helpers;
+ // Trim whitespace from the start and end of a string
+ helpers.trim = function(val){
+ return val.replace(/^\s*|\s*$/g, '');
+ }
+
///////////////////////////////////////////////////////////////////////////
// EXAMPLE HELPER: syntax highlighting

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -1,5 +1,5 @@
/**
- * Vash - JavaScript Template Parser, v0.6.0-2085
+ * Vash - JavaScript Template Parser, v0.6.1-2481
*
* https://github.com/kirbysayshi/vash
*
@@ -28,6 +28,7 @@
var Helpers = function ( model ) {
this.buffer = new Buffer();
this.model = model;
+ this.options = null; // added at render time
this.vl = 0;
this.vc = 0;
@@ -157,7 +158,25 @@
Buffer.prototype.indexOf = function( str ){
for( var i = 0; i < this._vo.length; i++ ){
- if( this._vo[i] == str ){
+ if(
+ ( str.test && this._vo[i].search(str) > -1 )
+ || this._vo[i] == str
+ ){
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ Buffer.prototype.lastIndexOf = function( str ){
+ var i = this._vo.length;
+
+ while( --i >= 0 ){
+ if(
+ ( str.test && this._vo[i].search(str) > -1 )
+ || this._vo[i] == str
+ ){
return i;
}
}
@@ -386,6 +405,11 @@
delete model.onRenderEnd;
}
+ // ensure options can be referenced
+ if( !opts ){
+ opts = {};
+ }
+
return opts;
}
Oops, something went wrong.

0 comments on commit 1db1298

Please sign in to comment.