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

How to access part of a list? #929

Closed
jonashao opened this issue Dec 16, 2016 · 8 comments
Closed

How to access part of a list? #929

jonashao opened this issue Dec 16, 2016 · 8 comments

Comments

@jonashao
Copy link

in jinja2, we can access part of a list by:
{% for post in site.posts | list[0:4] %}
or
{% for post in site.posts[0:4] %}

but nunjucks seems not provided these filters,

splice can devide a list into serveral parts, but if I only need first n elements, how to do?

@ricordisamoa
Copy link
Contributor

It seems that the new maintainer doesn't think that Python's splice notation is within the project's scope (#851)

@zetareticoli
Copy link

Any update about that?

@ArmorDarks
Copy link

#976

@zetareticoli
Copy link

Cool. When a new release is planned?

@krassowski
Copy link

@zetareticoli and anyone concerned: it was released on 24th of May! :)
@jonashao it seems that this issue could be closed.

@fdintino
Copy link
Collaborator

Thanks @krassowski . Fixed with #976

@zetareticoli
Copy link

Not found any documentation on how to use it.

Please, link=

@fdintino
Copy link
Collaborator

@zetareticoli: documentation here. Call that function and you'll be able to use it in your templates the same as you would with jinja2.

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

6 participants