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

Nested function calls are not indented #556

Open
Arthri opened this issue Jun 29, 2024 · 1 comment
Open

Nested function calls are not indented #556

Arthri opened this issue Jun 29, 2024 · 1 comment

Comments

@Arthri
Copy link
Contributor

Arthri commented Jun 29, 2024

Consider a template written using recursive functions,

{{ func y
    if $0 > 5
        ret
    end
}}
{{ $0 }}
    {{ y ($0 + 1) }}
{{ end }}
{{ y 0 }}

The output is,



0

1

2

3

4

5







Whereas a similar template written using includes

{{ include 'y' 0 }}
{{ if $1 > 5
    ret
end }}
{{ $1 }}
    {{ include 'y' ($1 + 1) }}

instead outputs


0

    1

        2

            3

                4

                    5







@xoofx
Copy link
Member

xoofx commented Jul 30, 2024

Yes, afar, the indentation was introduced specifically for include but not for all blocks because it is costly. Not sure it is feasible to introduce this without a significant performance hit. It could be optional. Don't have time to look into this these days, but PR welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants