Skip to content

unexpected auto-indents with for-loops #445

@zantiu

Description

@zantiu

Using Scriban v 5.4.6

Template:

{{~ for test in  ['A', 'B'] ~}}
  {{ test}}
{{~ end ~}}
{{~ for test in  ['A', 'B'] ~}}
  {{ test}}
{{~ end ~}}
{{~ for test in  ['A', 'B'] ~}}
  {{ test}}
{{~ end ~}}
{{~ for test in  ['A', 'B'] ~}}
  {{ test}}
{{~ end ~}}

{{~ for test in  ['A', 'B'] ~}}
  {{ test}}
{{~ end ~}}
{{~ for test in  ['A', 'B'] ~}}
  {{ test}}
{{~ end ~}}
{{~ for test in  ['A', 'B'] ~}}
  {{ test}}
{{~ end ~}}
{{~ for test in  ['A', 'B'] ~}}
  {{ test}}
{{~ end ~}}

produces following output, with an unexpected extra indent on the first item of the 2nd for-loop after a blank line in the template

  A
  B
  A
  B
  A
  B
  A
  B

  A
  B
    A
  B
  A
  B
  A
  B

Disabling the auto-indent with 'TemplateContext.AutoIndent = false' fixes the issue

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions