Skip to content

Conversation

@IJMacD
Copy link

@IJMacD IJMacD commented May 3, 2012

context.php:
Allow accessing first, second or third elements from an array
Access does not depend on array keys being named [0,1,2...]
filters.php:
Access second or third index from items
Added json filter
Limiting words could sometimes cut an html tag in half
tags.php:
Allow start index in {% for %} tag

Large number of changes in files is due to translating tabs -> spaces and trimming trailing spaces

IJMacD added 3 commits May 4, 2012 00:25
context.php:
    Allow accessing first, second or third elements from an array
    Access does not depend on array keys being [0,1,2,3...]
filters.php:
    Access second or third index from items
    Added json filter
    Limiting words could sometimes cut an html tag in half
tags.php:
    Allow start index in {% for %} tag
@IJMacD
Copy link
Author

IJMacD commented Jun 28, 2012

I've removed the 'second' and 'third' contexts but I have left access to first and last based on slices of the array instead of numerical indexes for the cases where the array does not use sequential numerical indexes.

Using array slices like this means that it shouldn't be too difficult to implement an array slice interface such as {{ items[2] }} or even more advanced such as {{ items[2:5] }} or {{ items[-4:] }} (I envisage python inspired indices could work) but I could look at this in the future and in a future pull request. :)

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

Successfully merging this pull request may close these issues.

2 participants