You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While using Stubble.Helpers, I've encountered an issue that helpers are not working when used in a partial. I've traced the issue down to the PartialTokenRenderer, in particular this line:
Because the pipeline settings of the parent context are not passed to Parse (i.e. it's missing , pipeline: context.RendererSettings.ParserPipeline), partials are always rendered with a default pipeline, even if their parent had pipeline modifications.
Workaround
As this library seems a bit dead in terms of PRs/updates, a workaround is to copy the PartialTokenRenderer, then "simply" replacing the built-in renderer:
While using Stubble.Helpers, I've encountered an issue that helpers are not working when used in a partial. I've traced the issue down to the
PartialTokenRenderer
, in particular this line:Stubble/src/Stubble.Core/Renderers/StringRenderer/TokenRenderers/PartialTokenRenderer.cs
Line 45 in 4958ef8
Because the pipeline settings of the parent context are not passed to
Parse
(i.e. it's missing, pipeline: context.RendererSettings.ParserPipeline
), partials are always rendered with a default pipeline, even if their parent had pipeline modifications.Workaround
As this library seems a bit dead in terms of PRs/updates, a workaround is to copy the
PartialTokenRenderer
, then "simply" replacing the built-in renderer:While not exactly pretty, it gets the job done, and allows partials to use the same render pipeline that was configured for the original renderer.
The text was updated successfully, but these errors were encountered: