Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[new feature] Added `custom delimiters` in settings

  • Loading branch information...
commit 336155b15d63f3a45c4b60b499b5f29a09d9bbfc 1 parent 47c0309
@ben-lin ben-lin authored
Showing with 17 additions and 2 deletions.
  1. +10 −0 examples/nodejs/simple/custom_delimiters.js
  2. +7 −2 lib/thunder.js
View
10 examples/nodejs/simple/custom_delimiters.js
@@ -0,0 +1,10 @@
+var thunder = require( '../../../lib/thunder' );
+
+thunder.settings.open = '{{';
+thunder.settings.close = '}}';
+
+var input = '<div>Hello, this is {{=it.name}} :)</div>';
+var render = thunder.compile( input );
+var output = render({ name : 'Bibi' });
+
+console.log( output );
View
9 lib/thunder.js
@@ -30,7 +30,12 @@
var thunder = {
- version : '0.1.8',
+ version : '0.1.9',
+
+ settings : {
+ open : '<?',
+ close : '?>'
+ },
compiled_text : function ( input, options ){
var arr = ( options && options.compress === true ?
@@ -38,7 +43,7 @@
input.replace( /\n\r\t|\s+/g, ' ' ) :
// chage the new line to unix version
input.replace( /\n\r|\r/g, '\n' )).
- split( '<?' ).join( '?>\x1b' ).split( '?>' );
+ split( thunder.settings.open ).join( thunder.settings.close + '\x1b' ).split( thunder.settings.close );
var str = '';
var i = 0;
Please sign in to comment.
Something went wrong with that request. Please try again.