Extract partial rendering to RenderPartialsHelper

Added a cache to avoid having to repeat template lookups several times
per request.