redding/deas — pull request #140 by kellyredding (2014-11-10 00:08:25+00:00)
Title: add `partial` method to template source/engine API

This method will be used to help tell the engine whether to consider
layouts or not. `render` means "consider any specified layouts the
view handler has when rendering". `partial` means "explicitly ignore
any layouts the handler has and don't render with any layouts".

This is an effort to simplify the render calls. Right now the runner
(`SinatraRunner`) has to do a fair bit of logic to consider layouts
and any specified layout option given on render calls. This is
unfortunate b/c not all templates even support layouts.

This shifts the implementation and logic overhead down to the engines.
Engines now should implement both a render and partial method. For
engines that don't render in layouts, the partial method should just
alias the render method and can be used interchangeably. Any engines
supporting layouts will gather the layouts from the view handler
like the runner currently does.

@jcredding sorry for the take-partial-out-add-it-back-in on these Deas updates. I was trying to implement the "sinatra engine" and found the stupid layout option frustrating to deal with. Especially at the common engine level as it may not even apply to the template you are rendering. Ultimately I decided layouts should be an engine level implementation detail. The two methods give the engines an implicit `:layout` option now. Make sense? Ready for review.