jaml
jaml copied to clipboard
Indentation reset when nesting Template
I was please to see the indent feature, especially since it match my coding style (a 2 space indent ;-)
But, I notice, indentation got reset when nesting template.
Ex. The following JavaScript
var sys = require("sys"); var Jaml = require("jaml").Jaml; /* --------------------------------------------------------------- */ Jaml.register('html', function(data) { html( head( title( 'Jaml rocks' ) ), body( Jaml.render('body-content', data) ) ); }); /* --------------------------------------------------------------- */ Jaml.register('body-content', function(data) { h1( 'Why Jaml rocks' ), ul( Jaml.render('reason', data.reasons) ) }); /* --------------------------------------------------------------- */ Jaml.register('reason', function(reason) { li( reason ); }); /* --------------------------------------------------------------- */ sys.puts(Jaml.render('html', { reasons: [ 'too cool to be true', 'elegant syntax; easy to read, easy to use', 'great combo with node.js' ] }));
Ouput
<html> <head> <title>Jaml rocks</title> </head> <body><h1>Why Jaml rocks</h1> <ul><li>too cool to be true</li> <li>elegant syntax; easy to read, easy to use'</li> <li>great combo with node.js</li> </ul> </body> </html>
Instead of the hope result
<html> <head> <title>Jaml rocks</title> </head> <body> <h1>Why Jaml rocks</h1> <ul> <li>too cool to be true</li> <li>elegant syntax; easy to read, easy to use'</li> <li>great combo with node.js</li> </ul> </body> </html>
Do you have any plan to support proper indention when nesting template ?
Thanks.