Skip to content
Browse files

[new feature] Added `custom delimiters` in settings

  • Loading branch information...
1 parent 47c0309 commit 336155b15d63f3a45c4b60b499b5f29a09d9bbfc @ben-lin ben-lin committed Sep 26, 2013
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,15 +30,20 @@
var thunder = {
- version : '0.1.8',
+ version : '0.1.9',
+
+ settings : {
+ open : '<?',
+ close : '?>'
+ },
compiled_text : function ( input, options ){
var arr = ( options && options.compress === true ?
// compress
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;

0 comments on commit 336155b

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