Indentation reset when nesting Template #4

Open
sebascabot opened this Issue Feb 8, 2010 · 0 comments

Comments

Projects
None yet
1 participant

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment