Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test showing decorator behaviour in deep partials #615

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rbtcollins
Copy link

@rbtcollins rbtcollins commented Oct 15, 2023

Hi! this is really a bug report in reproducible form.

I was puzzling over how to replicate the behaviour from the decorator example which writes into the context, when that was happening in partials.

I eventually realised that the decorator is called with the root context, and modifies the root context, rather than the partials own context.

I'm not familiar with the implementation details in this version of handlebars (though I did write pybars a long time ago :P - anyhow, if there is a specified way (for instance, there's an jsonpath defining the view the partial is executing with), or some other API to use, that would be great!

The use case I have is - I have a data structure that has some poor ergonomics, and I want to derive nicers views on the data, just in time.

As an example, in a template I'd like to write

{{*filter attributename condition outputname}}
{{#each outputname}}{{this.name}}{{/each}}

or other similar things. There might be hundreds of different places in the original data structure that need this done - doing them all in the root template would be a poor fit (a possible workaround I did consider).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant