rails/rails — pull request #8530 by dasch (2012-12-16 22:49:04+00:00)
Title: Custom dependency trackers for the template digestor

I'm working on a Liquid style templating system, and would like to take advantage of Action View's template digestor. However, there are no direct calls to `render` from within the template itself, but rather in an accompanying "presenter"/"view model"/whatever. Therefore, the approach currently taken by Digestor falls short of tracking the dependencies. Furthermore, since these templates would be user-supplied, I would rather avoid having to put in explicit dependency markers in the source itself, instead preferring to let the presenters do that.

I've refactored Digestor so that it is possible to register a custom dependency tracker. I'm not sure if the nomenclature is perfect, so I'm of course open for suggestions.

Currently, the tracker is chosen based on the template handler, which should roughly correspond to the template language. I'd like a better way of looking up trackers, e.g. by having each Template know its "language". That would be a bigger change than seems necessary right now, though.

Another question is whether the dependency tracker should default to the ErbTracker, which perhaps should be renamed. I'm not sure what level of support there is for non-Erb templating languages in Digestor right now.

Thanks for taking a look at this, I'd really love to be able to work with the new digest code :-)