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

[Mustache] Incorrect indentation after indented section #196

Open
adelbertc opened this issue Aug 29, 2018 · 3 comments
Open

[Mustache] Incorrect indentation after indented section #196

adelbertc opened this issue Aug 29, 2018 · 3 comments

Comments

@adelbertc
Copy link

adelbertc commented Aug 29, 2018

Given the template:

spec:
  {{#envvars}}
  env:
    {{#envvars_list}}
      {{envvar_name}}: {{envvar_value}}
    {{/envvars_list}}
  {{/envvars}}
  resources:
    requests:
      cpu: 1

and environment:

Map(
  "envvars" -> Map(
    "envvars_list" -> List(Map("envvar_name" -> "FOO", "envvar_value" -> 1024))
  )
)

I expect (note how the indentation of resources is preserved from the template):

spec:
  env:
    FOO: 1,024
  resources:
    requests:
      cpu: 1

However it seems Scalate gives (note how resources is indented an extra two spaces):

spec:
  env:
    FOO: 1,024
    resources:
    requests:
      cpu: 1

I've created a repo that you should be able to just pull and sbt run here: https://github.com/adelbertc/scalate-test

@adelbertc
Copy link
Author

adelbertc commented Aug 29, 2018

A workaround (in YAML anyways) is adding a {{_}} or a comment in between the lines in question. For instance:

spec:
  {{#envvars}}
  env:
    {{#envvars_list}}
      {{envvar_name}}: {{envvar_value}}
    {{/envvars_list}}
  {{/envvars}}
  {{! hack }}
  resources:
    requests:
      cpu: 1

Will give (which incidentally is valid YAML.. I think):

spec:
  env:
    FOO: 1,024
    # there's whitespace here up to the '#'
  resources:
    requests:
      cpu: 1

@tamas-nemeth
Copy link

Spaces are also getting removed after mustache functions (same syntax as iterations and conditions).
I would appreciate a fix for this.

@pierzchalski
Copy link

I'm also running into similar issues with whitespace. Any updates on this issue?

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

3 participants