tests-always-included / mo

Mustache templates in pure bash
Other
563 stars 67 forks source link

Indentation of partial directly after if is incorrect #19

Closed jakeheis closed 7 years ago

jakeheis commented 7 years ago

When including a partial directly after an if statement, only the first line is correctly indented.

template:

lines:
  {{#include}}
  {{> partial.yml }}
  {{/include}}
key: value

partial:

- first line
- second line

When include="true":

Expected:

lines:
  - first line
  - second line
key: value

Got:

lines:
  - first line
- second line
key: value

I'm working around this currently by adding a comment between the if statement and the partial:

template:

lines:
  {{#include}}
  # Fixes indentation
  {{> partial.yml }}
  {{/include}}
key: value

Output (which is correct):

lines:
  # Fixes indentation
  - first line
  - second line
key: value
fidian commented 7 years ago

I've just pushed some changes that should close this issue. Would you take a look and see if those changes also work for you?

jakeheis commented 7 years ago

That fixes the issue, thanks so much!