Skip to content

[Fix] Examples to 'limit, offster and reversed'#489

Merged
xoofx merged 2 commits intoscriban:masterfrom
artur-simon:patch-1
Feb 25, 2023
Merged

[Fix] Examples to 'limit, offster and reversed'#489
xoofx merged 2 commits intoscriban:masterfrom
artur-simon:patch-1

Conversation

@artur-simon
Copy link
Copy Markdown
Contributor

@artur-simon artur-simon commented Feb 24, 2023

Fix on the documentation as the actual format seem to be a pipe leading to the array functions.

Example 1 (not working):

{{ 
    for i in 1..5 reversed
        i
    end 
}}

This gives us: error : Invalid target function '5' (int)

Example 2 (what actually worked):

{{ 
    for i in 1..5 | array.reversed
        i
    end 
}}

This gives us: 5 4 3 2 1 as expected.

This is the same for the limit and the offset parameters.

Tried it over the playground and it checks out.

https://scribanonline.azurewebsites.net/

The examples in the documents doesn't seem to be working, this is the actual format that works.
@xoofx
Copy link
Copy Markdown
Member

xoofx commented Feb 25, 2023

It might be more a parsing bug than a documentation bug, because this should be supported (in the test files there are offset/reversed test, but only with a simple variable for the iterator)

@xoofx
Copy link
Copy Markdown
Member

xoofx commented Feb 25, 2023

Actually It's not parsing related but here

[Edit]Hm, ok investigating, but maybe it is actually a parsing bug 😅

Comment thread doc/language.md Outdated
Comment thread doc/language.md Outdated
Comment thread doc/language.md Outdated
@xoofx xoofx merged commit eec90d7 into scriban:master Feb 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants