Skip to content

Indentation reset when nesting Template #4

@sebascabot

Description

@sebascabot

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions