CloudyKit / jet

Jet template engine
Apache License 2.0
1.26k stars 106 forks source link

ranger: Fix bugs and expand documentation #200

Closed matheusd closed 1 year ago

matheusd commented 1 year ago

This fixes a bug when looping over an unindex ranger (i.e. a ranger that returns false for its ProvidesIndex() method).

Previously, the context for the range was not properly set, so it made it impossible to use the context in such rangers.

This also fixes a panic when attempting to use an unindexed ranger without a corresponding 'set' action.

Additionally, it adds additional documentation for how custom rangers should be written.

sauerbraten commented 1 year ago

Thanks a lot! Feel free to complete the markdown docs as well, I saw the section on custom rangers is still marked as TODO: https://github.com/CloudyKit/jet/blob/master/docs/syntax.md#range

sauerbraten commented 1 year ago

Oh and if you could describe the gist of the changes in one short sentence I can use in release notes, that would be great! I guess this is not a breaking change, but could some users be affected when they accidentally relied on the buggy behavior?

matheusd commented 1 year ago

Will do. For future reference, what is your preferred method to receive the short sentences for use in release notes? In the PR itself? Or maybe we can start tracking such changes in a docs/next-release-changes.md (or whatever) file and enforce any relevant PRs/commits to have a line there?

sauerbraten commented 1 year ago

I think it's enough if I ask for such a summary in the PRs when I don't think we have a deep enough understanding to write them myself. So feel free to write a comment here for now 👌

matheusd commented 1 year ago

Release note:

Fixed a panic generated when ranging over a channel or other custom rangers without setting the value to variable.