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

Added option to allow access to entire ScopeChain from within macros. Default behavior is as before #611

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

Conversation

SharkFourSix
Copy link

  • Added configuration variable globalScoping to pebble/src/main/java/com/mitchellbosecke/pebble/PebbleEngine.java:66 which effectively allows macros to be able to access variables in the entire scope chain.
  • Added unit test case for the same.

To enable global scoping:

new PebbleEngine.Builder().globalScoping(true)...

Also, excuse the IntelliJ formatting. Perhaps adding a .editorconfig will be nice.

@ebussieres ebussieres force-pushed the configure-scope-chain-visibility branch from 2bbe008 to f1f3336 Compare October 28, 2022 13:21
@ebussieres
Copy link
Member

ebussieres commented Oct 28, 2022

We should also disable the special "_context" variables when globalScoping is set to true.

Need to adjust also pebble-spring

@SharkFourSix
Copy link
Author

Do you mean here:

globals.put("_context", new GlobalContext(scopeChain));

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.

3 participants