Skip to content

Duplicated Auto-Indent #451

@Arthri

Description

@Arthri

Using Scriban v5.4.6

Template:

{{ "b" }}
Normal Text
    {{ "indented text" }}

Output:

b
Normal Text
        indented text

Expected:

b
Normal Text
    indented text

FWIW, I tried investigating it myself. {{ "b" }} causes the TemplateContext's _previousTextWasNewLine to be set to true. Then, Normal Text\n[THE 4 SPACES INCLUDED] is printed to the output(_previousTextWasNewLine is not set to false here). Finally, {{ "indented text" }} is printed to the output. Since _previousTextWasNewLine is true at the final step, the current indent is re-printed as if it were a new and blank line, causing the indent to duplicate

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions