ractivejs/ractive — pull request #1349 by evs-chris (2014-10-14 01:43:36+00:00)
Title: Make @ references resolve at render rather than parse - RFC

This is a sort of mixture of #1303, #1035, and a thing I needed (@keypath). So, here's what this does

* Make `@index` and `@key` resolve during render instead of mapping to an `indexRef`.
* Consequently, `indexRef`s can be used alongside `@index` and `@key`.
* `@index` and `@key` are also now available in any iterative section. Not sure if that was wanted, but it's certainly convenient at times. Also, it shouldn't interfere with anything, as `@whatever` is not valid javascript and was already a syntax error. Currently anything other than index, key, and keypath will through an invalid mustache error.
* Introduces `@keypath`, which finds the nearest context/keypath and resolves to the string. I needed this for an event within a `{{#with}}` where I was trying to update a value based on keypath, which got destroyed by the `{{#with}}`. I'm not sure if this is ideal or wanted, but it's relatively unobtrusive and solved my case nicely. `{{# with { keypath: @keypath, ... } }}... with an event Here's a fresh keypath{{/with}}`
* Adding another special ref should be much simpler: just add a case to `src/shared/resolveSpecialRef.js`

#### How it works

Instead of walking all over the template tree in a converter looking for index refs and installing aliases, this just adds another hook `specialRef