samskivert / jmustache

A Java implementation of the Mustache templating language.
Other
834 stars 128 forks source link

added MustacheCustomContext #103

Closed devinrsmith closed 6 years ago

devinrsmith commented 6 years ago

Hoping that something like this would work.

Fixes https://github.com/samskivert/jmustache/issues/102

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.03%) to 82.553% when pulling 433e9677d4fdb8a695c25bbe848647d7b9bcfbd6 on devinrsmith:feature/mustache-source into 4533567303c5dd061b2925f30730a2b2b3fb1f34 on samskivert:master.

samskivert commented 6 years ago

This seems fine to me. Technically you could already make your own custom subclass of BasicCollector (or DefaultCollector) and use it in conjunction with your own custom context class, but that's a lot of fooling around for something that is a lot simpler with this built-in mechanism.

I'm going to rename MustacheCustomContext to Mustache.CustomContext to match all the other inner classes and interfaces that are used by Mustache. It would be rather odd to have half a dozen extension points that are all scoped inside the Mustache class and then have this one thing be scoped at the top-level.

devinrsmith commented 6 years ago

Thanks for the fast merge!