Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indentation reset when nesting Template #4

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

Indentation reset when nesting Template #4

sebascabot opened this issue Feb 8, 2010 · 0 comments

Comments

@sebascabot
Copy link

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant